17 #ifndef HEADER_SUPERTUX_SUPERTUX_TIMER_HPP 18 #define HEADER_SUPERTUX_SUPERTUX_TIMER_HPP 20 #include "supertux/globals.hpp" 32 void start(
float period,
bool cyclic =
false);
43 float get_timeleft()
const{
return m_period - (g_game_time - m_cycle_start); }
44 float get_timegone()
const {
return g_game_time - m_cycle_start; }
45 bool started()
const {
return m_period != 0 && get_timeleft() > 0; }
float get_period() const
returns the period of the timer or 0 if it isn't started
Definition: timer.hpp:42
void start(float period, bool cyclic=false)
start the timer with the given period (in seconds).
Definition: timer.cpp:29
bool check()
returns true if a period (or more) passed since start call or last successful check ...
Definition: timer.cpp:37
Simple timer designed to be used in the update functions of objects.
Definition: timer.hpp:24
void stop()
stop the timer
Definition: timer.hpp:39