Wise&mystical  1.0
Project about Europe
Loading...
Searching...
No Matches
timer.cpp
Go to the documentation of this file.
1#include "raylib.h"
2#include "timer.h"
3
7void StartTimer(Timer* timer, float lifetime)
8{
9 if (timer != NULL)
10 {
11 timer->Lifetime = lifetime;
12 }
13}
14
18void UpdateTimer(Timer* timer)
19{
20 // Subtract this frame from the timer if it's not allready expired
21 if (timer != NULL && timer->Lifetime > 0)
22 {
23 timer->Lifetime -= GetFrameTime();
24 }
25}
26
30bool TimerDone(Timer* timer)
31{
32 if (timer != NULL)
33 {
34 return timer->Lifetime <= 0;
35 }
36
37 return false;
38}
#define NULL
Definition: miniaudio.h:3718
RLAPI float GetFrameTime(void)
Definition: rcore.c:2717
Definition: timer.h:5
float Lifetime
Definition: timer.h:6
void StartTimer(Timer *timer, float lifetime)
Start or restart a timer with a specific lifetime.
Definition: timer.cpp:7
void UpdateTimer(Timer *timer)
Update a timer with the current frame time.
Definition: timer.cpp:18
bool TimerDone(Timer *timer)
Check if a timer is done.
Definition: timer.cpp:30