aboutsummaryrefslogtreecommitdiff
path: root/backends
diff options
context:
space:
mode:
authorBertrand Augereau2012-08-31 17:38:46 +0200
committerBertrand Augereau2012-08-31 17:38:46 +0200
commit94921846eb48276f55f179b0adadc718e40addfe (patch)
tree87f0cb7d9c4237a4a87ed79a356d7d9042b5b49f /backends
parent10a947a0be80ea8c5c88bd3493a5057b1223ce45 (diff)
downloadscummvm-rg350-94921846eb48276f55f179b0adadc718e40addfe.tar.gz
scummvm-rg350-94921846eb48276f55f179b0adadc718e40addfe.tar.bz2
scummvm-rg350-94921846eb48276f55f179b0adadc718e40addfe.zip
OPENPANDORA: New touchscreen mode where the stylus hovers and the DPad left/right/up trigger left/right/middle clicks
Diffstat (limited to 'backends')
-rw-r--r--backends/events/openpandora/op-events.cpp33
-rw-r--r--backends/platform/openpandora/op-options.cpp5
2 files changed, 36 insertions, 2 deletions
diff --git a/backends/events/openpandora/op-events.cpp b/backends/events/openpandora/op-events.cpp
index c1d6362fcb..9f4c9dd3b6 100644
--- a/backends/events/openpandora/op-events.cpp
+++ b/backends/events/openpandora/op-events.cpp
@@ -44,7 +44,8 @@ enum {
/* Touchscreen TapMode */
TAPMODE_LEFT = 0,
TAPMODE_RIGHT = 1,
- TAPMODE_HOVER = 2
+ TAPMODE_HOVER = 2,
+ TAPMODE_HOVER_DPAD = 3,
};
OPEventSource::OPEventSource()
@@ -63,6 +64,8 @@ bool OPEventSource::handleMouseButtonDown(SDL_Event &ev, Common::Event &event) {
event.type = Common::EVENT_RBUTTONDOWN;
else if (OP::tapmodeLevel == TAPMODE_HOVER) /* TAPMODE_HOVER = Hover (No Click) Tap Mode */
event.type = Common::EVENT_MOUSEMOVE;
+ else if (OP::tapmodeLevel == TAPMODE_HOVER_DPAD) /* TAPMODE_HOVER_DPAD = Hover (DPad Clicks) Tap Mode */
+ event.type = Common::EVENT_MOUSEMOVE;
else
event.type = Common::EVENT_LBUTTONDOWN; /* For normal mice etc. */
} else if (ev.button.button == SDL_BUTTON_RIGHT)
@@ -95,6 +98,8 @@ bool OPEventSource::handleMouseButtonUp(SDL_Event &ev, Common::Event &event) {
event.type = Common::EVENT_RBUTTONUP;
else if (OP::tapmodeLevel == TAPMODE_HOVER) /* TAPMODE_HOVER = Hover (No Click) Tap Mode */
event.type = Common::EVENT_MOUSEMOVE;
+ else if (OP::tapmodeLevel == TAPMODE_HOVER_DPAD) /* TAPMODE_HOVER_DPAD = Hover (DPad Clicks) Tap Mode */
+ event.type = Common::EVENT_MOUSEMOVE;
else
event.type = Common::EVENT_LBUTTONUP; /* For normal mice etc. */
} else if (ev.button.button == SDL_BUTTON_RIGHT)
@@ -117,6 +122,30 @@ bool OPEventSource::handleMouseButtonUp(SDL_Event &ev, Common::Event &event) {
bool OPEventSource::remapKey(SDL_Event &ev, Common::Event &event) {
+ if (OP::tapmodeLevel == TAPMODE_HOVER_DPAD) {
+ switch (ev.key.keysym.sym) {
+ case SDLK_LEFT:
+ event.type = (ev.type == SDL_KEYDOWN) ? Common::EVENT_LBUTTONDOWN : Common::EVENT_LBUTTONUP;
+ processMouseEvent(event, _km.x, _km.y);
+ return true;
+ break;
+ case SDLK_RIGHT:
+ event.type = (ev.type == SDL_KEYDOWN) ? Common::EVENT_RBUTTONDOWN : Common::EVENT_RBUTTONUP;
+ processMouseEvent(event, _km.x, _km.y);
+ return true;
+ break;
+#if defined(SDL_BUTTON_MIDDLE)
+ case SDLK_UP:
+ event.type = (ev.type == SDL_KEYDOWN) ? Common::EVENT_MBUTTONDOWN : Common::EVENT_MBUTTONUP;
+ processMouseEvent(event, _km.x, _km.y);
+ return true;
+ break;
+#endif
+ default:
+ break;
+ }
+ }
+
if (ev.type == SDL_KEYDOWN) {
switch (ev.key.keysym.sym) {
case SDLK_HOME:
@@ -141,6 +170,8 @@ bool OPEventSource::remapKey(SDL_Event &ev, Common::Event &event) {
g_system->displayMessageOnOSD(_("Touchscreen 'Tap Mode' - Right Click"));
} else if (OP::tapmodeLevel == TAPMODE_HOVER) {
g_system->displayMessageOnOSD(_("Touchscreen 'Tap Mode' - Hover (No Click)"));
+ } else if (OP::tapmodeLevel == TAPMODE_HOVER_DPAD) {
+ g_system->displayMessageOnOSD(_("Touchscreen 'Tap Mode' - Hover (DPad Clicks)"));
}
break;
case SDLK_RSHIFT:
diff --git a/backends/platform/openpandora/op-options.cpp b/backends/platform/openpandora/op-options.cpp
index 58f0fb7188..758f5600bc 100644
--- a/backends/platform/openpandora/op-options.cpp
+++ b/backends/platform/openpandora/op-options.cpp
@@ -33,7 +33,8 @@ enum {
/* Touchscreen TapMode */
TAPMODE_LEFT = 0,
TAPMODE_RIGHT = 1,
- TAPMODE_HOVER = 2
+ TAPMODE_HOVER = 2,
+ TAPMODE_HOVER_DPAD = 3,
};
int tapmodeLevel = TAPMODE_LEFT;
@@ -44,6 +45,8 @@ void ToggleTapMode() {
} else if (tapmodeLevel == TAPMODE_RIGHT) {
tapmodeLevel = TAPMODE_HOVER;
} else if (tapmodeLevel == TAPMODE_HOVER) {
+ tapmodeLevel = TAPMODE_HOVER_DPAD;
+ } else if (tapmodeLevel == TAPMODE_HOVER_DPAD) {
tapmodeLevel = TAPMODE_LEFT;
} else {
tapmodeLevel = TAPMODE_LEFT;