aboutsummaryrefslogtreecommitdiff
path: root/engines/lure/events.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'engines/lure/events.cpp')
-rw-r--r--engines/lure/events.cpp19
1 files changed, 10 insertions, 9 deletions
diff --git a/engines/lure/events.cpp b/engines/lure/events.cpp
index 97da8bdb03..30e0e571b7 100644
--- a/engines/lure/events.cpp
+++ b/engines/lure/events.cpp
@@ -29,7 +29,6 @@
#include "graphics/cursorman.h"
#include "lure/events.h"
-#include "lure/lure.h"
#include "lure/res.h"
namespace Lure {
@@ -138,12 +137,11 @@ void Mouse::setPosition(int newX, int newY) {
void Mouse::waitForRelease() {
Events &e = Events::getReference();
- LureEngine &engine = LureEngine::getReference();
do {
- while (e.pollEvent() && !engine.quit()) ;
+ while (e.pollEvent() && !e.quitFlag) ;
g_system->delayMillis(20);
- } while (!engine.quit() && (lButton() || rButton() || mButton()));
+ } while (!e.quitFlag && (lButton() || rButton() || mButton()));
}
/*--------------------------------------------------------------------------*/
@@ -152,6 +150,7 @@ static Events *int_events = NULL;
Events::Events() {
int_events = this;
+ quitFlag = false;
}
Events &Events::getReference() {
@@ -164,6 +163,10 @@ bool Events::pollEvent() {
// Handle keypress
switch (_event.type) {
+ case Common::EVENT_QUIT:
+ quitFlag = true;
+ break;
+
case Common::EVENT_LBUTTONDOWN:
case Common::EVENT_LBUTTONUP:
case Common::EVENT_RBUTTONDOWN:
@@ -187,7 +190,7 @@ void Events::waitForPress() {
bool keyButton = false;
while (!keyButton) {
while (pollEvent()) {
- if ((_event.type == Common::EVENT_QUIT) || (_event.type == Common::EVENT_RTL)) return;
+ if (_event.type == Common::EVENT_QUIT) return;
else if ((_event.type == Common::EVENT_KEYDOWN) && (_event.kbd.ascii != 0))
keyButton = true;
else if ((_event.type == Common::EVENT_LBUTTONDOWN) ||
@@ -207,15 +210,13 @@ void Events::waitForPress() {
bool Events::interruptableDelay(uint32 milliseconds) {
Events &events = Events::getReference();
- LureEngine &engine = LureEngine::getReference();
uint32 delayCtr = g_system->getMillis() + milliseconds;
while (g_system->getMillis() < delayCtr) {
- if (engine.quit()) return true;
+ if (events.quitFlag) return true;
if (events.pollEvent()) {
- if (((events.type() == Common::EVENT_KEYDOWN) && (events.event().kbd.ascii != 0) &&
- events.event().kbd.keycode != KEYCODE_MAINMENU) ||
+ if (((events.type() == Common::EVENT_KEYDOWN) && (events.event().kbd.ascii != 0)) ||
(events.type() == Common::EVENT_LBUTTONDOWN))
return true;
}