From db8e5332fc4109898f44b01dd7d4faa362debbe2 Mon Sep 17 00:00:00 2001 From: Torbjörn Andersson Date: Thu, 21 Jun 2007 19:33:05 +0000 Subject: Use the KEYCODE constants. svn-id: r27593 --- engines/sword2/controls.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'engines/sword2/controls.cpp') diff --git a/engines/sword2/controls.cpp b/engines/sword2/controls.cpp index 277ea108d9..eeb2cda2d9 100644 --- a/engines/sword2/controls.cpp +++ b/engines/sword2/controls.cpp @@ -26,6 +26,7 @@ */ #include "common/stdafx.h" +#include "common/events.h" #include "common/rect.h" #include "common/config-manager.h" #include "common/system.h" @@ -317,9 +318,9 @@ int Dialog::runModal() { KeyboardEvent *ke = _vm->keyboardEvent(); if (ke) { - if (ke->keycode == 27) + if (ke->keycode == Common::KEYCODE_ESCAPE) setResult(0); - else if (ke->keycode == '\n' || ke->keycode == '\r') + else if (ke->keycode == Common::KEYCODE_RETURN || ke->keycode == Common::KEYCODE_KP_ENTER) setResult(1); } @@ -1130,8 +1131,8 @@ public: virtual void onKey(KeyboardEvent *ke) { if (_editable) { - if (ke->keycode == 8) - _parent->onAction(this, 8); + if (ke->keycode == Common::KEYCODE_BACKSPACE) + _parent->onAction(this, Common::KEYCODE_BACKSPACE); else if (ke->ascii >= ' ' && ke->ascii <= 255) { // Accept the character if the font renderer // has what looks like a valid glyph for it. @@ -1354,7 +1355,7 @@ void SaveRestoreDialog::onAction(Widget *widget, int result) { drawEditBuffer(slot); } break; - case 8: + case Common::KEYCODE_BACKSPACE: if (_editPos > _firstPos) { _editBuffer[_editPos - 1] = _editBuffer[_editPos]; _editBuffer[_editPos--] = 0; -- cgit v1.2.3 From a041ef23174a21eb42285e8c518f38b81468b13d Mon Sep 17 00:00:00 2001 From: Max Horn Date: Fri, 22 Jun 2007 23:03:12 +0000 Subject: Slightly updated key handling in BS2, Kyra, and Touche svn-id: r27637 --- engines/sword2/controls.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'engines/sword2/controls.cpp') diff --git a/engines/sword2/controls.cpp b/engines/sword2/controls.cpp index eeb2cda2d9..84580c7520 100644 --- a/engines/sword2/controls.cpp +++ b/engines/sword2/controls.cpp @@ -318,9 +318,9 @@ int Dialog::runModal() { KeyboardEvent *ke = _vm->keyboardEvent(); if (ke) { - if (ke->keycode == Common::KEYCODE_ESCAPE) + if (ke->kbd.keycode == Common::KEYCODE_ESCAPE) setResult(0); - else if (ke->keycode == Common::KEYCODE_RETURN || ke->keycode == Common::KEYCODE_KP_ENTER) + else if (ke->kbd.keycode == Common::KEYCODE_RETURN || ke->kbd.keycode == Common::KEYCODE_KP_ENTER) setResult(1); } @@ -1131,13 +1131,13 @@ public: virtual void onKey(KeyboardEvent *ke) { if (_editable) { - if (ke->keycode == Common::KEYCODE_BACKSPACE) + if (ke->kbd.keycode == Common::KEYCODE_BACKSPACE) _parent->onAction(this, Common::KEYCODE_BACKSPACE); - else if (ke->ascii >= ' ' && ke->ascii <= 255) { + else if (ke->kbd.ascii >= ' ' && ke->kbd.ascii <= 255) { // Accept the character if the font renderer // has what looks like a valid glyph for it. - if (_fr->getCharWidth(ke->ascii)) - _parent->onAction(this, ke->ascii); + if (_fr->getCharWidth(ke->kbd.ascii)) + _parent->onAction(this, ke->kbd.ascii); } } } -- cgit v1.2.3