aboutsummaryrefslogtreecommitdiff
path: root/backends
diff options
context:
space:
mode:
authorKostas Nakos2007-02-26 17:48:04 +0000
committerKostas Nakos2007-02-26 17:48:04 +0000
commit9f9b7d96a7770c127c88fc50770797c188bfcf0c (patch)
treed2ad8a56b548235fd1eeac5b4d1483f40c858fb5 /backends
parent48a401d9ddccff4f93f74a08663b51fdc29d1ef3 (diff)
downloadscummvm-rg350-9f9b7d96a7770c127c88fc50770797c188bfcf0c.tar.gz
scummvm-rg350-9f9b7d96a7770c127c88fc50770797c188bfcf0c.tar.bz2
scummvm-rg350-9f9b7d96a7770c127c88fc50770797c188bfcf0c.zip
added gfx and code to support spacebar and escape keys in the virtual keyboard (remember, Jubanka couldn't draw if his life depended on it :-) ).
fixed (essentially added) support for the directional keys of the virtual keyboard (no idea why these were not implemented). svn-id: r25879
Diffstat (limited to 'backends')
-rw-r--r--backends/platform/wince/CEgui/PanelKeyboard.cpp54
-rw-r--r--backends/platform/wince/images/keyboard.bmpbin38454 -> 38454 bytes
2 files changed, 22 insertions, 32 deletions
diff --git a/backends/platform/wince/CEgui/PanelKeyboard.cpp b/backends/platform/wince/CEgui/PanelKeyboard.cpp
index b554fb3b71..ca7074a7fe 100644
--- a/backends/platform/wince/CEgui/PanelKeyboard.cpp
+++ b/backends/platform/wince/CEgui/PanelKeyboard.cpp
@@ -25,10 +25,10 @@
namespace CEGUI {
- const char KEYBOARD_MAPPING_ALPHA_HIGH[] = {"abcdefghijklm"};
- const char KEYBOARD_MAPPING_NUMERIC_HIGH[] = {"12345"};
- const char KEYBOARD_MAPPING_ALPHA_LOW[] = {"nopqrstuvwxyz"};
- const char KEYBOARD_MAPPING_NUMERIC_LOW[] = {"67890"};
+ const char KEYBOARD_MAPPING_ALPHA[][14] = { {"abcdefghijklm"}, {"nopqrstuvwxyz"} };
+ const char KEYBOARD_MAPPING_NUMERIC[][6] = { {"12345"}, {"67890"} };
+ const int KEYBOARD_MAPPING_SPECIAL[][3][2] = { { {1,SDLK_ESCAPE}, {224,SDLK_UP}, {32,SDLK_SPACE} },
+ { {224,SDLK_LEFT}, {224,SDLK_DOWN}, {224,SDLK_RIGHT} } };
PanelKeyboard::PanelKeyboard(WORD reference) : Toolbar() {
setBackground(reference);
@@ -41,41 +41,31 @@ namespace CEGUI {
bool PanelKeyboard::action(int x, int y, bool pushed) {
if (checkInside(x, y)) {
- char keyAscii = 0;
- char keyCode = 0;
+ int keyAscii = 0;
+ int keyCode = 0;
if (x < 185) {
// Alpha selection
- if (y <= _y + 20)
- keyAscii = KEYBOARD_MAPPING_ALPHA_HIGH[((x + 10) / 14) - 1];
- else
- keyAscii = KEYBOARD_MAPPING_ALPHA_LOW[((x + 10) / 14) - 1];
- keyCode = tolower(keyAscii);
- }
- else
- if (x >= 186 && x <= 255) {
+ keyCode = keyAscii = KEYBOARD_MAPPING_ALPHA[y >= _y+20][((x + 10) / 14) - 1];
+ } else if (x >= 186 && x <= 255) {
// Numeric selection
- if (y <= _y + 20)
- keyAscii = KEYBOARD_MAPPING_NUMERIC_HIGH[((x - 187 + 10) / 14) - 1];
- else
- keyAscii = KEYBOARD_MAPPING_NUMERIC_LOW[((x - 187 + 10) / 14) - 1];
- keyCode = keyAscii;
- }
- else
- if (x >= 302 && x <= 316 && y < _y + 20) {
- // Backspace
- keyAscii = VK_BACK;
- keyCode = keyAscii;
- }
- else
- if (x >= 302 && x <= 316 && y >= _y + 20) {
- // Enter
- keyAscii = 13;
- keyCode = 10;
+ keyCode = keyAscii = KEYBOARD_MAPPING_NUMERIC[y >= _y+20][((x - 187 + 10) / 14) - 1];
+ } else if (x >= 258 && x <= 300) {
+ // Special keys
+ keyAscii = KEYBOARD_MAPPING_SPECIAL[y >= _y+20][((x - 259 + 10) / 14) - 1][0];
+ keyCode = KEYBOARD_MAPPING_SPECIAL[y >= _y+20][((x - 259 + 10) / 14) - 1][1];
+ } else if (x >= 302 && x <= 316) {
+ if (y < _y +20) {
+ // Backspace
+ keyAscii = VK_BACK; keyCode = keyAscii;
+ } else {
+ // Enter
+ keyAscii = 13; keyCode = 10;
+ }
}
if (keyAscii != 0) {
_key.setAscii(keyAscii);
- _key.setKeycode(tolower(keyAscii));
+ _key.setKeycode(tolower(keyCode));
return EventsBuffer::simulateKey(&_key, pushed);
}
else
diff --git a/backends/platform/wince/images/keyboard.bmp b/backends/platform/wince/images/keyboard.bmp
index aac79d00e5..14217e1eac 100644
--- a/backends/platform/wince/images/keyboard.bmp
+++ b/backends/platform/wince/images/keyboard.bmp
Binary files differ