aboutsummaryrefslogtreecommitdiff
path: root/backends/platform/psp/pspkeyboard.cpp
diff options
context:
space:
mode:
authorYotam Barnoy2010-01-03 19:27:20 +0000
committerYotam Barnoy2010-01-03 19:27:20 +0000
commit910ffb53a0b6c74a965df9a1270cdfc3885252ec (patch)
treeb30eda5fc5d3bebda22447f332a480c446673916 /backends/platform/psp/pspkeyboard.cpp
parent870c99b4d437d997e9f4fb3b2a8d760c6409a05b (diff)
downloadscummvm-rg350-910ffb53a0b6c74a965df9a1270cdfc3885252ec.tar.gz
scummvm-rg350-910ffb53a0b6c74a965df9a1270cdfc3885252ec.tar.bz2
scummvm-rg350-910ffb53a0b6c74a965df9a1270cdfc3885252ec.zip
PSP: Limited movement of virtual keyboard onscreen
svn-id: r46940
Diffstat (limited to 'backends/platform/psp/pspkeyboard.cpp')
-rw-r--r--backends/platform/psp/pspkeyboard.cpp28
1 files changed, 24 insertions, 4 deletions
diff --git a/backends/platform/psp/pspkeyboard.cpp b/backends/platform/psp/pspkeyboard.cpp
index b6f85429ec..0ad5b73cac 100644
--- a/backends/platform/psp/pspkeyboard.cpp
+++ b/backends/platform/psp/pspkeyboard.cpp
@@ -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 @@ bool PSPKeyboard::processInput(Common::Event &event, SceCtrlData &pad, bool &use
_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 @@ void PSPKeyboard::moveTo(const int newX, const int newY) {
_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;