diff options
-rw-r--r-- | backends/modular-backend.cpp | 15 | ||||
-rw-r--r-- | backends/modular-backend.h | 3 | ||||
-rw-r--r-- | backends/platform/sdl/sdl.cpp | 23 | ||||
-rw-r--r-- | backends/platform/sdl/sdl.h | 4 | ||||
-rw-r--r-- | backends/timer/default/default-timer.h | 4 | ||||
-rw-r--r-- | backends/timer/sdl/sdl-timer.cpp | 23 | ||||
-rw-r--r-- | backends/timer/sdl/sdl-timer.h | 4 |
7 files changed, 27 insertions, 49 deletions
diff --git a/backends/modular-backend.cpp b/backends/modular-backend.cpp index 935b64dc36..b9560f7693 100644 --- a/backends/modular-backend.cpp +++ b/backends/modular-backend.cpp @@ -209,21 +209,6 @@ void ModularBackend::disableCursorPalette(bool disable) { _graphicsManager->disableCursorPalette(disable); } -uint32 ModularBackend::getMillis() { - assert(_timerManager); - return _timerManager->getMillis(); -} - -void ModularBackend::delayMillis(uint msecs) { - assert(_timerManager); - _timerManager->delayMillis(msecs); -} - -void ModularBackend::getTimeAndDate(TimeDate &t) const { - assert(_timerManager); - return _timerManager->getTimeAndDate(t); -} - Common::TimerManager *ModularBackend::getTimerManager() { assert(_timerManager); return _timerManager; diff --git a/backends/modular-backend.h b/backends/modular-backend.h index dec973fb10..e4bc843dbe 100644 --- a/backends/modular-backend.h +++ b/backends/modular-backend.h @@ -85,9 +85,6 @@ public: virtual void setCursorPalette(const byte *colors, uint start, uint num); virtual void disableCursorPalette(bool disable); - virtual uint32 getMillis(); - virtual void delayMillis(uint msecs); - virtual void getTimeAndDate(TimeDate &t) const; virtual Common::TimerManager *getTimerManager(); virtual Common::EventManager *getEventManager(); virtual Common::HardwareKeySet *getHardwareKeySet() { return 0; } diff --git a/backends/platform/sdl/sdl.cpp b/backends/platform/sdl/sdl.cpp index 37c01dfc1f..3387503204 100644 --- a/backends/platform/sdl/sdl.cpp +++ b/backends/platform/sdl/sdl.cpp @@ -34,6 +34,7 @@ #include "common/config-manager.h" #include "common/debug.h" #include "common/util.h" +#include "common/EventRecorder.h" #ifdef UNIX #include "backends/saves/posix/posix-saves.h" @@ -75,6 +76,7 @@ #include "CoreFoundation/CoreFoundation.h" #endif +#include <time.h> void OSystem_SDL::initBackend() { assert(!_inited); @@ -384,3 +386,24 @@ bool OSystem_SDL::pollEvent(Common::Event &event) { assert(_eventManager); return ((SdlEventManager *)_eventManager)->pollSdlEvent(event); } + +uint32 OSystem_SDL::getMillis() { + uint32 millis = SDL_GetTicks(); + g_eventRec.processMillis(millis); + return millis; +} + +void OSystem_SDL::delayMillis(uint msecs) { + SDL_Delay(msecs); +} + +void OSystem_SDL::getTimeAndDate(TimeDate &td) const { + time_t curTime = time(0); + struct tm t = *localtime(&curTime); + td.tm_sec = t.tm_sec; + td.tm_min = t.tm_min; + td.tm_hour = t.tm_hour; + td.tm_mday = t.tm_mday; + td.tm_mon = t.tm_mon; + td.tm_year = t.tm_year; +} diff --git a/backends/platform/sdl/sdl.h b/backends/platform/sdl/sdl.h index 8dae6a779c..46053faf46 100644 --- a/backends/platform/sdl/sdl.h +++ b/backends/platform/sdl/sdl.h @@ -60,6 +60,10 @@ public: virtual bool pollEvent(Common::Event &event); + uint32 getMillis(); + void delayMillis(uint msecs); + void getTimeAndDate(TimeDate &td) const; + protected: bool _inited; diff --git a/backends/timer/default/default-timer.h b/backends/timer/default/default-timer.h index c6da831f64..e7ac3d122f 100644 --- a/backends/timer/default/default-timer.h +++ b/backends/timer/default/default-timer.h @@ -48,10 +48,6 @@ public: * Timer callback, to be invoked at regular time intervals by the backend. */ void handler(); - - virtual uint32 getMillis() { return 0; } - virtual void delayMillis(uint msecs) {} - virtual void getTimeAndDate(TimeDate &t) const {} }; #endif diff --git a/backends/timer/sdl/sdl-timer.cpp b/backends/timer/sdl/sdl-timer.cpp index 4fcd2f2ac7..0fbe12589e 100644 --- a/backends/timer/sdl/sdl-timer.cpp +++ b/backends/timer/sdl/sdl-timer.cpp @@ -27,8 +27,6 @@ #if defined(WIN32) || defined(UNIX) || defined(MACOSX) #include "backends/timer/sdl/sdl-timer.h" -#include "common/EventRecorder.h" -#include <time.h> static Uint32 timer_handler(Uint32 interval, void *param) { ((DefaultTimerManager *)param)->handler(); @@ -47,25 +45,4 @@ SdlTimerManager::~SdlTimerManager() { SDL_RemoveTimer(_timerID); } -uint32 SdlTimerManager::getMillis() { - uint32 millis = SDL_GetTicks(); - g_eventRec.processMillis(millis); - return millis; -} - -void SdlTimerManager::delayMillis(uint msecs) { - SDL_Delay(msecs); -} - -void SdlTimerManager::getTimeAndDate(TimeDate &td) const { - time_t curTime = time(0); - struct tm t = *localtime(&curTime); - td.tm_sec = t.tm_sec; - td.tm_min = t.tm_min; - td.tm_hour = t.tm_hour; - td.tm_mday = t.tm_mday; - td.tm_mon = t.tm_mon; - td.tm_year = t.tm_year; -} - #endif diff --git a/backends/timer/sdl/sdl-timer.h b/backends/timer/sdl/sdl-timer.h index 0c9669f042..19629151ca 100644 --- a/backends/timer/sdl/sdl-timer.h +++ b/backends/timer/sdl/sdl-timer.h @@ -39,10 +39,6 @@ public: SdlTimerManager(); ~SdlTimerManager(); - uint32 getMillis(); - void delayMillis(uint msecs); - void getTimeAndDate(TimeDate &t) const; - protected: SDL_TimerID _timerID; }; |