aboutsummaryrefslogtreecommitdiff
path: root/backends/platform/wince/CEActionsSmartphone.cpp
diff options
context:
space:
mode:
authorKostas Nakos2006-07-01 08:13:46 +0000
committerKostas Nakos2006-07-01 08:13:46 +0000
commit6a8749ace05649fdf69593c76a75c322f34a5bfa (patch)
treeda214254c9ca56ded22af377fe0763ad73dd7bb5 /backends/platform/wince/CEActionsSmartphone.cpp
parent294dcea3ef063ee4ec95f3f418af4534445da1c6 (diff)
downloadscummvm-rg350-6a8749ace05649fdf69593c76a75c322f34a5bfa.tar.gz
scummvm-rg350-6a8749ace05649fdf69593c76a75c322f34a5bfa.tar.bz2
scummvm-rg350-6a8749ace05649fdf69593c76a75c322f34a5bfa.zip
move ce port to its new home
svn-id: r23366
Diffstat (limited to 'backends/platform/wince/CEActionsSmartphone.cpp')
-rw-r--r--backends/platform/wince/CEActionsSmartphone.cpp238
1 files changed, 238 insertions, 0 deletions
diff --git a/backends/platform/wince/CEActionsSmartphone.cpp b/backends/platform/wince/CEActionsSmartphone.cpp
new file mode 100644
index 0000000000..4ee4963f66
--- /dev/null
+++ b/backends/platform/wince/CEActionsSmartphone.cpp
@@ -0,0 +1,238 @@
+/* ScummVM - Scumm Interpreter
+ * Copyright (C) 2001-2006 The ScummVM project
+ *
+ * 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.
+ *
+ * $URL$
+ * $Id$
+ *
+ */
+
+//#define SIMU_SMARTPHONE 1
+
+//#ifdef WIN32_PLATFORM_WFSP
+
+#include "common/stdafx.h"
+#include "CEActionsSmartphone.h"
+#include "EventsBuffer.h"
+
+#include "gui/message.h"
+
+#include "scumm/scumm.h"
+
+#include "common/config-manager.h"
+
+#include "gui/KeysDialog.h"
+
+#ifdef _WIN32_WCE
+#define KEY_ALL_SKIP 3457
+#endif
+
+const String smartphoneActionNames[] = {
+ "Up",
+ "Down",
+ "Left",
+ "Right",
+ "Left Click",
+ "Right Click",
+ "Save",
+ "Skip",
+ "Zone",
+ "FT Cheat",
+ "Bind Keys",
+ "Keyboard",
+ "Rotate"
+};
+
+#ifdef SIMU_SMARTPHONE
+const int ACTIONS_SMARTPHONE_DEFAULT[] = { 0x111, 0x112, 0x114, 0x113, 0x11a, 0x11b, VK_LWIN, VK_ESCAPE, VK_F8, 0, VK_RETURN, 0, 0 };
+#else
+const int ACTIONS_SMARTPHONE_DEFAULT[] = { '4', '6', '8', '2', 0x11a, 0x11b, '0', VK_ESCAPE, '9', 0, VK_RETURN, 0, 0 };
+#endif
+
+void CEActionsSmartphone::init() {
+ _instance = new CEActionsSmartphone();
+}
+
+
+String CEActionsSmartphone::actionName(GUI::ActionType action) {
+ return smartphoneActionNames[action];
+}
+
+int CEActionsSmartphone::size() {
+ return SMARTPHONE_ACTION_LAST;
+}
+
+String CEActionsSmartphone::domain() {
+ return ConfMan.kApplicationDomain;
+}
+
+int CEActionsSmartphone::version() {
+ return SMARTPHONE_ACTION_VERSION;
+}
+
+CEActionsSmartphone::CEActionsSmartphone()
+: GUI::Actions() {
+ int i;
+
+ for (i=0; i<SMARTPHONE_ACTION_LAST; i++) {
+ _action_mapping[i] = ACTIONS_SMARTPHONE_DEFAULT[i];
+ _action_enabled[i] = false;
+ }
+
+}
+
+void CEActionsSmartphone::initInstanceMain(OSystem *mainSystem) {
+ _CESystem = static_cast<OSystem_WINCE3*>(mainSystem);
+
+ GUI_Actions::initInstanceMain(mainSystem);
+ // Mouse Up
+ _action_enabled[SMARTPHONE_ACTION_UP] = true;
+ // Mouse Down
+ _action_enabled[SMARTPHONE_ACTION_DOWN] = true;
+ // Mouse Left
+ _action_enabled[SMARTPHONE_ACTION_LEFT] = true;
+ // Mouse Right
+ _action_enabled[SMARTPHONE_ACTION_RIGHT] = true;
+ // Left Click
+ _action_enabled[SMARTPHONE_ACTION_LEFTCLICK] = true;
+ // Right Click
+ _action_enabled[SMARTPHONE_ACTION_RIGHTCLICK] = true;
+ // Show virtual keyboard
+ _action_enabled[SMARTPHONE_ACTION_KEYBOARD] = true;
+ // Rotate display
+ _action_enabled[SMARTPHONE_ACTION_ROTATE] = true;
+}
+
+void CEActionsSmartphone::initInstanceGame() {
+ String gameid(ConfMan.get("gameid"));
+ bool is_simon = (strncmp(gameid.c_str(), "simon", 5) == 0);
+ bool is_sky = (gameid == "sky");
+ bool is_queen = (gameid == "queen");
+ bool is_gob = (strncmp(gameid.c_str(), "gob", 3) == 0);
+ bool is_ite = ((strncmp(gameid.c_str(), "ite", 3) == 0) ||
+ (strncmp(gameid.c_str(), "ihnm", 4) == 0));
+
+ GUI_Actions::initInstanceGame();
+
+ // See if a right click mapping could be needed
+ if (is_sky || gameid == "samnmax" || is_gob)
+ _right_click_needed = true;
+
+ // Initialize keys for different actions
+ // Save
+ if (is_simon || is_gob)
+ _action_enabled[SMARTPHONE_ACTION_SAVE] = false;
+ else
+ if (is_queen || is_ite) {
+ _action_enabled[SMARTPHONE_ACTION_SAVE] = true;
+ _key_action[SMARTPHONE_ACTION_SAVE].setAscii(286); // F1 key for FOTAQ and ITE
+ }
+ else
+ if (is_sky) {
+ _action_enabled[SMARTPHONE_ACTION_SAVE] = true;
+ _key_action[SMARTPHONE_ACTION_SAVE].setAscii(63);
+ }
+ else {
+ _action_enabled[SMARTPHONE_ACTION_SAVE] = true;
+ _key_action[SMARTPHONE_ACTION_SAVE].setAscii(319); // F5 key
+ }
+ // Skip
+ _action_enabled[SMARTPHONE_ACTION_SKIP] = true;
+ if (is_simon || is_sky || is_gob || is_ite)
+ _key_action[SMARTPHONE_ACTION_SKIP].setAscii(VK_ESCAPE);
+ else
+ _key_action[SMARTPHONE_ACTION_SKIP].setAscii(KEY_ALL_SKIP);
+ // Zone
+ _action_enabled[SMARTPHONE_ACTION_ZONE] = true;
+ // FT Cheat
+ _action_enabled[SMARTPHONE_ACTION_FT_CHEAT] = true;
+ _key_action[SMARTPHONE_ACTION_FT_CHEAT].setAscii(86); // shift-V
+ // Bind keys
+ _action_enabled[SMARTPHONE_ACTION_BINDKEYS] = true;
+}
+
+
+CEActionsSmartphone::~CEActionsSmartphone() {
+}
+
+bool CEActionsSmartphone::perform(GUI::ActionType action, bool pushed) {
+ static bool keydialogrunning = false;
+
+ if (!pushed) {
+ switch (action) {
+ case SMARTPHONE_ACTION_RIGHTCLICK:
+ _CESystem->add_right_click(false);
+ return true;
+ case SMARTPHONE_ACTION_LEFTCLICK:
+ _CESystem->add_left_click(false);
+ return true;
+ case SMARTPHONE_ACTION_SAVE:
+ case SMARTPHONE_ACTION_SKIP:
+ case SMARTPHONE_ACTION_FT_CHEAT:
+ EventsBuffer::simulateKey(&_key_action[action], false);
+ return true;
+ }
+ return false;
+ }
+
+ switch (action) {
+ case SMARTPHONE_ACTION_SAVE:
+ case SMARTPHONE_ACTION_SKIP:
+ case SMARTPHONE_ACTION_FT_CHEAT:
+ EventsBuffer::simulateKey(&_key_action[action], true);
+ return true;
+ case SMARTPHONE_ACTION_RIGHTCLICK:
+ _CESystem->add_right_click(true);
+ return true;
+ case SMARTPHONE_ACTION_LEFTCLICK:
+ _CESystem->add_left_click(true);
+ return true;
+ case SMARTPHONE_ACTION_UP:
+ _CESystem->move_cursor_up();
+ return true;
+ case SMARTPHONE_ACTION_DOWN:
+ _CESystem->move_cursor_down();
+ return true;
+ case SMARTPHONE_ACTION_LEFT:
+ _CESystem->move_cursor_left();
+ return true;
+ case SMARTPHONE_ACTION_RIGHT:
+ _CESystem->move_cursor_right();
+ return true;
+ case SMARTPHONE_ACTION_ZONE:
+ _CESystem->switch_zone();
+ return true;
+ case SMARTPHONE_ACTION_BINDKEYS:
+ if (!keydialogrunning) {
+ keydialogrunning = true;
+ GUI::KeysDialog *keysDialog = new GUI::KeysDialog();
+ keysDialog->runModal();
+ delete keysDialog;
+ keydialogrunning = false;
+ }
+ return true;
+ case SMARTPHONE_ACTION_KEYBOARD:
+ _CESystem->swap_smartphone_keyboard();
+ return true;
+ case SMARTPHONE_ACTION_ROTATE:
+ _CESystem->smartphone_rotate_display();
+ return true;
+ }
+
+ return false;
+}
+
+//#endif