[Scummvm-cvs-logs] SF.net SVN: scummvm: [32905] scummvm/branches/gsoc2008-vkeybd

sk4425 at users.sourceforge.net sk4425 at users.sourceforge.net
Fri Jul 4 13:38:15 CEST 2008


Revision: 32905
          http://scummvm.svn.sourceforge.net/scummvm/?rev=32905&view=rev
Author:   sk4425
Date:     2008-07-04 04:38:15 -0700 (Fri, 04 Jul 2008)

Log Message:
-----------
- MILESTONE - VirtualKeyboardParser successfully parsing a simple test pack
- XMLParser - small improvements

Modified Paths:
--------------
    scummvm/branches/gsoc2008-vkeybd/base/main.cpp
    scummvm/branches/gsoc2008-vkeybd/common/xmlparser.h
    scummvm/branches/gsoc2008-vkeybd/gui/virtualKeyboard.cpp
    scummvm/branches/gsoc2008-vkeybd/gui/virtualKeyboard.h
    scummvm/branches/gsoc2008-vkeybd/gui/virtualKeyboardParser.cpp

Modified: scummvm/branches/gsoc2008-vkeybd/base/main.cpp
===================================================================
--- scummvm/branches/gsoc2008-vkeybd/base/main.cpp	2008-07-04 09:38:03 UTC (rev 32904)
+++ scummvm/branches/gsoc2008-vkeybd/base/main.cpp	2008-07-04 11:38:15 UTC (rev 32905)
@@ -52,7 +52,13 @@
 #include "gui/launcher.h"
 #endif
 
+#define ___VK_TEST
 
+#if defined(___VK_TEST)
+#include "gui/virtualKeyboard.h"
+#endif
+
+
 static bool launcherDialog(OSystem &system) {
 
 	system.beginGFXTransaction();
@@ -68,6 +74,13 @@
 	// Clear the main screen
 	system.clearScreen();
 
+#if defined(___VK_TEST)
+	GUI::VirtualKeyboard *vk = new GUI::VirtualKeyboard();
+	if (vk->loadKeyboardPack("test"))
+		printf("Successfully parsed test keyboard pack\n");
+
+#endif
+
 #if defined(_WIN32_WCE)
 	CELauncherDialog dlg;
 #elif defined(__DC__)

Modified: scummvm/branches/gsoc2008-vkeybd/common/xmlparser.h
===================================================================
--- scummvm/branches/gsoc2008-vkeybd/common/xmlparser.h	2008-07-04 09:38:03 UTC (rev 32904)
+++ scummvm/branches/gsoc2008-vkeybd/common/xmlparser.h	2008-07-04 11:38:15 UTC (rev 32905)
@@ -283,7 +283,7 @@
 		while (isValidNameChar(_text[_pos]))
 			_token += _text[_pos++];
 
-		return isspace(_text[_pos]) != 0 || _text[_pos] == '>';
+		return isspace(_text[_pos]) != 0 || _text[_pos] == '>' || _text[_pos] == '=';
 	}
 
 	/**

Modified: scummvm/branches/gsoc2008-vkeybd/gui/virtualKeyboard.cpp
===================================================================
--- scummvm/branches/gsoc2008-vkeybd/gui/virtualKeyboard.cpp	2008-07-04 09:38:03 UTC (rev 32904)
+++ scummvm/branches/gsoc2008-vkeybd/gui/virtualKeyboard.cpp	2008-07-04 11:38:15 UTC (rev 32905)
@@ -62,10 +62,10 @@
 			unzGetCurrentFileInfo(zipFile, &fileInfo, NULL, 0, NULL, 0, NULL, 0);
 			byte *buffer = new byte[fileInfo.uncompressed_size+1];
 			assert(buffer);
-			memset(buffer, 0, (fileInfo.uncompressed_size+1)*sizeof(uint8));
+			memset(buffer, 0, (fileInfo.uncompressed_size+1)*sizeof(byte));
 			unzReadCurrentFile(zipFile, buffer, fileInfo.uncompressed_size);
 			unzCloseCurrentFile(zipFile);
-			if (!_parser->loadBuffer(buffer, true)) {
+			if (!_parser->loadBuffer(buffer, fileInfo.uncompressed_size+1, true)) {
 				unzClose(zipFile);
 				return false;
 			}

Modified: scummvm/branches/gsoc2008-vkeybd/gui/virtualKeyboard.h
===================================================================
--- scummvm/branches/gsoc2008-vkeybd/gui/virtualKeyboard.h	2008-07-04 09:38:03 UTC (rev 32904)
+++ scummvm/branches/gsoc2008-vkeybd/gui/virtualKeyboard.h	2008-07-04 11:38:15 UTC (rev 32905)
@@ -31,7 +31,6 @@
 #include "common/hashmap.h"
 #include "common/hash-str.h"
 #include "common/imagemap.h"
-#include "common/singleton.h"
 #include "common/str.h"
 #include "graphics/surface.h"
 
@@ -41,7 +40,7 @@
 
 
 
-class VirtualKeyboard : public Common::Singleton<VirtualKeyboard> {
+class VirtualKeyboard {
 private:
 	/** Type of key event */
 	enum EventType {

Modified: scummvm/branches/gsoc2008-vkeybd/gui/virtualKeyboardParser.cpp
===================================================================
--- scummvm/branches/gsoc2008-vkeybd/gui/virtualKeyboardParser.cpp	2008-07-04 09:38:03 UTC (rev 32904)
+++ scummvm/branches/gsoc2008-vkeybd/gui/virtualKeyboardParser.cpp	2008-07-04 11:38:15 UTC (rev 32905)
@@ -90,13 +90,13 @@
 	Common::StringTokenizer tok(resolutions, " ,");
 
 	uint16 scrX = g_system->getOverlayWidth(), scrY = g_system->getOverlayHeight();
-	uint16 diff = 0xFFFF;
+	uint32 diff = 0xFFFFFFFF;
 
 	for (Common::String res = tok.nextToken(); res.size() > 0; res = tok.nextToken()) {
-		uint16 resX, resY;
-		if (sscanf(res.c_str(), "%dx%d", &resX, &resY) != 2)
+		int resX, resY;
+		if (sscanf(res.c_str(), "%dx%d", &resX, &resY) != 2) {
 			parserError("Invalid resolution specification");
-		else {
+		} else {
 			if (resX == scrX && resY == scrY) {
 				_currentMode->resolution = res;
 				break;
@@ -232,7 +232,7 @@
 
 	Common::String shape = areaNode->values["shape"];
 	if (shape == "rect") {
-		int16 x1, y1, x2, y2;
+		int x1, y1, x2, y2;
 		if (!parseIntegerKey(areaNode->values["coords"].c_str(), 4, &x1, &y1, &x2, &y2))
 			return parserError("Invalid coords for rect area");
 
@@ -242,7 +242,7 @@
 		Common::StringTokenizer tok (areaNode->values["coords"], ", ");
 		Common::Polygon poly;
 		for (Common::String st = tok.nextToken(); !st.empty(); st = tok.nextToken()) {
-			int16 x, y;
+			int x, y;
 			if (sscanf(st.c_str(), "%d", &x) != 1)
 				return parserError("Invalid coords for polygon area");
 			st = tok.nextToken();


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