[Scummvm-cvs-logs] SF.net SVN: scummvm:[42558] scummvm/trunk/engines/cruise
dreammaster at users.sourceforge.net
dreammaster at users.sourceforge.net
Fri Jul 17 07:10:24 CEST 2009
Revision: 42558
http://scummvm.svn.sourceforge.net/scummvm/?rev=42558&view=rev
Author: dreammaster
Date: 2009-07-17 05:10:24 +0000 (Fri, 17 Jul 2009)
Log Message:
-----------
Added an explicit break out of the event processing loop for mouse buttons and/or key-presses - this should allow stylus-based systems to properly process 'mouse down' events before the 'mouse up' is processed
Modified Paths:
--------------
scummvm/trunk/engines/cruise/cruise_main.cpp
scummvm/trunk/engines/cruise/menu.cpp
Modified: scummvm/trunk/engines/cruise/cruise_main.cpp
===================================================================
--- scummvm/trunk/engines/cruise/cruise_main.cpp 2009-07-17 01:55:11 UTC (rev 42557)
+++ scummvm/trunk/engines/cruise/cruise_main.cpp 2009-07-17 05:10:24 UTC (rev 42558)
@@ -1626,11 +1626,14 @@
bool bFastMode = false;
-void manageEvents() {
+bool manageEvents() {
Common::Event event;
+ bool result = false;
Common::EventManager * eventMan = g_system->getEventManager();
- while (eventMan->pollEvent(event)) {
+ while (eventMan->pollEvent(event) && !result) {
+ result = true;
+
switch (event.type) {
case Common::EVENT_LBUTTONDOWN:
currentMouseButton |= MB_LEFT;
@@ -1647,11 +1650,12 @@
case Common::EVENT_MOUSEMOVE:
currentMouseX = event.mouse.x;
currentMouseY = event.mouse.y;
+ result = false;
break;
case Common::EVENT_QUIT:
case Common::EVENT_RTL:
playerDontAskQuit = 1;
- return;
+ break;
case Common::EVENT_KEYUP:
switch (event.kbd.keycode) {
case Common::KEYCODE_ESCAPE:
@@ -1671,72 +1675,6 @@
break;
}
- /*
- * switch (event.kbd.keycode) {
- * case '\n':
- * case '\r':
- * case 261: // Keypad 5
- * if (allowPlayerInput) {
- * mouseLeft = 1;
- * }
- * break;
- * case 27: // ESC
- * if (allowPlayerInput) {
- * mouseRight = 1;
- * }
- * break;
- * case 282: // F1
- * if (allowPlayerInput) {
- * playerCommand = 0; // EXAMINE
- * makeCommandLine();
- * }
- * break;
- * case 283: // F2
- * if (allowPlayerInput) {
- * playerCommand = 1; // TAKE
- * makeCommandLine();
- * }
- * break;
- * case 284: // F3
- * if (allowPlayerInput) {
- * playerCommand = 2; // INVENTORY
- * makeCommandLine();
- * }
- * break;
- * case 285: // F4
- * if (allowPlayerInput) {
- * playerCommand = 3; // USE
- * makeCommandLine();
- * }
- * break;
- * case 286: // F5
- * if (allowPlayerInput) {
- * playerCommand = 4; // ACTIVATE
- * makeCommandLine();
- * }
- * break;
- * case 287: // F6
- * if (allowPlayerInput) {
- * playerCommand = 5; // SPEAK
- * makeCommandLine();
- * }
- * break;
- * case 290: // F9
- * if (allowPlayerInput && !inMenu) {
- * makeActionMenu();
- * makeCommandLine();
- * }
- * break;
- * case 291: // F10
- * if (!disableSystemMenu && !inMenu) {
- * g_cine->makeSystemMenu();
- * }
- * break;
- * default:
- * //lastKeyStroke = event.kbd.keycode;
- * break;
- * }
- * break; */
if (event.kbd.flags == Common::KBD_CTRL) {
if (event.kbd.keycode == Common::KEYCODE_d) {
// Start the debugger
@@ -1753,17 +1691,10 @@
}
}
- /*if (count) {
- * mouseData.left = mouseLeft;
- * mouseData.right = mouseRight;
- * mouseLeft = 0;
- * mouseRight = 0;
- * }
- */
+ return result;
}
void getMouseStatus(int16 *pMouseVar, int16 *pMouseX, int16 *pMouseButton, int16 *pMouseY) {
- manageEvents();
*pMouseX = currentMouseX;
*pMouseY = currentMouseY;
*pMouseButton = currentMouseButton;
@@ -1806,11 +1737,15 @@
if (!bFastMode) {
// Delay for the specified amount of time, but still respond to events
+ bool skipEvents = false;
+
while (currentTick < lastTick + _gameSpeed) {
g_system->delayMillis(10);
currentTick = g_system->getMillis();
- manageEvents();
+ if (!skipEvents)
+ skipEvents = manageEvents();
+
if (playerDontAskQuit) break;
if (_vm->getDebugger()->isAttached())
Modified: scummvm/trunk/engines/cruise/menu.cpp
===================================================================
--- scummvm/trunk/engines/cruise/menu.cpp 2009-07-17 01:55:11 UTC (rev 42557)
+++ scummvm/trunk/engines/cruise/menu.cpp 2009-07-17 05:10:24 UTC (rev 42558)
@@ -146,7 +146,7 @@
}
}
-void manageEvents();
+bool manageEvents();
int processMenu(menuStruct *pMenu) {
int16 mouseX;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list