mirror of
https://github.com/libretro/scummvm.git
synced 2025-05-13 09:36:21 +00:00
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
This commit is contained in:
parent
bd39c3cb3e
commit
2a9a0d4211
@ -99,6 +99,7 @@ void Mouse::waitForRelease() {
|
|||||||
|
|
||||||
do {
|
do {
|
||||||
e.pollEvent();
|
e.pollEvent();
|
||||||
|
_system.delayMillis(10);
|
||||||
} while (!e.quitFlag && (lButton() || rButton()));
|
} while (!e.quitFlag && (lButton() || rButton()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -153,6 +154,7 @@ void Events::waitForPress() {
|
|||||||
_mouse.waitForRelease();
|
_mouse.waitForRelease();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
_system.delayMillis(10);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -95,8 +95,9 @@ void Game::execute() {
|
|||||||
}
|
}
|
||||||
res.delayList().tick();
|
res.delayList().tick();
|
||||||
r.update();
|
r.update();
|
||||||
|
system.delayMillis(10);
|
||||||
|
|
||||||
if (events.pollEvent()) {
|
while (events.pollEvent()) {
|
||||||
if (events.type() == OSystem::EVENT_KEYDOWN) {
|
if (events.type() == OSystem::EVENT_KEYDOWN) {
|
||||||
uint16 roomNum = r.roomNumber();
|
uint16 roomNum = r.roomNumber();
|
||||||
|
|
||||||
@ -170,7 +171,7 @@ void Game::execute() {
|
|||||||
// This code eventually needs to be moved into the main loop so that,
|
// This code eventually needs to be moved into the main loop so that,
|
||||||
// amongst other things, the tick handlers controlling animation can work
|
// amongst other things, the tick handlers controlling animation can work
|
||||||
while (!events.quitFlag && !mouse.lButton() && !mouse.rButton()) {
|
while (!events.quitFlag && !mouse.lButton() && !mouse.rButton()) {
|
||||||
if (events.pollEvent()) {
|
while (events.pollEvent()) {
|
||||||
if ((events.type() == OSystem::EVENT_KEYDOWN) &&
|
if ((events.type() == OSystem::EVENT_KEYDOWN) &&
|
||||||
(events.event().kbd.ascii == 27))
|
(events.event().kbd.ascii == 27))
|
||||||
events.quitFlag = true;
|
events.quitFlag = true;
|
||||||
@ -184,6 +185,7 @@ void Game::execute() {
|
|||||||
}
|
}
|
||||||
res.delayList().tick();
|
res.delayList().tick();
|
||||||
r.update();
|
r.update();
|
||||||
|
system.delayMillis(10);
|
||||||
}
|
}
|
||||||
|
|
||||||
fields.setField(NEW_ROOM_NUMBER, 0);
|
fields.setField(NEW_ROOM_NUMBER, 0);
|
||||||
@ -373,6 +375,7 @@ void Game::doShowCredits() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Game::doQuit() {
|
void Game::doQuit() {
|
||||||
|
OSystem &system = System::getReference();
|
||||||
Mouse &mouse = Mouse::getReference();
|
Mouse &mouse = Mouse::getReference();
|
||||||
Events &events = Events::getReference();
|
Events &events = Events::getReference();
|
||||||
Screen &screen = Screen::getReference();
|
Screen &screen = Screen::getReference();
|
||||||
@ -390,6 +393,7 @@ void Game::doQuit() {
|
|||||||
if ((key >= 'A') && (key <= 'Z')) key += 'a' - 'A';
|
if ((key >= 'A') && (key <= 'Z')) key += 'a' - 'A';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
system.delayMillis(10);
|
||||||
} while (((uint8) key != 27) && (key != 'y') && (key != 'n'));
|
} while (((uint8) key != 27) && (key != 'y') && (key != 'n'));
|
||||||
|
|
||||||
events.quitFlag = key == 'y';
|
events.quitFlag = key == 'y';
|
||||||
|
@ -105,7 +105,7 @@ uint8 Menu::execute() {
|
|||||||
_selectedIndex = 0;
|
_selectedIndex = 0;
|
||||||
|
|
||||||
while (_mouse.lButton()) {
|
while (_mouse.lButton()) {
|
||||||
if (_events.pollEvent()) {
|
while (_events.pollEvent()) {
|
||||||
// handle events
|
// handle events
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -147,6 +147,7 @@ uint8 Menu::execute() {
|
|||||||
_selectedIndex = index;
|
_selectedIndex = index;
|
||||||
if (_selectedIndex != 0) toggleHighlightItem(_selectedIndex);
|
if (_selectedIndex != 0) toggleHighlightItem(_selectedIndex);
|
||||||
}
|
}
|
||||||
|
_system.delayMillis(10);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_surfaceMenu) delete _surfaceMenu;
|
if (_surfaceMenu) delete _surfaceMenu;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user