mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-17 23:44:22 +00:00
Cleaned up my earlier "delay in busy-wait loop" commit, and added a similar
delay to PopupMenu::Show(). svn-id: r20914
This commit is contained in:
parent
b568df4de6
commit
f13d294ae5
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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();
|
||||
|
@ -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();
|
||||
|
@ -412,6 +412,7 @@ uint16 PopupMenu::Show(int numEntries, const char *actions[]) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
system.delayMillis(20);
|
||||
}
|
||||
|
||||
mouse.setPosition(oldX, oldY);
|
||||
|
Loading…
x
Reference in New Issue
Block a user