aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorTorbjörn Andersson2006-02-26 13:43:50 +0000
committerTorbjörn Andersson2006-02-26 13:43:50 +0000
commitf13d294ae5e12a5906cf6088f5bc309d51192a9c (patch)
tree7195f918735445079ca157c93be38a03420e7c3c /engines
parentb568df4de6b7995f5778905250c73528fa43b489 (diff)
downloadscummvm-rg350-f13d294ae5e12a5906cf6088f5bc309d51192a9c.tar.gz
scummvm-rg350-f13d294ae5e12a5906cf6088f5bc309d51192a9c.tar.bz2
scummvm-rg350-f13d294ae5e12a5906cf6088f5bc309d51192a9c.zip
Cleaned up my earlier "delay in busy-wait loop" commit, and added a similar
delay to PopupMenu::Show(). svn-id: r20914
Diffstat (limited to 'engines')
-rw-r--r--engines/lure/events.cpp10
-rw-r--r--engines/lure/events.h6
-rw-r--r--engines/lure/lure.cpp4
-rw-r--r--engines/lure/menu.cpp1
4 files changed, 11 insertions, 10 deletions
diff --git a/engines/lure/events.cpp b/engines/lure/events.cpp
index 185884d755..51b22b8bf1 100644
--- a/engines/lure/events.cpp
+++ b/engines/lure/events.cpp
@@ -32,7 +32,7 @@ Mouse &Mouse::getReference() {
return *int_mouse;
}
-Mouse::Mouse(OSystem &system) : _system(system) {
+Mouse::Mouse() {
int_mouse = this;
_lButton = false;
@@ -99,11 +99,12 @@ void Mouse::setPosition(int newX, int newY) {
}
void Mouse::waitForRelease() {
+ OSystem &system = System::getReference();
Events &e = Events::getReference();
do {
e.pollEvent();
- _system.delayMillis(20);
+ system.delayMillis(20);
} while (!e.quitFlag && (lButton() || rButton()));
}
@@ -111,7 +112,7 @@ void Mouse::waitForRelease() {
static Events *int_events = NULL;
-Events::Events(OSystem &system) : _system(system) {
+Events::Events() {
int_events = this;
quitFlag = false;
}
@@ -148,6 +149,7 @@ bool Events::pollEvent() {
}
void Events::waitForPress() {
+ OSystem &system = System::getReference();
bool keyButton = false;
while (!keyButton) {
if (pollEvent()) {
@@ -159,7 +161,7 @@ void Events::waitForPress() {
Mouse::getReference().waitForRelease();
}
}
- _system.delayMillis(20);
+ system.delayMillis(20);
}
}
diff --git a/engines/lure/events.h b/engines/lure/events.h
index 547fa1826f..0287b6de19 100644
--- a/engines/lure/events.h
+++ b/engines/lure/events.h
@@ -32,12 +32,11 @@ namespace Lure {
class Mouse {
private:
- OSystem &_system;
uint8 _cursorNum;
int16 _x, _y;
bool _lButton, _rButton;
public:
- Mouse(OSystem &system);
+ Mouse();
~Mouse();
static Mouse &getReference();
void handleEvent(OSystem::Event event);
@@ -57,12 +56,11 @@ public:
class Events {
private:
- OSystem &_system;
OSystem::Event _event;
public:
bool quitFlag;
- Events(OSystem &system);
+ Events();
static Events &getReference();
bool pollEvent();
diff --git a/engines/lure/lure.cpp b/engines/lure/lure.cpp
index c72b1a6ae3..2fc47f7d62 100644
--- a/engines/lure/lure.cpp
+++ b/engines/lure/lure.cpp
@@ -251,8 +251,8 @@ int LureEngine::init(GameDetector &detector) {
_resources = new Resources();
_strings = new StringData();
_screen = new Screen(*_system);
- _mouse = new Mouse(*_system);
- _events = new Events(*_system);
+ _mouse = new Mouse();
+ _events = new Events();
_menu = new Menu();
Surface::initialise();
_room = new Room();
diff --git a/engines/lure/menu.cpp b/engines/lure/menu.cpp
index 57cdd751dd..9fa98d5300 100644
--- a/engines/lure/menu.cpp
+++ b/engines/lure/menu.cpp
@@ -412,6 +412,7 @@ uint16 PopupMenu::Show(int numEntries, const char *actions[]) {
break;
}
}
+ system.delayMillis(20);
}
mouse.setPosition(oldX, oldY);