util.c: floating point timers for game loop

This commit is contained in:
2024-07-08 23:47:22 +03:00
parent 98467831d1
commit 194bf0e266
4 changed files with 27 additions and 1 deletions

View File

@@ -118,4 +118,14 @@ typedef struct fvec2 {
void tick_timer(int *value);
/* decrements a floating point second-based timer, stopping at 0.0 */
/* meant for poll based real time logic in game logic */
/* note that it should be decremented only on the next tick after its creation */
void tick_ftimer(float *value);
/* same as `tick_ftimer` but instaed of clamping it repeats */
/* returns true if value was cycled */
bool tick_ftimer_repeat(float *value, float at);
#endif