diff options
-rw-r--r-- | backends/events/gph/gph-events.cpp | 43 | ||||
-rw-r--r-- | backends/events/gph/gph-events.h | 4 | ||||
-rw-r--r-- | backends/events/openpandora/op-events.cpp | 45 | ||||
-rw-r--r-- | backends/events/openpandora/op-events.h | 3 | ||||
-rw-r--r-- | backends/platform/gph/gph-hw.cpp | 25 | ||||
-rw-r--r-- | backends/platform/gph/gph-hw.h | 8 | ||||
-rw-r--r-- | backends/platform/openpandora/module.mk | 1 | ||||
-rw-r--r-- | backends/platform/openpandora/op-options.cpp | 56 | ||||
-rw-r--r-- | backends/platform/openpandora/op-options.h | 39 |
9 files changed, 65 insertions, 159 deletions
diff --git a/backends/events/gph/gph-events.cpp b/backends/events/gph/gph-events.cpp index 18a4c6c32a..37627861b5 100644 --- a/backends/events/gph/gph-events.cpp +++ b/backends/events/gph/gph-events.cpp @@ -155,7 +155,20 @@ enum { }; GPHEventSource::GPHEventSource() - : _buttonStateL(false) { + : _buttonStateL(false), + _tapmodeLevel(TAPMODE_LEFT) { +} + +void GPHEventSource::ToggleTapMode() { + if (_tapmodeLevel == TAPMODE_LEFT) { + _tapmodeLevel = TAPMODE_RIGHT; + } else if (_tapmodeLevel == TAPMODE_RIGHT) { + _tapmodeLevel = TAPMODE_HOVER; + } else if (_tapmodeLevel == TAPMODE_HOVER) { + _tapmodeLevel = TAPMODE_LEFT; + } else { + _tapmodeLevel = TAPMODE_LEFT; + } } /* Custom handleMouseButtonDown/handleMouseButtonUp to deal with 'Tap Mode' for the touchscreen */ @@ -164,11 +177,11 @@ bool GPHEventSource::handleMouseButtonDown(SDL_Event &ev, Common::Event &event) if (ev.button.button == SDL_BUTTON_LEFT) { if (_buttonStateL == true) /* _buttonStateL = Left Trigger Held, force Right Click */ event.type = Common::EVENT_RBUTTONDOWN; - else if (GPH::tapmodeLevel == TAPMODE_LEFT) /* TAPMODE_LEFT = Left Click Tap Mode */ + else if (_tapmodeLevel == TAPMODE_LEFT) /* TAPMODE_LEFT = Left Click Tap Mode */ event.type = Common::EVENT_LBUTTONDOWN; - else if (GPH::tapmodeLevel == TAPMODE_RIGHT) /* TAPMODE_RIGHT = Right Click Tap Mode */ + else if (_tapmodeLevel == TAPMODE_RIGHT) /* TAPMODE_RIGHT = Right Click Tap Mode */ event.type = Common::EVENT_RBUTTONDOWN; - else if (GPH::tapmodeLevel == TAPMODE_HOVER) /* TAPMODE_HOVER = Hover (No Click) Tap Mode */ + else if (_tapmodeLevel == TAPMODE_HOVER) /* TAPMODE_HOVER = Hover (No Click) Tap Mode */ event.type = Common::EVENT_MOUSEMOVE; else event.type = Common::EVENT_LBUTTONDOWN; /* For normal mice etc. */ @@ -199,11 +212,11 @@ bool GPHEventSource::handleMouseButtonUp(SDL_Event &ev, Common::Event &event) { if (ev.button.button == SDL_BUTTON_LEFT) { if (_buttonStateL == true) /* _buttonStateL = Left Trigger Held, force Right Click */ event.type = Common::EVENT_RBUTTONUP; - else if (GPH::tapmodeLevel == TAPMODE_LEFT) /* TAPMODE_LEFT = Left Click Tap Mode */ + else if (_tapmodeLevel == TAPMODE_LEFT) /* TAPMODE_LEFT = Left Click Tap Mode */ event.type = Common::EVENT_LBUTTONUP; - else if (GPH::tapmodeLevel == TAPMODE_RIGHT) /* TAPMODE_RIGHT = Right Click Tap Mode */ + else if (_tapmodeLevel == TAPMODE_RIGHT) /* TAPMODE_RIGHT = Right Click Tap Mode */ event.type = Common::EVENT_RBUTTONUP; - else if (GPH::tapmodeLevel == TAPMODE_HOVER) /* TAPMODE_HOVER = Hover (No Click) Tap Mode */ + else if (_tapmodeLevel == TAPMODE_HOVER) /* TAPMODE_HOVER = Hover (No Click) Tap Mode */ event.type = Common::EVENT_MOUSEMOVE; else event.type = Common::EVENT_LBUTTONUP; /* For normal mice etc. */ @@ -383,12 +396,12 @@ bool GPHEventSource::handleJoyButtonDown(SDL_Event &ev, Common::Event &event) { case BUTTON_Y: event.type = Common::EVENT_KEYDOWN; if (_buttonStateL == true) { - GPH::ToggleTapMode(); - if (GPH::tapmodeLevel == TAPMODE_LEFT) { + ToggleTapMode(); + if (_tapmodeLevel == TAPMODE_LEFT) { g_system->displayMessageOnOSD(_("Touchscreen 'Tap Mode' - Left Click")); - } else if (GPH::tapmodeLevel == TAPMODE_RIGHT) { + } else if (_tapmodeLevel == TAPMODE_RIGHT) { g_system->displayMessageOnOSD(_("Touchscreen 'Tap Mode' - Right Click")); - } else if (GPH::tapmodeLevel == TAPMODE_HOVER) { + } else if (_tapmodeLevel == TAPMODE_HOVER) { g_system->displayMessageOnOSD(_("Touchscreen 'Tap Mode' - Hover (No Click)")); } } else { @@ -426,12 +439,12 @@ bool GPHEventSource::handleJoyButtonDown(SDL_Event &ev, Common::Event &event) { event.type = Common::EVENT_QUIT; break; case BUTTON_HELP2: - GPH::ToggleTapMode(); - if (GPH::tapmodeLevel == TAPMODE_LEFT) { + ToggleTapMode(); + if (_tapmodeLevel == TAPMODE_LEFT) { g_system->displayMessageOnOSD(_("Touchscreen 'Tap Mode' - Left Click")); - } else if (GPH::tapmodeLevel == TAPMODE_RIGHT) { + } else if (_tapmodeLevel == TAPMODE_RIGHT) { g_system->displayMessageOnOSD(_("Touchscreen 'Tap Mode' - Right Click")); - } else if (GPH::tapmodeLevel == TAPMODE_HOVER) { + } else if (_tapmodeLevel == TAPMODE_HOVER) { g_system->displayMessageOnOSD(_("Touchscreen 'Tap Mode' - Hover (No Click)")); } break; diff --git a/backends/events/gph/gph-events.h b/backends/events/gph/gph-events.h index 507aa94828..bdcb62d8c2 100644 --- a/backends/events/gph/gph-events.h +++ b/backends/events/gph/gph-events.h @@ -39,6 +39,10 @@ protected: */ bool _buttonStateL; + int _tapmodeLevel; + + void ToggleTapMode(); + bool handleJoyButtonDown(SDL_Event &ev, Common::Event &event); bool handleJoyButtonUp(SDL_Event &ev, Common::Event &event); bool handleMouseButtonDown(SDL_Event &ev, Common::Event &event); diff --git a/backends/events/openpandora/op-events.cpp b/backends/events/openpandora/op-events.cpp index fd5d2bc043..6302c15517 100644 --- a/backends/events/openpandora/op-events.cpp +++ b/backends/events/openpandora/op-events.cpp @@ -46,7 +46,22 @@ enum { }; OPEventSource::OPEventSource() - : _buttonStateL(false) { + : _buttonStateL(false), + _tapmodeLevel(TAPMODE_LEFT) { +} + +void OPEventSource::ToggleTapMode() { + if (_tapmodeLevel == TAPMODE_LEFT) { + _tapmodeLevel = TAPMODE_RIGHT; + } 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; + } } /* Custom handleMouseButtonDown/handleMouseButtonUp to deal with 'Tap Mode' for the touchscreen */ @@ -55,13 +70,13 @@ bool OPEventSource::handleMouseButtonDown(SDL_Event &ev, Common::Event &event) { if (ev.button.button == SDL_BUTTON_LEFT) { if (_buttonStateL == true) /* _buttonStateL = Left Trigger Held, force Right Click */ event.type = Common::EVENT_RBUTTONDOWN; - else if (OP::tapmodeLevel == TAPMODE_LEFT) /* TAPMODE_LEFT = Left Click Tap Mode */ + else if (_tapmodeLevel == TAPMODE_LEFT) /* TAPMODE_LEFT = Left Click Tap Mode */ event.type = Common::EVENT_LBUTTONDOWN; - else if (OP::tapmodeLevel == TAPMODE_RIGHT) /* TAPMODE_RIGHT = Right Click Tap Mode */ + else if (_tapmodeLevel == TAPMODE_RIGHT) /* TAPMODE_RIGHT = Right Click Tap Mode */ event.type = Common::EVENT_RBUTTONDOWN; - else if (OP::tapmodeLevel == TAPMODE_HOVER) /* TAPMODE_HOVER = Hover (No Click) Tap Mode */ + else if (_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 */ + else if (_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. */ @@ -92,13 +107,13 @@ bool OPEventSource::handleMouseButtonUp(SDL_Event &ev, Common::Event &event) { if (ev.button.button == SDL_BUTTON_LEFT) { if (_buttonStateL == true) /* _buttonStateL = Left Trigger Held, force Right Click */ event.type = Common::EVENT_RBUTTONUP; - else if (OP::tapmodeLevel == TAPMODE_LEFT) /* TAPMODE_LEFT = Left Click Tap Mode */ + else if (_tapmodeLevel == TAPMODE_LEFT) /* TAPMODE_LEFT = Left Click Tap Mode */ event.type = Common::EVENT_LBUTTONUP; - else if (OP::tapmodeLevel == TAPMODE_RIGHT) /* TAPMODE_RIGHT = Right Click Tap Mode */ + else if (_tapmodeLevel == TAPMODE_RIGHT) /* TAPMODE_RIGHT = Right Click Tap Mode */ event.type = Common::EVENT_RBUTTONUP; - else if (OP::tapmodeLevel == TAPMODE_HOVER) /* TAPMODE_HOVER = Hover (No Click) Tap Mode */ + else if (_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 */ + else if (_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. */ @@ -125,7 +140,7 @@ bool OPEventSource::handleMouseButtonUp(SDL_Event &ev, Common::Event &event) { bool OPEventSource::remapKey(SDL_Event &ev, Common::Event &event) { - if (OP::tapmodeLevel == TAPMODE_HOVER_DPAD) { + if (_tapmodeLevel == TAPMODE_HOVER_DPAD) { switch (ev.key.keysym.sym) { case SDLK_LEFT: event.type = (ev.type == SDL_KEYDOWN) ? Common::EVENT_LBUTTONDOWN : Common::EVENT_LBUTTONUP; @@ -166,14 +181,14 @@ bool OPEventSource::remapKey(SDL_Event &ev, Common::Event &event) { return true; break; case SDLK_PAGEUP: - OP::ToggleTapMode(); - if (OP::tapmodeLevel == TAPMODE_LEFT) { + ToggleTapMode(); + if (_tapmodeLevel == TAPMODE_LEFT) { g_system->displayMessageOnOSD(_("Touchscreen 'Tap Mode' - Left Click")); - } else if (OP::tapmodeLevel == TAPMODE_RIGHT) { + } else if (_tapmodeLevel == TAPMODE_RIGHT) { g_system->displayMessageOnOSD(_("Touchscreen 'Tap Mode' - Right Click")); - } else if (OP::tapmodeLevel == TAPMODE_HOVER) { + } else if (_tapmodeLevel == TAPMODE_HOVER) { g_system->displayMessageOnOSD(_("Touchscreen 'Tap Mode' - Hover (No Click)")); - } else if (OP::tapmodeLevel == TAPMODE_HOVER_DPAD) { + } else if (_tapmodeLevel == TAPMODE_HOVER_DPAD) { g_system->displayMessageOnOSD(_("Touchscreen 'Tap Mode' - Hover (DPad Clicks)")); } break; diff --git a/backends/events/openpandora/op-events.h b/backends/events/openpandora/op-events.h index e45ac80e2a..aebd376ada 100644 --- a/backends/events/openpandora/op-events.h +++ b/backends/events/openpandora/op-events.h @@ -40,6 +40,9 @@ protected: */ bool _buttonStateL; + int _tapmodeLevel; + + void ToggleTapMode(); bool handleMouseButtonDown(SDL_Event &ev, Common::Event &event); bool handleMouseButtonUp(SDL_Event &ev, Common::Event &event); diff --git a/backends/platform/gph/gph-hw.cpp b/backends/platform/gph/gph-hw.cpp index 7b004f1739..74e3cc39d3 100644 --- a/backends/platform/gph/gph-hw.cpp +++ b/backends/platform/gph/gph-hw.cpp @@ -82,28 +82,3 @@ void mixerMoveVolume(int direction) { } } /* namespace WIZ_HW */ - -namespace GPH { - -enum { - /* Touchscreen TapMode */ - TAPMODE_LEFT = 0, - TAPMODE_RIGHT = 1, - TAPMODE_HOVER = 2 -}; - -int tapmodeLevel = TAPMODE_LEFT; - -void ToggleTapMode() { - if (tapmodeLevel == TAPMODE_LEFT) { - tapmodeLevel = TAPMODE_RIGHT; - } else if (tapmodeLevel == TAPMODE_RIGHT) { - tapmodeLevel = TAPMODE_HOVER; - } else if (tapmodeLevel == TAPMODE_HOVER) { - tapmodeLevel = TAPMODE_LEFT; - } else { - tapmodeLevel = TAPMODE_LEFT; - } -} - -} /* namespace GPH */ diff --git a/backends/platform/gph/gph-hw.h b/backends/platform/gph/gph-hw.h index c6d0094cf1..116af2fff4 100644 --- a/backends/platform/gph/gph-hw.h +++ b/backends/platform/gph/gph-hw.h @@ -38,12 +38,4 @@ extern void mixerMoveVolume(int); } /* namespace WIZ_HW */ -namespace GPH { - -extern int tapmodeLevel; - -extern void ToggleTapMode(); - -} /* namespace GPH */ - #endif //GPH_HW_H diff --git a/backends/platform/openpandora/module.mk b/backends/platform/openpandora/module.mk index 5bd568e1c4..0776bc22a4 100644 --- a/backends/platform/openpandora/module.mk +++ b/backends/platform/openpandora/module.mk @@ -1,7 +1,6 @@ MODULE := backends/platform/openpandora MODULE_OBJS := \ - op-options.o \ op-backend.o \ op-main.o diff --git a/backends/platform/openpandora/op-options.cpp b/backends/platform/openpandora/op-options.cpp deleted file mode 100644 index d2e7860962..0000000000 --- a/backends/platform/openpandora/op-options.cpp +++ /dev/null @@ -1,56 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -/* - * OpenPandora: Options, custom code and hardware stuff. - * - */ - -#include "backends/platform/openpandora/op-options.h" - -namespace OP { - -enum { - /* Touchscreen TapMode */ - TAPMODE_LEFT = 0, - TAPMODE_RIGHT = 1, - TAPMODE_HOVER = 2, - TAPMODE_HOVER_DPAD = 3 -}; - -int tapmodeLevel = TAPMODE_LEFT; - -void ToggleTapMode() { - if (tapmodeLevel == TAPMODE_LEFT) { - tapmodeLevel = TAPMODE_RIGHT; - } 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; - } -} - -} /* namespace OP */ diff --git a/backends/platform/openpandora/op-options.h b/backends/platform/openpandora/op-options.h deleted file mode 100644 index 8eae420af2..0000000000 --- a/backends/platform/openpandora/op-options.h +++ /dev/null @@ -1,39 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -/* - * OpenPandora: Options, custom code and hardware stuff. - * - */ - -#ifndef OP_OPTIONS_H -#define OP_OPTIONS_H - -namespace OP { - -extern int tapmodeLevel; - -extern void ToggleTapMode(); - -} /* namespace OP */ - -#endif //OP_OPTIONS_H |