X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=lib%2Fspecial%2Ftimer.h;h=1866a2cc9076f8842d586ff3e96e7a5e6c3788f1;hb=7a87271678d68514ae2158c0c7adb383d6002872;hp=113ea063add9bcabe68ae9241910b6c6c0ab8169;hpb=edaacb3651cf0560314dd008d7243be4b3b2f8c6;p=supertux.git diff --git a/lib/special/timer.h b/lib/special/timer.h index 113ea063a..1866a2cc9 100644 --- a/lib/special/timer.h +++ b/lib/special/timer.h @@ -21,25 +21,34 @@ #ifndef SUPERTUX_TIMER_H #define SUPERTUX_TIMER_H +#include + namespace SuperTux { - extern unsigned int st_pause_ticks, st_pause_count; + class Ticks + { + public: + /// Time a game is running. (Non-pause mode, etc.) + static unsigned int get(); - /// Time a game is running. (Non-pause mode, etc.) - unsigned int st_get_ticks(void); + static void pause_init(); + static void pause_start(); + static void pause_stop(); + static bool pause_started(); - void st_pause_ticks_init(void); - void st_pause_ticks_start(void); - void st_pause_ticks_stop(void); - bool st_pause_ticks_started(void); + private: + static unsigned int pause_ticks; + static unsigned int pause_count; + + }; /// Timer /** This class can be used as stop watch for example. It's also possible to calculate frames per seconds and things like that with it. It's a general timing class, but it - can esspecially be used together with st_get_ticks(). */ + can esspecially be used together with Ticks::get(). */ class Timer { public: @@ -51,8 +60,8 @@ namespace SuperTux Timer(); /// Initialize the timer. - /** @param st_ticks: If true internally st_get_ticks() is used, else SDL_GetTicks() is used. */ - void init(bool st_ticks); + /** @param st_ticks: If true internally Ticks::get() is used, else SDL_GetTicks() is used. */ + void init(bool game_ticks); /// Start the timer with the given period (in ms). void start(unsigned int period);