Removed getMillis, delayMillis and getTimeAndDate functions from TimerManager.

svn-id: r50095
This commit is contained in:
Alejandro Marzini 2010-06-20 20:11:30 +00:00
parent 99c0f82608
commit 4a850209d7
7 changed files with 27 additions and 49 deletions

View File

@ -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;

View File

@ -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; }

View File

@ -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;
}

View File

@ -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;

View File

@ -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

View File

@ -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

View File

@ -39,10 +39,6 @@ public:
SdlTimerManager();
~SdlTimerManager();
uint32 getMillis();
void delayMillis(uint msecs);
void getTimeAndDate(TimeDate &t) const;
protected:
SDL_TimerID _timerID;
};