mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-15 14:18:37 +00:00
AVALANCHE: Simplify continueHelp(), move keyboard control to it's own function.
This commit is contained in:
parent
3d528b512f
commit
c57e98ce8d
@ -144,37 +144,38 @@ byte Help::checkMouse() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool Help::handleKeyboard(const Common::Event &event) {
|
||||
if (event.kbd.keycode == Common::KEYCODE_ESCAPE)
|
||||
return true;
|
||||
|
||||
for (int i = 0; i < _buttonNum; i++) {
|
||||
char upperCase = toupper(event.kbd.ascii);
|
||||
if (((Common::KEYCODE_a <= event.kbd.keycode) && (event.kbd.keycode <= Common::KEYCODE_z) && (_buttons[i]._trigger == upperCase)) ||
|
||||
((event.kbd.keycode == Common::KEYCODE_PAGEUP) && (_buttons[i]._trigger == 214)) ||
|
||||
((event.kbd.keycode == Common::KEYCODE_PAGEDOWN) && (_buttons[i]._trigger == 216))) { // We had to handle the pageups/pagedowns separately.
|
||||
_vm->fadeOut();
|
||||
switchPage(_buttons[i]._whither);
|
||||
_vm->fadeIn();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void Help::continueHelp() {
|
||||
warning("STUB: Help::continueHelp()");
|
||||
|
||||
do {
|
||||
Common::Event event;
|
||||
bool escape = false;
|
||||
while (!_vm->shouldQuit() && !escape) {
|
||||
_vm->_graphics->refreshScreen();
|
||||
while (_vm->getEvent(event)) {
|
||||
if (event.type == Common::EVENT_KEYDOWN) {
|
||||
escape = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (event.kbd.keycode == Common::KEYCODE_ESCAPE)
|
||||
break;
|
||||
|
||||
for (int i = 0; i < _buttonNum; i++) {
|
||||
char upperCase = toupper(event.kbd.ascii);
|
||||
if (((Common::KEYCODE_a <= event.kbd.keycode) && (event.kbd.keycode <= Common::KEYCODE_z) && (_buttons[i]._trigger == upperCase)) ||
|
||||
((event.kbd.keycode == Common::KEYCODE_PAGEUP) && (_buttons[i]._trigger == 214)) ||
|
||||
((event.kbd.keycode == Common::KEYCODE_PAGEDOWN) && (_buttons[i]._trigger == 216))) { // We had to handle the pageups/pagedowns separately.
|
||||
_vm->fadeOut();
|
||||
switchPage(_buttons[i]._whither);
|
||||
_vm->fadeIn();
|
||||
break;
|
||||
}
|
||||
}
|
||||
} while (true);
|
||||
bool close = false;
|
||||
Common::Event event;
|
||||
while (!_vm->shouldQuit() && !close) {
|
||||
_vm->_graphics->refreshScreen();
|
||||
_vm->getEvent(event);
|
||||
if (event.type == Common::EVENT_KEYDOWN) {
|
||||
close = handleKeyboard(event);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -53,6 +53,7 @@ private:
|
||||
void switchPage(byte which);
|
||||
Common::String getLine(Common::File &file); // It was a nested function in getMe().
|
||||
byte checkMouse(); // Returns clicked-on button, or 0 if none.
|
||||
bool handleKeyboard(const Common::Event &event);
|
||||
void continueHelp();
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user