[Scummvm-cvs-logs] SF.net SVN: scummvm: [20581] scummvm/trunk/lure

eriktorbjorn at users.sourceforge.net eriktorbjorn at users.sourceforge.net
Sat Feb 11 13:10:04 CET 2006


Revision: 20581
Author:   eriktorbjorn
Date:     2006-02-11 13:09:01 -0800 (Sat, 11 Feb 2006)
ViewCVS:  http://svn.sourceforge.net/scummvm?rev=20581&view=rev

Log Message:
-----------
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.

Modified Paths:
--------------
    scummvm/trunk/lure/events.cpp
    scummvm/trunk/lure/game.cpp
    scummvm/trunk/lure/menu.cpp
Modified: scummvm/trunk/lure/events.cpp
===================================================================
--- scummvm/trunk/lure/events.cpp	2006-02-11 20:28:53 UTC (rev 20580)
+++ scummvm/trunk/lure/events.cpp	2006-02-11 21:09:01 UTC (rev 20581)
@@ -99,6 +99,7 @@
 
 	do {
 		e.pollEvent();
+		_system.delayMillis(10);
 	} while (!e.quitFlag && (lButton() || rButton()));
 }
 
@@ -153,6 +154,7 @@
 				_mouse.waitForRelease();				
 			}
 		}
+		_system.delayMillis(10);
 	}
 }
 

Modified: scummvm/trunk/lure/game.cpp
===================================================================
--- scummvm/trunk/lure/game.cpp	2006-02-11 20:28:53 UTC (rev 20580)
+++ scummvm/trunk/lure/game.cpp	2006-02-11 21:09:01 UTC (rev 20581)
@@ -95,8 +95,9 @@
 		}
 		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 @@
 			// 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 @@
 				}
 				res.delayList().tick();
 				r.update();
+				system.delayMillis(10);
 			}
 
 			fields.setField(NEW_ROOM_NUMBER, 0);
@@ -373,6 +375,7 @@
 }
 
 void Game::doQuit() {
+	OSystem &system = System::getReference();
 	Mouse &mouse = Mouse::getReference();
 	Events &events = Events::getReference();
 	Screen &screen = Screen::getReference();
@@ -390,6 +393,7 @@
 				if ((key >= 'A') && (key <= 'Z')) key += 'a' - 'A';
 			}
 		}
+		system.delayMillis(10);
 	} while (((uint8) key != 27) && (key != 'y') && (key != 'n'));
 
 	events.quitFlag = key == 'y';

Modified: scummvm/trunk/lure/menu.cpp
===================================================================
--- scummvm/trunk/lure/menu.cpp	2006-02-11 20:28:53 UTC (rev 20580)
+++ scummvm/trunk/lure/menu.cpp	2006-02-11 21:09:01 UTC (rev 20581)
@@ -105,7 +105,7 @@
 	_selectedIndex = 0;
 
 	while (_mouse.lButton()) {
-		if (_events.pollEvent()) {
+		while (_events.pollEvent()) {
 			// handle events
 		}
 
@@ -147,6 +147,7 @@
 			_selectedIndex = index;
 			if (_selectedIndex != 0) toggleHighlightItem(_selectedIndex);
 		}
+		_system.delayMillis(10);
 	}
 
 	if (_surfaceMenu) delete _surfaceMenu;







More information about the Scummvm-git-logs mailing list