aboutsummaryrefslogtreecommitdiff
path: root/backends
diff options
context:
space:
mode:
authorJohn Willis2010-09-07 19:02:07 +0000
committerJohn Willis2010-09-07 19:02:07 +0000
commit56b09b605dcae91a1d5e12c0c377d6b10985556e (patch)
tree7f02f9c9d4601ba761386be694887f7e54338e8d /backends
parent87a6b631bf77a82c967d5ae68d888535c556a9cf (diff)
downloadscummvm-rg350-56b09b605dcae91a1d5e12c0c377d6b10985556e.tar.gz
scummvm-rg350-56b09b605dcae91a1d5e12c0c377d6b10985556e.tar.bz2
scummvm-rg350-56b09b605dcae91a1d5e12c0c377d6b10985556e.zip
GP2XWIZ: Clean up input code.
* Clean up the if/switch mess. * Also add missing Caanoo icon. svn-id: r52629
Diffstat (limited to 'backends')
-rw-r--r--backends/platform/gp2xwiz/build/scummvm.ini1
-rw-r--r--backends/platform/gp2xwiz/build/scummvmb.pngbin0 -> 34274 bytes
-rwxr-xr-xbackends/platform/gp2xwiz/caanoo/caanoo-bundle.mk2
-rwxr-xr-xbackends/platform/gp2xwiz/gp2xwiz-bundle.mk2
-rw-r--r--backends/platform/gp2xwiz/gp2xwiz-events.cpp354
5 files changed, 187 insertions, 172 deletions
diff --git a/backends/platform/gp2xwiz/build/scummvm.ini b/backends/platform/gp2xwiz/build/scummvm.ini
index 5a8e6eefa1..c9cce92379 100644
--- a/backends/platform/gp2xwiz/build/scummvm.ini
+++ b/backends/platform/gp2xwiz/build/scummvm.ini
@@ -2,3 +2,4 @@
name="ScummVM"
path="/scummvm/scummvm.gpe"
icon="/scummvm/scummvm.png"
+title="/scummvm/scummvmb.png"
diff --git a/backends/platform/gp2xwiz/build/scummvmb.png b/backends/platform/gp2xwiz/build/scummvmb.png
new file mode 100644
index 0000000000..24a27bc0e1
--- /dev/null
+++ b/backends/platform/gp2xwiz/build/scummvmb.png
Binary files differ
diff --git a/backends/platform/gp2xwiz/caanoo/caanoo-bundle.mk b/backends/platform/gp2xwiz/caanoo/caanoo-bundle.mk
index f8ac26382d..d02ed5fe16 100755
--- a/backends/platform/gp2xwiz/caanoo/caanoo-bundle.mk
+++ b/backends/platform/gp2xwiz/caanoo/caanoo-bundle.mk
@@ -16,6 +16,7 @@ caanoo-bundle: $(EXECUTABLE)
$(CP) $(srcdir)/backends/platform/gp2xwiz/caanoo/scummvm.gpe $(bundle_name)/scummvm/
$(CP) $(srcdir)/backends/platform/gp2xwiz/build/scummvm.png $(bundle_name)/scummvm/
+ $(CP) $(srcdir)/backends/platform/gp2xwiz/build/scummvmb.png $(bundle_name)/scummvm/
$(CP) $(srcdir)/backends/platform/gp2xwiz/build/README-GP2XWIZ $(bundle_name)/scummvm/README-CAANOO
$(CP) $(srcdir)/backends/platform/gp2xwiz/build/scummvm.ini $(bundle_name)/
@@ -46,6 +47,7 @@ caanoo-bundle-debug: $(EXECUTABLE)
$(CP) $(srcdir)/backends/platform/gp2xwiz/caanoo/scummvm-gdb.gpe $(bundle_name)/scummvm/scummvm.gpe
$(CP) $(srcdir)/backends/platform/gp2xwiz/build/scummvm.png $(bundle_name)/scummvm/
+ $(CP) $(srcdir)/backends/platform/gp2xwiz/build/scummvmb.png $(bundle_name)/scummvm/
$(CP) $(srcdir)/backends/platform/gp2xwiz/build/README-GP2XWIZ $(bundle_name)/scummvm/README-CAANOO
$(CP) $(srcdir)/backends/platform/gp2xwiz/build/scummvm.ini $(bundle_name)/
diff --git a/backends/platform/gp2xwiz/gp2xwiz-bundle.mk b/backends/platform/gp2xwiz/gp2xwiz-bundle.mk
index fa5a247865..c572b86939 100755
--- a/backends/platform/gp2xwiz/gp2xwiz-bundle.mk
+++ b/backends/platform/gp2xwiz/gp2xwiz-bundle.mk
@@ -16,6 +16,7 @@ gp2xwiz-bundle: $(EXECUTABLE)
$(CP) $(srcdir)/backends/platform/gp2xwiz/build/scummvm.gpe $(bundle_name)/scummvm/
$(CP) $(srcdir)/backends/platform/gp2xwiz/build/scummvm.png $(bundle_name)/scummvm/
+ $(CP) $(srcdir)/backends/platform/gp2xwiz/build/scummvmb.png $(bundle_name)/scummvm/
$(CP) $(srcdir)/backends/platform/gp2xwiz/build/README-GP2XWIZ $(bundle_name)/scummvm/
$(CP) $(srcdir)/backends/platform/gp2xwiz/build/scummvm.ini $(bundle_name)/
@@ -49,6 +50,7 @@ gp2xwiz-bundle-debug: $(EXECUTABLE)
$(CP) $(srcdir)/backends/platform/gp2xwiz/build/scummvm-gdb.gpe $(bundle_name)/scummvm/scummvm.gpe
$(CP) $(srcdir)/backends/platform/gp2xwiz/build/scummvm.png $(bundle_name)/scummvm/
+ $(CP) $(srcdir)/backends/platform/gp2xwiz/build/scummvmb.png $(bundle_name)/scummvm/
$(CP) $(srcdir)/backends/platform/gp2xwiz/build/README-GP2XWIZ $(bundle_name)/scummvm/
$(CP) $(srcdir)/backends/platform/gp2xwiz/build/scummvm.ini $(bundle_name)/
diff --git a/backends/platform/gp2xwiz/gp2xwiz-events.cpp b/backends/platform/gp2xwiz/gp2xwiz-events.cpp
index 1f603b4a3d..84c3006d6e 100644
--- a/backends/platform/gp2xwiz/gp2xwiz-events.cpp
+++ b/backends/platform/gp2xwiz/gp2xwiz-events.cpp
@@ -272,191 +272,201 @@ bool OSystem_GPH::handleMouseButtonUp(SDL_Event &ev, Common::Event &event) {
/* Custom handleJoyButtonDown/handleJoyButtonUp to deal with the joystick buttons on GPH devices */
bool OSystem_GPH::handleJoyButtonDown(SDL_Event &ev, Common::Event &event) {
- _stickBtn[ev.jbutton.button] = 1;
- if (ev.jbutton.button == BUTTON_B) {
- event.type = Common::EVENT_LBUTTONDOWN;
- fillMouseEvent(event, _km.x, _km.y);
- } else if (ev.jbutton.button == BUTTON_CLICK) {
- event.type = Common::EVENT_LBUTTONDOWN;
- fillMouseEvent(event, _km.x, _km.y);
- } else if (ev.jbutton.button == BUTTON_X) {
- event.type = Common::EVENT_RBUTTONDOWN;
- fillMouseEvent(event, _km.x, _km.y);
- } else if (_stickBtn[BUTTON_L] && (ev.jbutton.button == BUTTON_SELECT)) {
- event.type = Common::EVENT_QUIT;
-#if !defined (CAANOO)
- } else if (ev.jbutton.button < 8) {
- moveStick();
- event.type = Common::EVENT_MOUSEMOVE;
- fillMouseEvent(event, _km.x, _km.y);
-#endif
- } else {
- event.type = Common::EVENT_KEYDOWN;
- event.kbd.flags = 0;
- switch (ev.jbutton.button) {
- case BUTTON_L:
- BUTTON_STATE_L = true;
- break;
- case BUTTON_R:
- if (BUTTON_STATE_L == true) {
+ switch (ev.jbutton.button) {
+ case BUTTON_UP:
+ case BUTTON_UPLEFT:
+ case BUTTON_LEFT:
+ case BUTTON_DOWNLEFT:
+ case BUTTON_DOWN:
+ case BUTTON_DOWNRIGHT:
+ case BUTTON_RIGHT:
+ case BUTTON_UPRIGHT:
+ moveStick();
+ event.type = Common::EVENT_MOUSEMOVE;
+ fillMouseEvent(event, _km.x, _km.y);
+ break;
+ case BUTTON_B:
+ case BUTTON_CLICK:
+ event.type = Common::EVENT_LBUTTONDOWN;
+ fillMouseEvent(event, _km.x, _km.y);
+ break;
+ case BUTTON_X:
+ event.type = Common::EVENT_RBUTTONDOWN;
+ fillMouseEvent(event, _km.x, _km.y);
+ break;
+ case BUTTON_L:
+ BUTTON_STATE_L = true;
+ break;
+ case BUTTON_R:
+ event.type = Common::EVENT_KEYDOWN;
+ if (BUTTON_STATE_L == true) {
#ifdef ENABLE_VKEYBD
- event.kbd.keycode = Common::KEYCODE_F7;
- event.kbd.ascii = mapKey(SDLK_F7, ev.key.keysym.mod, 0);
+ event.kbd.keycode = Common::KEYCODE_F7;
+ event.kbd.ascii = mapKey(SDLK_F7, ev.key.keysym.mod, 0);
#else
- event.kbd.keycode = Common::KEYCODE_0;
- event.kbd.ascii = mapKey(SDLK_0, ev.key.keysym.mod, 0);
+ event.kbd.keycode = Common::KEYCODE_0;
+ event.kbd.ascii = mapKey(SDLK_0, ev.key.keysym.mod, 0);
#endif
- } else {
- event.kbd.keycode = Common::KEYCODE_RETURN;
- event.kbd.ascii = mapKey(SDLK_RETURN, ev.key.keysym.mod, 0);
- }
- break;
- case BUTTON_SELECT:
- case BUTTON_HELP2:
- if (BUTTON_STATE_L == true) {
- event.type = Common::EVENT_QUIT;
- } else {
- event.kbd.keycode = Common::KEYCODE_ESCAPE;
- event.kbd.ascii = mapKey(SDLK_ESCAPE, ev.key.keysym.mod, 0);
- }
- break;
- case BUTTON_A:
- if (BUTTON_STATE_L == true) {
- event.type = Common::EVENT_PREDICTIVE_DIALOG;
- } else {
- event.kbd.keycode = Common::KEYCODE_PERIOD;
- event.kbd.ascii = mapKey(SDLK_PERIOD, ev.key.keysym.mod, 0);
- }
- break;
- case BUTTON_Y:
- if (BUTTON_STATE_L == true) {
- GPH::ToggleTapMode();
- if (GPH::tapmodeLevel == TAPMODE_LEFT) {
- displayMessageOnOSD("Touchscreen 'Tap Mode': Left Click");
- } else if (GPH::tapmodeLevel == TAPMODE_RIGHT) {
- displayMessageOnOSD("Touchscreen 'Tap Mode': Right Click");
- } else if (GPH::tapmodeLevel == TAPMODE_HOVER) {
- displayMessageOnOSD("Touchscreen 'Tap Mode': Hover (No Click)");
- }
- } else {
- event.kbd.keycode = Common::KEYCODE_SPACE;
- event.kbd.ascii = mapKey(SDLK_SPACE, ev.key.keysym.mod, 0);
- }
- break;
- case BUTTON_MENU:
- case BUTTON_HELP:
- if (BUTTON_STATE_L == true) {
- event.type = Common::EVENT_MAINMENU;
- } else {
- event.kbd.keycode = Common::KEYCODE_F5;
- event.kbd.ascii = mapKey(SDLK_F5, ev.key.keysym.mod, 0);
- }
- break;
- case BUTTON_VOLUP:
- WIZ_HW::mixerMoveVolume(2);
- if (WIZ_HW::volumeLevel == 100) {
- displayMessageOnOSD("Maximum Volume");
- } else {
- displayMessageOnOSD("Increasing Volume");
- }
- break;
- case BUTTON_VOLDOWN:
- WIZ_HW::mixerMoveVolume(1);
- if (WIZ_HW::volumeLevel == 0) {
- displayMessageOnOSD("Minimal Volume");
- } else {
- displayMessageOnOSD("Decreasing Volume");
- }
- break;
- case BUTTON_HOLD:
- event.type = Common::EVENT_QUIT;
- break;
- case BUTTON_HOME:
- GPH::ToggleTapMode();
- if (GPH::tapmodeLevel == TAPMODE_LEFT) {
- displayMessageOnOSD("Touchscreen 'Tap Mode': Left Click");
- } else if (GPH::tapmodeLevel == TAPMODE_RIGHT) {
- displayMessageOnOSD("Touchscreen 'Tap Mode': Right Click");
- } else if (GPH::tapmodeLevel == TAPMODE_HOVER) {
- displayMessageOnOSD("Touchscreen 'Tap Mode': Hover (No Click)");
- }
- break;
+ } else {
+ event.kbd.keycode = Common::KEYCODE_RETURN;
+ event.kbd.ascii = mapKey(SDLK_RETURN, ev.key.keysym.mod, 0);
+ }
+ break;
+ case BUTTON_SELECT:
+ case BUTTON_HOME:
+ event.type = Common::EVENT_KEYDOWN;
+ if (BUTTON_STATE_L == true) {
+ event.type = Common::EVENT_QUIT;
+ } else {
+ event.kbd.keycode = Common::KEYCODE_ESCAPE;
+ event.kbd.ascii = mapKey(SDLK_ESCAPE, ev.key.keysym.mod, 0);
+ }
+ break;
+ case BUTTON_A:
+ event.type = Common::EVENT_KEYDOWN;
+ if (BUTTON_STATE_L == true) {
+ event.type = Common::EVENT_PREDICTIVE_DIALOG;
+ } else {
+ event.kbd.keycode = Common::KEYCODE_PERIOD;
+ event.kbd.ascii = mapKey(SDLK_PERIOD, ev.key.keysym.mod, 0);
+ }
+ break;
+ case BUTTON_Y:
+ event.type = Common::EVENT_KEYDOWN;
+ if (BUTTON_STATE_L == true) {
+ GPH::ToggleTapMode();
+ if (GPH::tapmodeLevel == TAPMODE_LEFT) {
+ displayMessageOnOSD("Touchscreen 'Tap Mode' - Left Click");
+ } else if (GPH::tapmodeLevel == TAPMODE_RIGHT) {
+ displayMessageOnOSD("Touchscreen 'Tap Mode' - Right Click");
+ } else if (GPH::tapmodeLevel == TAPMODE_HOVER) {
+ displayMessageOnOSD("Touchscreen 'Tap Mode' - Hover (No Click)");
}
+ } else {
+ event.kbd.keycode = Common::KEYCODE_SPACE;
+ event.kbd.ascii = mapKey(SDLK_SPACE, ev.key.keysym.mod, 0);
+ }
+ break;
+ case BUTTON_MENU:
+ case BUTTON_HELP:
+ event.type = Common::EVENT_KEYDOWN;
+ if (BUTTON_STATE_L == true) {
+ event.type = Common::EVENT_MAINMENU;
+ } else {
+ event.kbd.keycode = Common::KEYCODE_F5;
+ event.kbd.ascii = mapKey(SDLK_F5, ev.key.keysym.mod, 0);
}
- return true;
+ break;
+ case BUTTON_VOLUP:
+ WIZ_HW::mixerMoveVolume(2);
+ if (WIZ_HW::volumeLevel == 100) {
+ displayMessageOnOSD("Maximum Volume");
+ } else {
+ displayMessageOnOSD("Increasing Volume");
+ }
+ break;
+ case BUTTON_VOLDOWN:
+ WIZ_HW::mixerMoveVolume(1);
+ if (WIZ_HW::volumeLevel == 0) {
+ displayMessageOnOSD("Minimal Volume");
+ } else {
+ displayMessageOnOSD("Decreasing Volume");
+ }
+ break;
+ case BUTTON_HOLD:
+ event.type = Common::EVENT_QUIT;
+ break;
+ case BUTTON_HELP2:
+ GPH::ToggleTapMode();
+ if (GPH::tapmodeLevel == TAPMODE_LEFT) {
+ displayMessageOnOSD("Touchscreen 'Tap Mode': Left Click");
+ } else if (GPH::tapmodeLevel == TAPMODE_RIGHT) {
+ displayMessageOnOSD("Touchscreen 'Tap Mode': Right Click");
+ } else if (GPH::tapmodeLevel == TAPMODE_HOVER) {
+ displayMessageOnOSD("Touchscreen 'Tap Mode': Hover (No Click)");
+ }
+ break;
+ }
+ return true;
}
bool OSystem_GPH::handleJoyButtonUp(SDL_Event &ev, Common::Event &event) {
- _stickBtn[ev.jbutton.button] = 0;
- if (ev.jbutton.button == BUTTON_B) {
- event.type = Common::EVENT_LBUTTONUP;
- fillMouseEvent(event, _km.x, _km.y);
- } else if (ev.jbutton.button == BUTTON_CLICK) {
- event.type = Common::EVENT_LBUTTONUP;
- fillMouseEvent(event, _km.x, _km.y);
- } else if (ev.jbutton.button == BUTTON_X) {
- event.type = Common::EVENT_RBUTTONUP;
- fillMouseEvent(event, _km.x, _km.y);
-#if !defined (CAANOO)
- } else if (ev.jbutton.button < 8) {
- moveStick();
- event.type = Common::EVENT_MOUSEMOVE;
- fillMouseEvent(event, _km.x, _km.y);
-#endif
+ switch (ev.jbutton.button) {
+ case BUTTON_UP:
+ case BUTTON_UPLEFT:
+ case BUTTON_LEFT:
+ case BUTTON_DOWNLEFT:
+ case BUTTON_DOWN:
+ case BUTTON_DOWNRIGHT:
+ case BUTTON_RIGHT:
+ case BUTTON_UPRIGHT:
+ moveStick();
+ event.type = Common::EVENT_MOUSEMOVE;
+ fillMouseEvent(event, _km.x, _km.y);
+ break;
+ case BUTTON_B:
+ case BUTTON_CLICK:
+ event.type = Common::EVENT_LBUTTONUP;
+ fillMouseEvent(event, _km.x, _km.y);
+ break;
+ case BUTTON_X:
+ event.type = Common::EVENT_RBUTTONUP;
+ fillMouseEvent(event, _km.x, _km.y);
+ break;
+ case BUTTON_L:
+ BUTTON_STATE_L = true;
+ break;
+ case BUTTON_SELECT:
+ case BUTTON_HOME:
+ event.type = Common::EVENT_KEYUP;
+ event.kbd.keycode = Common::KEYCODE_ESCAPE;
+ event.kbd.ascii = mapKey(SDLK_ESCAPE, ev.key.keysym.mod, 0);
+ break;
+ case BUTTON_A:
+ event.type = Common::EVENT_KEYUP;
+ event.kbd.keycode = Common::KEYCODE_PERIOD;
+ event.kbd.ascii = mapKey(SDLK_PERIOD, ev.key.keysym.mod, 0);
+ break;
+ case BUTTON_Y:
+ event.type = Common::EVENT_KEYUP;
+ event.kbd.keycode = Common::KEYCODE_SPACE;
+ event.kbd.ascii = mapKey(SDLK_SPACE, ev.key.keysym.mod, 0);
+ break;
+ case BUTTON_MENU:
+ case BUTTON_HELP:
+ event.type = Common::EVENT_KEYUP;
+ if (BUTTON_STATE_L == true) {
+ event.type = Common::EVENT_MAINMENU;
} else {
- event.type = Common::EVENT_KEYUP;
- event.kbd.flags = 0;
- switch (ev.jbutton.button) {
- case BUTTON_SELECT:
- case BUTTON_HELP2:
- event.kbd.keycode = Common::KEYCODE_ESCAPE;
- event.kbd.ascii = mapKey(SDLK_ESCAPE, ev.key.keysym.mod, 0);
- break;
- case BUTTON_A:
- event.kbd.keycode = Common::KEYCODE_PERIOD;
- event.kbd.ascii = mapKey(SDLK_PERIOD, ev.key.keysym.mod, 0);
- break;
- case BUTTON_Y:
- event.kbd.keycode = Common::KEYCODE_SPACE;
- event.kbd.ascii = mapKey(SDLK_SPACE, ev.key.keysym.mod, 0);
- break;
- case BUTTON_MENU:
- case BUTTON_HELP:
- if (BUTTON_STATE_L == true) {
- event.type = Common::EVENT_MAINMENU;
- } else {
- event.kbd.keycode = Common::KEYCODE_F5;
- event.kbd.ascii = mapKey(SDLK_F5, ev.key.keysym.mod, 0);
- }
- break;
- case BUTTON_L:
- BUTTON_STATE_L = false;
- break;
- case BUTTON_R:
- if (BUTTON_STATE_L == true) {
+ event.kbd.keycode = Common::KEYCODE_F5;
+ event.kbd.ascii = mapKey(SDLK_F5, ev.key.keysym.mod, 0);
+ }
+ break;
+ case BUTTON_R:
+ event.type = Common::EVENT_KEYUP;
+ if (BUTTON_STATE_L == true) {
#ifdef ENABLE_VKEYBD
- event.kbd.keycode = Common::KEYCODE_F7;
- event.kbd.ascii = mapKey(SDLK_F7, ev.key.keysym.mod, 0);
+ event.kbd.keycode = Common::KEYCODE_F7;
+ event.kbd.ascii = mapKey(SDLK_F7, ev.key.keysym.mod, 0);
#else
- event.kbd.keycode = Common::KEYCODE_0;
- event.kbd.ascii = mapKey(SDLK_0, ev.key.keysym.mod, 0);
+ event.kbd.keycode = Common::KEYCODE_0;
+ event.kbd.ascii = mapKey(SDLK_0, ev.key.keysym.mod, 0);
#endif
- } else {
- event.kbd.keycode = Common::KEYCODE_RETURN;
- event.kbd.ascii = mapKey(SDLK_RETURN, ev.key.keysym.mod, 0);
- }
- break;
- case BUTTON_VOLUP:
- break;
- case BUTTON_VOLDOWN:
- break;
- case BUTTON_HOLD:
- break;
- case BUTTON_HOME:
- break;
- }
+ } else {
+ event.kbd.keycode = Common::KEYCODE_RETURN;
+ event.kbd.ascii = mapKey(SDLK_RETURN, ev.key.keysym.mod, 0);
}
- return true;
+ break;
+ case BUTTON_VOLUP:
+ break;
+ case BUTTON_VOLDOWN:
+ break;
+ case BUTTON_HOLD:
+ break;
+ case BUTTON_HELP2:
+ break;
+ }
+ return true;
}
bool OSystem_GPH::remapKey(SDL_Event &ev,Common::Event &event) {