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, 9 insertions, 10 deletions
diff --git a/engines/lure/events.cpp b/engines/lure/events.cpp
index 30e0e571b7..97da8bdb03 100644
--- a/engines/lure/events.cpp
+++ b/engines/lure/events.cpp
@@ -29,6 +29,7 @@
#include "graphics/cursorman.h"
#include "lure/events.h"
+#include "lure/lure.h"
#include "lure/res.h"
namespace Lure {
@@ -137,11 +138,12 @@ void Mouse::setPosition(int newX, int newY) {
void Mouse::waitForRelease() {
Events &e = Events::getReference();
+ LureEngine &engine = LureEngine::getReference();
do {
- while (e.pollEvent() && !e.quitFlag) ;
+ while (e.pollEvent() && !engine.quit()) ;
g_system->delayMillis(20);
- } while (!e.quitFlag && (lButton() || rButton() || mButton()));
+ } while (!engine.quit() && (lButton() || rButton() || mButton()));
}
/*--------------------------------------------------------------------------*/
@@ -150,7 +152,6 @@ static Events *int_events = NULL;
Events::Events() {
int_events = this;
- quitFlag = false;
}
Events &Events::getReference() {
@@ -163,10 +164,6 @@ 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:
@@ -190,7 +187,7 @@ void Events::waitForPress() {
bool keyButton = false;
while (!keyButton) {
while (pollEvent()) {
- if (_event.type == Common::EVENT_QUIT) return;
+ if ((_event.type == Common::EVENT_QUIT) || (_event.type == Common::EVENT_RTL)) return;
else if ((_event.type == Common::EVENT_KEYDOWN) && (_event.kbd.ascii != 0))
keyButton = true;
else if ((_event.type == Common::EVENT_LBUTTONDOWN) ||
@@ -210,13 +207,15 @@ 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 (events.quitFlag) return true;
+ if (engine.quit()) return true;
if (events.pollEvent()) {
- if (((events.type() == Common::EVENT_KEYDOWN) && (events.event().kbd.ascii != 0)) ||
+ if (((events.type() == Common::EVENT_KEYDOWN) && (events.event().kbd.ascii != 0) &&
+ events.event().kbd.keycode != KEYCODE_MAINMENU) ||
(events.type() == Common::EVENT_LBUTTONDOWN))
return true;
}