diff options
author | Torbjörn Andersson | 2006-02-11 21:09:01 +0000 |
---|---|---|
committer | Torbjörn Andersson | 2006-02-11 21:09:01 +0000 |
commit | 2a9a0d4211b1ea5723f1409d91cb95de8984429e (patch) | |
tree | ecedadd284f2783d0427df0e2495ff7397ed4997 /lure | |
parent | bd39c3cb3e105756155caf81cabf57173b9c10a7 (diff) | |
download | scummvm-rg350-2a9a0d4211b1ea5723f1409d91cb95de8984429e.tar.gz scummvm-rg350-2a9a0d4211b1ea5723f1409d91cb95de8984429e.tar.bz2 scummvm-rg350-2a9a0d4211b1ea5723f1409d91cb95de8984429e.zip |
Quick fixes of unknown cleanliness: The mouse cursor is no longer unbelievably
sluggish on my computer, and I've added delays to some busy-wait loops to make
it less of a CPU hog.
I hope I didn't break anything.
svn-id: r20581
Diffstat (limited to 'lure')
-rw-r--r-- | lure/events.cpp | 2 | ||||
-rw-r--r-- | lure/game.cpp | 8 | ||||
-rw-r--r-- | lure/menu.cpp | 3 |
3 files changed, 10 insertions, 3 deletions
diff --git a/lure/events.cpp b/lure/events.cpp index 2a920965b0..1d8ce03b42 100644 --- a/lure/events.cpp +++ b/lure/events.cpp @@ -99,6 +99,7 @@ void Mouse::waitForRelease() { do { e.pollEvent(); + _system.delayMillis(10); } while (!e.quitFlag && (lButton() || rButton())); } @@ -153,6 +154,7 @@ void Events::waitForPress() { _mouse.waitForRelease(); } } + _system.delayMillis(10); } } diff --git a/lure/game.cpp b/lure/game.cpp index d86b4a7bb3..2cc3e39b42 100644 --- a/lure/game.cpp +++ b/lure/game.cpp @@ -95,8 +95,9 @@ void Game::execute() { } res.delayList().tick(); r.update(); + system.delayMillis(10); - if (events.pollEvent()) { + while (events.pollEvent()) { if (events.type() == OSystem::EVENT_KEYDOWN) { uint16 roomNum = r.roomNumber(); @@ -170,7 +171,7 @@ void Game::execute() { // This code eventually needs to be moved into the main loop so that, // amongst other things, the tick handlers controlling animation can work while (!events.quitFlag && !mouse.lButton() && !mouse.rButton()) { - if (events.pollEvent()) { + while (events.pollEvent()) { if ((events.type() == OSystem::EVENT_KEYDOWN) && (events.event().kbd.ascii == 27)) events.quitFlag = true; @@ -184,6 +185,7 @@ void Game::execute() { } res.delayList().tick(); r.update(); + system.delayMillis(10); } fields.setField(NEW_ROOM_NUMBER, 0); @@ -373,6 +375,7 @@ void Game::doShowCredits() { } void Game::doQuit() { + OSystem &system = System::getReference(); Mouse &mouse = Mouse::getReference(); Events &events = Events::getReference(); Screen &screen = Screen::getReference(); @@ -390,6 +393,7 @@ void Game::doQuit() { if ((key >= 'A') && (key <= 'Z')) key += 'a' - 'A'; } } + system.delayMillis(10); } while (((uint8) key != 27) && (key != 'y') && (key != 'n')); events.quitFlag = key == 'y'; diff --git a/lure/menu.cpp b/lure/menu.cpp index b1fbd4a5b4..752b11f339 100644 --- a/lure/menu.cpp +++ b/lure/menu.cpp @@ -105,7 +105,7 @@ uint8 Menu::execute() { _selectedIndex = 0; while (_mouse.lButton()) { - if (_events.pollEvent()) { + while (_events.pollEvent()) { // handle events } @@ -147,6 +147,7 @@ uint8 Menu::execute() { _selectedIndex = index; if (_selectedIndex != 0) toggleHighlightItem(_selectedIndex); } + _system.delayMillis(10); } if (_surfaceMenu) delete _surfaceMenu; |