aboutsummaryrefslogtreecommitdiff
path: root/engines/gargoyle/events.cpp
diff options
context:
space:
mode:
authorPaul Gilbert2018-11-09 20:27:14 -0800
committerPaul Gilbert2018-12-08 19:05:59 -0800
commit601e1d486b038f121323e78ed68a154d6763c9f1 (patch)
treea80922d2fcd0a64c8f023928cabe588b902d1d0a /engines/gargoyle/events.cpp
parent43bee7a72783cd60b86249997bfdaf7af5e5d740 (diff)
downloadscummvm-rg350-601e1d486b038f121323e78ed68a154d6763c9f1.tar.gz
scummvm-rg350-601e1d486b038f121323e78ed68a154d6763c9f1.tar.bz2
scummvm-rg350-601e1d486b038f121323e78ed68a154d6763c9f1.zip
GLK: Add GLK timer intervals
Diffstat (limited to 'engines/gargoyle/events.cpp')
-rw-r--r--engines/gargoyle/events.cpp20
1 files changed, 15 insertions, 5 deletions
diff --git a/engines/gargoyle/events.cpp b/engines/gargoyle/events.cpp
index bc56407ee8..520b6f22e5 100644
--- a/engines/gargoyle/events.cpp
+++ b/engines/gargoyle/events.cpp
@@ -53,8 +53,8 @@ const byte ARROW[] = {
4, 2, 5, 5
};
-Events::Events() : _forceClick(false), _currentEvent(nullptr), _timeouts(false),
- _priorFrameTime(0), _frameCounter(0), _cursorId(CURSOR_NONE) {
+Events::Events() : _forceClick(false), _currentEvent(nullptr), _cursorId(CURSOR_NONE),
+ _timerMilli(0), _timerTimeExpiry(0), _priorFrameTime(0), _frameCounter(0) {
initializeCursors();
}
@@ -118,7 +118,7 @@ void Events::getEvent(event_t *event, bool polled) {
dispatchEvent(*_currentEvent, polled);
if (!polled) {
- while (!g_vm->shouldQuit() && _currentEvent->type == evtype_None && !_timeouts) {
+ while (!g_vm->shouldQuit() && _currentEvent->type == evtype_None && !isTimerExpired()) {
pollEvents();
g_system->delayMillis(10);
@@ -129,10 +129,11 @@ void Events::getEvent(event_t *event, bool polled) {
_currentEvent->type = evtype_Quit;
}
- if (_currentEvent->type == evtype_None && _timeouts) {
+ if (_currentEvent->type == evtype_None && isTimerExpired()) {
store(evtype_Timer, nullptr, 0, 0);
dispatchEvent(*_currentEvent, polled);
- _timeouts = false;
+
+ _timerTimeExpiry = g_system->getMillis() + _timerMilli;
}
_currentEvent = nullptr;
@@ -338,4 +339,13 @@ void Events::setCursor(CursorId cursorId) {
}
}
+void Events::setTimerInterval(uint milli) {
+ _timerMilli = milli;
+ _timerTimeExpiry = g_system->getMillis() + milli;
+}
+
+bool Events::isTimerExpired() const {
+ return _timerMilli && g_system->getMillis() >= _timerTimeExpiry;
+}
+
} // End of namespace Gargoyle