Mercurial > projects > openmelee
diff main.d @ 17:82efafc87d54
fixed camera zoom
author | zzzzrrr <mason.green@gmail.com> |
---|---|
date | Tue, 24 Mar 2009 16:47:42 -0400 |
parents | 8e6a9e390cba |
children |
line wrap: on
line diff
--- a/main.d Tue Mar 24 13:29:16 2009 -0400 +++ b/main.d Tue Mar 24 16:47:42 2009 -0400 @@ -49,7 +49,7 @@ import openmelee.render; import openmelee.ai; -const ITERS_PER_SECOND = 60; +const ITERS_PER_SECOND = 100; void main() { @@ -77,13 +77,19 @@ StopWatch timer; jobHub.addRepeatableJob( { - - // Update AI - ai.move(whut.ship1); - // Update physics whut.world.step(timeStep, settings.velocityIterations, settings.positionIterations); + }, ITERS_PER_SECOND); + + bool running = true; + + jobHub.addPreFrameJob( { + // Update AI + ai.move(whut.ship1); + }); + + jobHub.addPostFrameJob( { // Limit velocity whut.ship1.limitVelocity(); @@ -91,15 +97,6 @@ whut.ship1.updateState(); whut.ship2.updateState(); - }, ITERS_PER_SECOND); - - bool running = true; - - jobHub.addPreFrameJob( { - }); - - jobHub.addPostFrameJob( { - gui.begin(cfg); gui.push(`main`); if (gui().getProperty!(bool)("frame.closeClicked")) { @@ -116,15 +113,6 @@ gui.end; gui.render(renderer); - { - vec2 p1 = vec2.from(whut.ship1.rBody.position); - vec2 p2 = vec2.from(whut.ship2.rBody.position); - vec2 distance = p1 - p2; - float d = distance.length; - whut.zoom = bzClamp(1/d*1000, 2, 50); - whut.viewCenter = p1 - (distance * 0.5f); - } - }); while (running && !whut.quit) {