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

bluddy at users.sourceforge.net bluddy at users.sourceforge.net
Sun Jan 3 20:27:20 CET 2010


Revision: 46940
          http://scummvm.svn.sourceforge.net/scummvm/?rev=46940&view=rev
Author:   bluddy
Date:     2010-01-03 19:27:20 +0000 (Sun, 03 Jan 2010)

Log Message:
-----------
PSP: Limited movement of virtual keyboard onscreen

Modified Paths:
--------------
    scummvm/trunk/backends/platform/psp/pspkeyboard.cpp
    scummvm/trunk/backends/platform/psp/pspkeyboard.h

Modified: scummvm/trunk/backends/platform/psp/pspkeyboard.cpp
===================================================================
--- scummvm/trunk/backends/platform/psp/pspkeyboard.cpp	2010-01-03 18:43:17 UTC (rev 46939)
+++ scummvm/trunk/backends/platform/psp/pspkeyboard.cpp	2010-01-03 19:27:20 UTC (rev 46940)
@@ -38,6 +38,8 @@
 #include "common/fs.h"
 #include "common/unzip.h"
 
+#define PSP_SCREEN_WIDTH 480
+#define PSP_SCREEN_HEIGHT 272
 #define K(x)	((short)(Common::KEYCODE_INVALID + (x)))
 #define C(x)	((short)(Common::KEYCODE_##x))
 
@@ -180,13 +182,13 @@
 			_dirty = true;
 
 			if (DOWN(PSP_CTRL_DOWN))
-				_moved_y += 5;
+				increaseKeyboardLocationY(5);
 			else if (DOWN(PSP_CTRL_UP))
-				_moved_y -= 5;
+				increaseKeyboardLocationY(-5);
 			else if (DOWN(PSP_CTRL_LEFT))
-				_moved_x -= 5;
+				increaseKeyboardLocationX(-5);
 			else  /* DOWN(PSP_CTRL_RIGHT) */
-				_moved_x += 5;
+				increaseKeyboardLocationX(5);
 		}
 		usedInput = true;	// We used up the input (select was held down)
 		goto END;
@@ -376,6 +378,24 @@
 	_moved_y = newY;
 }
 
+/* move the position the keyboard is currently drawn at */
+void PSPKeyboard::increaseKeyboardLocationX(int amount) {
+	int newX = _moved_x + amount;
+	
+	if (newX > PSP_SCREEN_WIDTH - 5 || newX < 0 - 140)	// clamp
+		return;
+	_moved_x = newX;
+}
+
+/* move the position the keyboard is currently drawn at */
+void PSPKeyboard::increaseKeyboardLocationY(int amount) {
+	int newY = _moved_y + amount;
+	
+	if (newY > PSP_SCREEN_HEIGHT - 5 || newY < 0 - 140)	// clamp
+		return;
+	_moved_y = newY;
+}
+
 /* draw the keyboard at the current position */
 void PSPKeyboard::render() {
 	_dirty = false;

Modified: scummvm/trunk/backends/platform/psp/pspkeyboard.h
===================================================================
--- scummvm/trunk/backends/platform/psp/pspkeyboard.h	2010-01-03 18:43:17 UTC (rev 46939)
+++ scummvm/trunk/backends/platform/psp/pspkeyboard.h	2010-01-03 19:27:20 UTC (rev 46940)
@@ -83,6 +83,8 @@
 	int get_png_image_size(Common::SeekableReadStream *, uint32 *png_width, uint32 *png_height, u32 *paletteSize);
 	uint32 convert_pow2(uint32 size);
 	void flipNibbles(gu_surface* surface);		// Convert to PSP 4-bit format
+	void increaseKeyboardLocationX(int amount);		// Move keyboard onscreen
+	void increaseKeyboardLocationY(int amount);
 			
 	static short _modeChar[MODE_COUNT][5][6];
 	static const char *_guiStrings[];


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