diff options
author | Torbjörn Andersson | 2004-05-09 13:32:04 +0000 |
---|---|---|
committer | Torbjörn Andersson | 2004-05-09 13:32:04 +0000 |
commit | fc970b3c75fd64f399a4c22222d7e295825184c9 (patch) | |
tree | 92998da511ba26705bbdc7cbe161e32bb9e031b6 /sword2/controls.cpp | |
parent | 577600537c2e3cfdacb4e53ccfdab7e06b55a0ed (diff) | |
download | scummvm-rg350-fc970b3c75fd64f399a4c22222d7e295825184c9.tar.gz scummvm-rg350-fc970b3c75fd64f399a4c22222d7e295825184c9.tar.bz2 scummvm-rg350-fc970b3c75fd64f399a4c22222d7e295825184c9.zip |
Removed the buffering of mouse and keyboard events. I don't think any of
our other engines do this, so there is little reason for BS2 to. I did add
a filtering mechanism so that mouse button releases and scroll wheeling is
ignored during normal gameplay, but I don't know if that was necessary
either.
Since this left little more than an empty husk where the Input class used
to be, I've eliminated that class and buried its remains in Sword2Engine.
svn-id: r13812
Diffstat (limited to 'sword2/controls.cpp')
-rw-r--r-- | sword2/controls.cpp | 36 |
1 files changed, 16 insertions, 20 deletions
diff --git a/sword2/controls.cpp b/sword2/controls.cpp index 69cc36103a..dfd0c448be 100644 --- a/sword2/controls.cpp +++ b/sword2/controls.cpp @@ -304,6 +304,8 @@ void Dialog::setResult(int result) { } int Dialog::run() { + uint32 oldFilter = _gui->_vm->setEventFilter(0); + int i; paint(); @@ -316,17 +318,16 @@ int Dialog::run() { _gui->_vm->_graphics->processMenu(); _gui->_vm->_graphics->updateDisplay(false); - int16 newMouseX = _gui->_vm->_input->_mouseX; - int16 newMouseY = _gui->_vm->_input->_mouseY + 40; + int16 newMouseX = _gui->_vm->_mouseX; + int16 newMouseY = _gui->_vm->_mouseY + 40; - MouseEvent *me = _gui->_vm->_input->mouseEvent(); - KeyboardEvent ke; - int32 keyboardStatus = _gui->_vm->_input->readKey(&ke); + MouseEvent *me = _gui->_vm->mouseEvent(); + KeyboardEvent *ke = _gui->_vm->keyboardEvent(); - if (keyboardStatus == RD_OK) { - if (ke.keycode == 27) + if (ke) { + if (ke->keycode == 27) setResult(0); - else if (ke.keycode == '\n' || ke.keycode == '\r') + else if (ke->keycode == '\n' || ke->keycode == '\r') setResult(1); } @@ -391,8 +392,8 @@ int Dialog::run() { if (newMouseX != oldMouseX || newMouseY != oldMouseY) _widgets[i]->onMouseMove(newMouseX, newMouseY); - if (keyboardStatus == RD_OK) - _widgets[i]->onKey(&ke); + if (ke) + _widgets[i]->onKey(ke); _widgets[i]->onTick(); } @@ -406,6 +407,7 @@ int Dialog::run() { setResult(0); } + _gui->_vm->setEventFilter(oldFilter); return _result; } @@ -1480,19 +1482,13 @@ void SaveLoadDialog::saveLoadError(byte* text) { // Wait for ESC or mouse click while (1) { - MouseEvent *me; - _gui->_vm->_graphics->updateDisplay(); - if (_gui->_vm->_input->keyWaiting()) { - KeyboardEvent ke; - - _gui->_vm->_input->readKey(&ke); - if (ke.keycode == 27) - break; - } + KeyboardEvent *ke = _gui->_vm->keyboardEvent(); + if (ke && ke->keycode == 27) + break; - me = _gui->_vm->_input->mouseEvent(); + MouseEvent *me = _gui->_vm->mouseEvent(); if (me && (me->buttons & RD_LEFTBUTTONDOWN)) break; |