diff options
author | Max Horn | 2007-03-18 18:27:52 +0000 |
---|---|---|
committer | Max Horn | 2007-03-18 18:27:52 +0000 |
commit | 888e68f433659a1c021d79f89534841e64676987 (patch) | |
tree | 9af7d4f573de71695bd010be83865f7aa18514ad /engines/kyra/gui.cpp | |
parent | 8ba2a5bb83c23a9633ae532a02ffdb60760a3cb9 (diff) | |
download | scummvm-rg350-888e68f433659a1c021d79f89534841e64676987.tar.gz scummvm-rg350-888e68f433659a1c021d79f89534841e64676987.tar.bz2 scummvm-rg350-888e68f433659a1c021d79f89534841e64676987.zip |
KYRA: Changed to use EventManager::getMousePos (should improve some things: the old code did not properly track the mouse upon click events, and KyraEngine::waitForEvent ignored _flags.useHiResOverlay)
svn-id: r26221
Diffstat (limited to 'engines/kyra/gui.cpp')
-rw-r--r-- | engines/kyra/gui.cpp | 27 |
1 files changed, 8 insertions, 19 deletions
diff --git a/engines/kyra/gui.cpp b/engines/kyra/gui.cpp index 3704617baa..4da2998131 100644 --- a/engines/kyra/gui.cpp +++ b/engines/kyra/gui.cpp @@ -316,7 +316,8 @@ void KyraEngine::processButtonList(Button *list) { } y += _screen->_screenDimTable[list->dimTableIndex].sy; - if (_mouseX >= x && _mouseY >= y && x + list->width >= _mouseX && y + list->height >= _mouseY) { + Common::Point mouse = getMousePos(); + if (mouse.x >= x && mouse.y >= y && x + list->width >= mouse.x && y + list->height >= mouse.y) { int processMouseClick = 0; if (list->flags & 0x400) { if (_mousePressFlag) { @@ -820,12 +821,6 @@ void KyraEngine::gui_getInput() { _mousePressFlag = false; break; case Common::EVENT_MOUSEMOVE: - _mouseX = event.mouse.x; - _mouseY = event.mouse.y; - if (_flags.useHiResOverlay) { - _mouseX >>= 1; - _mouseY >>= 1; - } _system->updateScreen(); lastScreenUpdate = now; break; @@ -1378,6 +1373,7 @@ int KyraEngine::gui_scrollDown(Button *button) { void KyraEngine::gui_processHighlights(Menu &menu) { int x1, y1, x2, y2; + Common::Point mouse = getMousePos(); for (int i = 0; i < menu.nrOfItems; i++) { if (!menu.item[i].enabled) continue; @@ -1388,8 +1384,8 @@ void KyraEngine::gui_processHighlights(Menu &menu) { x2 = x1 + menu.item[i].width; y2 = y1 + menu.item[i].height; - if (_mouseX > x1 && _mouseX < x2 && - _mouseY > y1 && _mouseY < y2) { + if (mouse.x > x1 && mouse.x < x2 && + mouse.y > y1 && mouse.y < y2) { if (menu.highlightedItem != i) { if (menu.item[menu.highlightedItem].enabled ) @@ -1481,14 +1477,6 @@ bool KyraEngine::gui_mainMenuGetInput() { case Common::EVENT_QUIT: quitGame(); break; - case Common::EVENT_MOUSEMOVE: - _mouseX = event.mouse.x; - _mouseY = event.mouse.y; - if (_flags.useHiResOverlay) { - _mouseX >>= 1; - _mouseY >>= 1; - } - break; case Common::EVENT_LBUTTONUP: return true; default: @@ -1541,8 +1529,9 @@ int KyraEngine::gui_handleMainMenu() { gui_updateMainMenuAnimation(); bool mousePressed = gui_mainMenuGetInput(); - if (menuRect.contains(mouseX(), mouseY())) { - int item = (mouseY() - menuRect.top) / fh; + Common::Point mouse = getMousePos(); + if (menuRect.contains(mouse)) { + int item = (mouse.y - menuRect.top) / fh; if (item != selected) { gui_printString(strings[selected], textPos, menuRect.top + selected * fh, 0x80, 0, 5); |