diff options
Diffstat (limited to 'backends/timer')
-rw-r--r-- | backends/timer/default/default-timer.h | 3 | ||||
-rw-r--r-- | backends/timer/sdl/sdl-timer.cpp | 3 | ||||
-rw-r--r-- | backends/timer/sdl/sdl-timer.h | 6 |
3 files changed, 10 insertions, 2 deletions
diff --git a/backends/timer/default/default-timer.h b/backends/timer/default/default-timer.h index e7ac3d122f..778c69b32d 100644 --- a/backends/timer/default/default-timer.h +++ b/backends/timer/default/default-timer.h @@ -40,7 +40,8 @@ private: public: DefaultTimerManager(); - ~DefaultTimerManager(); + virtual ~DefaultTimerManager(); + bool installTimerProc(TimerProc proc, int32 interval, void *refCon); void removeTimerProc(TimerProc proc); diff --git a/backends/timer/sdl/sdl-timer.cpp b/backends/timer/sdl/sdl-timer.cpp index 0fbe12589e..94932d61ba 100644 --- a/backends/timer/sdl/sdl-timer.cpp +++ b/backends/timer/sdl/sdl-timer.cpp @@ -34,14 +34,17 @@ static Uint32 timer_handler(Uint32 interval, void *param) { } SdlTimerManager::SdlTimerManager() { + // Initializes the SDL timer subsystem if (SDL_InitSubSystem(SDL_INIT_TIMER) == -1) { error("Could not initialize SDL: %s", SDL_GetError()); } + // Creates the timer callback _timerID = SDL_AddTimer(10, &timer_handler, this); } SdlTimerManager::~SdlTimerManager() { + // Removes the timer callback SDL_RemoveTimer(_timerID); } diff --git a/backends/timer/sdl/sdl-timer.h b/backends/timer/sdl/sdl-timer.h index 19629151ca..5995aed4b0 100644 --- a/backends/timer/sdl/sdl-timer.h +++ b/backends/timer/sdl/sdl-timer.h @@ -34,10 +34,14 @@ #include <SDL.h> #endif +/** + * SDL timer manager. Setups the timer callback for + * DefaultTimerManager. + */ class SdlTimerManager : public DefaultTimerManager { public: SdlTimerManager(); - ~SdlTimerManager(); + virtual ~SdlTimerManager(); protected: SDL_TimerID _timerID; |