[Scummvm-cvs-logs] SF.net SVN: scummvm: [25879] scummvm/trunk/backends/platform/wince

knakos at users.sourceforge.net knakos at users.sourceforge.net
Mon Feb 26 18:48:05 CET 2007


Revision: 25879
          http://scummvm.svn.sourceforge.net/scummvm/?rev=25879&view=rev
Author:   knakos
Date:     2007-02-26 09:48:04 -0800 (Mon, 26 Feb 2007)

Log Message:
-----------
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).

Modified Paths:
--------------
    scummvm/trunk/backends/platform/wince/CEgui/PanelKeyboard.cpp
    scummvm/trunk/backends/platform/wince/images/keyboard.bmp

Modified: scummvm/trunk/backends/platform/wince/CEgui/PanelKeyboard.cpp
===================================================================
--- scummvm/trunk/backends/platform/wince/CEgui/PanelKeyboard.cpp	2007-02-26 12:07:20 UTC (rev 25878)
+++ scummvm/trunk/backends/platform/wince/CEgui/PanelKeyboard.cpp	2007-02-26 17:48:04 UTC (rev 25879)
@@ -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 @@
 	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;
+				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;
+				}
 			}
-			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;
-			}
 
 			if (keyAscii != 0) {
 				_key.setAscii(keyAscii);
-				_key.setKeycode(tolower(keyAscii));
+				_key.setKeycode(tolower(keyCode));
 				return EventsBuffer::simulateKey(&_key, pushed);
 			}
 			else

Modified: scummvm/trunk/backends/platform/wince/images/keyboard.bmp
===================================================================
(Binary files differ)


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list