diff options
author | Torbjörn Andersson | 2006-03-15 13:32:35 +0000 |
---|---|---|
committer | Torbjörn Andersson | 2006-03-15 13:32:35 +0000 |
commit | 286434c88d83a45b8031ed534f1d3b418c1ac68f (patch) | |
tree | 775ddde2ba187ae8769a1c9386a927185ab19a0d | |
parent | c473ded02284334e57ebe5c32f37e7fb644a7841 (diff) | |
download | scummvm-rg350-286434c88d83a45b8031ed534f1d3b418c1ac68f.tar.gz scummvm-rg350-286434c88d83a45b8031ed534f1d3b418c1ac68f.tar.bz2 scummvm-rg350-286434c88d83a45b8031ed534f1d3b418c1ac68f.zip |
Added mouse wheel scrolling to save/restore dialogs.
svn-id: r21314
-rw-r--r-- | engines/kyra/gui.cpp | 18 | ||||
-rw-r--r-- | engines/kyra/kyra.h | 5 |
2 files changed, 21 insertions, 2 deletions
diff --git a/engines/kyra/gui.cpp b/engines/kyra/gui.cpp index dd57c26621..2cc7c80d8e 100644 --- a/engines/kyra/gui.cpp +++ b/engines/kyra/gui.cpp @@ -220,6 +220,12 @@ int KyraEngine::buttonAmuletCallback(Button *caller) { } void KyraEngine::processButtonList(Button *list) { + if (_haveScrollButtons) { + if (_mouseWheel < 0) + gui_scrollUp(&_scrollUpButton); + else if (_mouseWheel > 0) + gui_scrollDown(&_scrollDownButton); + } while (list) { if (list->flags & 8) { list = list->nextButton; @@ -524,6 +530,8 @@ void KyraEngine::initMenu(Menu menu) { } if (menu.scrollUpBtnX != -1) { + _haveScrollButtons = true; + _scrollUpButton.x = menu.scrollUpBtnX + menu.x; _scrollUpButton.y = menu.scrollUpBtnY + menu.y; _scrollUpButton.buttonCallback = &KyraEngine::gui_scrollUp; @@ -537,7 +545,8 @@ void KyraEngine::initMenu(Menu menu) { _scrollDownButton.nextButton = 0; _menuButtonList = initButton(_menuButtonList, &_scrollDownButton); processMenuButton(&_scrollDownButton); - } + } else + _haveScrollButtons = false; _screen->showMouse(); _screen->updateScreen(); @@ -561,6 +570,7 @@ void KyraEngine::gui_getInput() { uint32 now = _system->getMillis(); _mousePressFlag = false; + _mouseWheel = 0; while (_system->pollEvent(event)) { switch (event.type) { case OSystem::EVENT_QUIT: @@ -574,6 +584,12 @@ void KyraEngine::gui_getInput() { _mouseY = event.mouse.y; _system->updateScreen(); break; + case OSystem::EVENT_WHEELUP: + _mouseWheel = -1; + break; + case OSystem::EVENT_WHEELDOWN: + _mouseWheel = 1; + break; case OSystem::EVENT_KEYDOWN: _keyboardEvent.pending = true; _keyboardEvent.repeat = now + 400; diff --git a/engines/kyra/kyra.h b/engines/kyra/kyra.h index 8a6cb33014..ab72ea3bcd 100644 --- a/engines/kyra/kyra.h +++ b/engines/kyra/kyra.h @@ -163,7 +163,7 @@ struct Button { uint8 process2; // uint8 unk uint16 flags; - typedef int (KyraEngine::*ButtonCallback)(Button*); + typedef int (KyraEngine::*ButtonCallback)(Button*); // using 6 pointers instead of 3 as in the orignal here (safer for use with classes) uint8 *process0PtrShape; uint8 *process1PtrShape; @@ -698,6 +698,7 @@ protected: bool _abortWalkFlag; bool _abortWalkFlag2; bool _mousePressFlag; + int8 _mouseWheel; uint8 _flagsTable[53]; uint8 *_shapes[377]; uint16 _gameSpeed; @@ -967,6 +968,8 @@ protected: static Button _scrollUpButton; static Button _scrollDownButton; + bool _haveScrollButtons; + static Menu _menu[]; static const uint8 _magicMouseItemStartFrame[]; |