Operation Null Mind 0.4.1
A 2D roguelike top down shooter game made with SDL2
 
Loading...
Searching...
No Matches
timer.h
Go to the documentation of this file.
1
38#pragma once
39#include <SDL.h>
40#include <stdbool.h>
41
48typedef struct Timer {
49 float startTime;
51 float duration;
53 bool finished;
55
61Timer* Timer_Create(float duration);
62
67void Timer_Start(Timer *timer);
68
74bool Timer_IsFinished(Timer *timer);
75
81float Timer_GetTimeLeft(Timer *timer);
82
88bool Timer_IsInProgress(Timer *timer);
89
94void Timer_Destroy(Timer *timer);
The Timer struct used to keep track of time.
Definition timer.h:48
float duration
Duration of the timer in seconds.
Definition timer.h:51
bool inProgress
Flag indicating if the timer is in progress.
Definition timer.h:52
float startTime
Time when the timer was started.
Definition timer.h:49
bool finished
Flag indicating if the timer is finished.
Definition timer.h:53
float elapsedTime
Time elapsed since the timer was started.
Definition timer.h:50
float Timer_GetTimeLeft(Timer *timer)
Gets the time left on the timer.
Definition timer.c:83
void Timer_Start(Timer *timer)
Starts the timer.
Definition timer.c:45
bool Timer_IsInProgress(Timer *timer)
Checks if the timer is in progress.
Definition timer.c:96
Timer * Timer_Create(float duration)
Creates a new timer with the specified duration.
Definition timer.c:27
void Timer_Destroy(Timer *timer)
Destroys the timer and frees its memory.
Definition timer.c:105
bool Timer_IsFinished(Timer *timer)
Checks if the timer is finished.
Definition timer.c:61