diff options
| -rw-r--r-- | libphysics/tick.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/libphysics/tick.c b/libphysics/tick.c index 40b3a2c..f31930a 100644 --- a/libphysics/tick.c +++ b/libphysics/tick.c @@ -19,20 +19,14 @@ void phxtick(float delta) { static float time; - static int count = 0; time += delta; if(time >= PHX_TICK_TIME) { - phxmakeblkmap(); while(time >= PHX_TICK_TIME) { - if(count++ > 4) { - phxmakeblkmap(); - count = 0; - } - tick(); time -= PHX_TICK_TIME; } + for(int i = 0; i < phxbodypoolsize; i++) { Body *b = phxbodypool + i; if(!b->active) @@ -47,6 +41,13 @@ phxtick(float delta) void tick(void) { + static int count = 0; + + if(!count) { + phxmakeblkmap(); + } + count = (count + 1) % 4; + for(int i = 0; i < phxbodypoolsize; i++) { Body *b = phxbodypool + i; if(!b->active) |
