diff options
| author | esquizo <esquizo+noreply@esquizo.net> | 2026-05-19 14:17:02 -0300 |
|---|---|---|
| committer | esquizo <esquizo+noreply@esquizo.net> | 2026-05-19 14:17:02 -0300 |
| commit | 1acc7cf7c81715cddbf9b732c809d2a5c69560ae (patch) | |
| tree | 936c82dd07c9946cfb3675580ae1dfa6478737e6 /libphysics/tick.c | |
| parent | 71606b8b9310128ccc5f5271668332706f96c8d5 (diff) | |
libphysics: movido o phxmakeblkmap() para o tick fixo
Diffstat (limited to 'libphysics/tick.c')
| -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) |
