diff options
Diffstat (limited to 'backends/wince')
-rw-r--r-- | backends/wince/CEActions.cpp | 182 | ||||
-rw-r--r-- | backends/wince/CEActions.h | 55 | ||||
-rw-r--r-- | backends/wince/CEActionsPocket.cpp | 218 | ||||
-rw-r--r-- | backends/wince/CEActionsPocket.h | 81 | ||||
-rw-r--r-- | backends/wince/CEActionsSmartphone.cpp | 173 | ||||
-rw-r--r-- | backends/wince/CEActionsSmartphone.h | 75 |
6 files changed, 602 insertions, 182 deletions
diff --git a/backends/wince/CEActions.cpp b/backends/wince/CEActions.cpp index 7770cd278c..a10b056775 100644 --- a/backends/wince/CEActions.cpp +++ b/backends/wince/CEActions.cpp @@ -19,10 +19,10 @@ * */ - #include "stdafx.h" #include "CEActions.h" -#include "KeysBuffer.h" +#include "CEActionsPocket.h" +#include "CEActionsSmartphone.h" #include "gui/message.h" @@ -30,135 +30,36 @@ #include "common/config-manager.h" -const String actionNames[] = { - "none", - "Pause", - "Save", - "Quit", - "Skip", - "Hide", - "Keyboard", - "Sound", - "Right click", - "Cursor", - "Free look" -}; CEActions* CEActions::Instance() { return _instance; } -String CEActions::actionName(ActionType action) { - return actionNames[action]; -} - -int CEActions::size() { - return ACTION_LAST - 1; -} - -CEActions::CEActions(OSystem_WINCE3 *mainSystem, GameDetector &detector) : - _mainSystem(mainSystem), _mapping_active(false), _right_click_needed(false), - _hide_toolbar_needed(false) +CEActions::CEActions(GameDetector &detector) : + _detector(&detector), _mapping_active(false), _initialized(false) { - int i; - bool is_simon = (strncmp(detector._targetName.c_str(), "simon", 5) == 0); - bool is_sword1 = (detector._targetName == "sword1"); - bool is_sword2 = (strcmp(detector._targetName.c_str(), "sword2") == 0); - bool is_queen = (detector._targetName == "queen"); - bool is_sky = (detector._targetName == "sky"); - - for (i=0; i<ACTION_LAST; i++) - _action_mapping[i] = 0; - - // See if a right click mapping could be needed - if (is_sword1 || is_sword2 || is_sky || is_queen || detector._targetName == "comi" || - detector._targetName == "samnmax") - _right_click_needed = true; - - // See if a "hide toolbar" mapping could be needed - if (is_sword1 || is_sword2 || is_queen) - _hide_toolbar_needed = true; - - // Initialize keys for different actions - // Pause - _key_action[ACTION_PAUSE].setAscii(VK_SPACE); - _action_enabled[ACTION_PAUSE] = true; - // Save - if (is_simon) - _action_enabled[ACTION_SAVE] = false; - else - if (is_queen) { - _action_enabled[ACTION_SAVE] = true; - _key_action[ACTION_SAVE].setAscii(282); // F1 key - } - else - if (is_sky) { - _action_enabled[ACTION_SAVE] = true; - _key_action[ACTION_SAVE].setAscii(63); - } - else { - _action_enabled[ACTION_SAVE] = true; - _key_action[ACTION_SAVE].setAscii(319); // F5 key - } - // Quit - _action_enabled[ACTION_QUIT] = true; - // Skip - _action_enabled[ACTION_SKIP] = true; - if (is_simon || is_sky || is_sword2 || is_queen || is_sword1) - _key_action[ACTION_SKIP].setAscii(VK_ESCAPE); - else - _key_action[ACTION_SKIP].setAscii(Scumm::KEY_ALL_SKIP); - // Hide - _action_enabled[ACTION_HIDE] = true; - // Keyboard - _action_enabled[ACTION_KEYBOARD] = true; - // Sound - _action_enabled[ACTION_SOUND] = true; - // RightClick - _action_enabled[ACTION_RIGHTCLICK] = true; - // Cursor - _action_enabled[ACTION_CURSOR] = true; - // Freelook - _action_enabled[ACTION_FREELOOK] = true; } CEActions::~CEActions() { } -void CEActions::init(OSystem_WINCE3 *mainSystem, GameDetector &detector) { - _instance = new CEActions(mainSystem, detector); +void CEActions::init(GameDetector &detector) { + if (!CEDevice::hasSmartphoneResolution()) + CEActionsPocket::init(detector); +#ifdef WIN32_PLATFORM_WFSP + else + CEActionsSmartphone::init(detector); +#endif } -bool CEActions::perform(ActionType action) { - switch (action) { - case ACTION_PAUSE: - case ACTION_SAVE: - case ACTION_SKIP: - KeysBuffer::Instance()->simulate(&_key_action[action]); - return true; - case ACTION_KEYBOARD: - _mainSystem->swap_panel(); - return true; - case ACTION_HIDE: - _mainSystem->swap_panel_visibility(); - return true; - case ACTION_SOUND: - _mainSystem->swap_sound_master(); - return true; - case ACTION_RIGHTCLICK: - _mainSystem->add_right_click(); - return true; - case ACTION_CURSOR: - _mainSystem->swap_mouse_visibility(); - return true; - case ACTION_QUIT: - GUI::MessageDialog alert("Do you want to quit ?", "Yes", "No"); - if (alert.runModal() == 1) - _mainSystem->quit(); - return true; - } - return false; +void CEActions::initInstance(OSystem_WINCE3 *mainSystem) { + _mainSystem = mainSystem; + _instance->_initialized = true; +} + +bool CEActions::initialized() { + return _initialized; } bool CEActions::isActive(ActionType action) { @@ -180,13 +81,9 @@ bool CEActions::mappingActive() { bool CEActions::performMapped(unsigned int keyCode, bool pushed) { int i; - for (i=0; i<ACTION_LAST; i++) { - if (_action_mapping[i] == keyCode) { - if (pushed) - return perform((ActionType)(i + 1)); - else - return true; - } + for (i=0; i<size(); i++) { + if (_action_mapping[i] == keyCode) + return perform((ActionType)i, pushed); } return false; @@ -194,14 +91,14 @@ bool CEActions::performMapped(unsigned int keyCode, bool pushed) { bool CEActions::loadMapping() { const char *tempo; - int version; + int current_version; int i; - version = ConfMan.getInt("CE_mapping_version"); - if (version != ACTIONS_VERSION) + current_version = ConfMan.getInt("action_mapping_version", domain()); + if (current_version != version()) return false; - tempo = ConfMan.get("CE_mapping").c_str(); + tempo = ConfMan.get("action_mapping", domain()).c_str(); if (tempo && strlen(tempo)) { - for (i=0; i<ACTION_LAST; i++) { + for (i=0; i<size(); i++) { char x[6]; int j; memset(x, 0, sizeof(x)); @@ -219,45 +116,32 @@ bool CEActions::saveMapping() { char tempo[200]; int i; tempo[0] = '\0'; - ConfMan.set("CE_mapping_version", ACTIONS_VERSION); - for (i=0; i<ACTION_LAST; i++) { + ConfMan.set("action_mapping_version", version(), domain()); + for (i=0; i<size(); i++) { char x[4]; sprintf(x, "%.4x ", _action_mapping[i]); strcat(tempo, x); } - ConfMan.set("CE_mapping", tempo); + ConfMan.set("action_mapping", tempo, domain()); ConfMan.flushToDisk(); return true; } unsigned int CEActions::getMapping(ActionType action) { - return _action_mapping[action - 1]; + return _action_mapping[action]; } void CEActions::setMapping(ActionType action, unsigned int keyCode) { int i; - for (i=0; i<ACTION_LAST; i++) { + for (i=0; i<size(); i++) { if (_action_mapping[i] == keyCode) _action_mapping[i] = 0; } - _action_mapping[action - 1] = keyCode; + _action_mapping[action] = keyCode; } -bool CEActions::needsRightClickMapping() { - if (!_right_click_needed) - return false; - else - return (_action_mapping[ACTION_RIGHTCLICK] == 0); -} - -bool CEActions::needsHideToolbarMapping() { - if (!_hide_toolbar_needed) - return false; - else - return (_action_mapping[ACTION_HIDE] == 0); -} -CEActions *CEActions::_instance = NULL; +CEActions *CEActions::_instance = NULL;
\ No newline at end of file diff --git a/backends/wince/CEActions.h b/backends/wince/CEActions.h index da28e430cc..128af42766 100644 --- a/backends/wince/CEActions.h +++ b/backends/wince/CEActions.h @@ -31,37 +31,25 @@ #include "wince-sdl.h" #include "Key.h" -enum ActionType { - ACTION_NONE = 0, - ACTION_PAUSE, - ACTION_SAVE, - ACTION_QUIT, - ACTION_SKIP, - ACTION_HIDE, - ACTION_KEYBOARD, - ACTION_SOUND, - ACTION_RIGHTCLICK, - ACTION_CURSOR, - ACTION_FREELOOK, - - ACTION_LAST -}; - -#define ACTIONS_VERSION 1 +#define MAX_ACTIONS 20 + +typedef int ActionType; class OSystem_WINCE3; class CEActions { public: static CEActions* Instance(); - static void init(OSystem_WINCE3 *mainSystem, GameDetector &detector); + static void init(GameDetector &detector); + virtual void initInstance(OSystem_WINCE3 *mainSystem); + bool initialized(); // Actions - bool perform(ActionType action); + virtual bool perform(ActionType action, bool pushed = true) = 0; bool isActive(ActionType action); bool isEnabled(ActionType action); - String actionName(ActionType action); - int size(); + virtual String actionName(ActionType action) = 0; + virtual int size() = 0; // Mapping void beginMapping(bool start); @@ -72,22 +60,23 @@ class CEActions { unsigned int getMapping(ActionType action); void setMapping(ActionType action, unsigned int keyCode); - // Utility - bool needsRightClickMapping(); - bool needsHideToolbarMapping(); + // Action domain + virtual String domain() = 0; + virtual int version() = 0; + + virtual ~CEActions(); - ~CEActions(); - private: - CEActions(OSystem_WINCE3 *mainSystem, GameDetector &detector); + protected: + CEActions(GameDetector &detector); static CEActions* _instance; OSystem_WINCE3 *_mainSystem; - Key _key_action[ACTION_LAST]; - bool _action_active[ACTION_LAST]; - bool _action_enabled[ACTION_LAST]; - unsigned int _action_mapping[ACTION_LAST]; + GameDetector *_detector; + Key _key_action[MAX_ACTIONS + 1]; + bool _action_active[MAX_ACTIONS + 1]; + bool _action_enabled[MAX_ACTIONS + 1]; + unsigned int _action_mapping[MAX_ACTIONS + 1]; bool _mapping_active; - bool _right_click_needed; - bool _hide_toolbar_needed; + bool _initialized; }; #endif
\ No newline at end of file diff --git a/backends/wince/CEActionsPocket.cpp b/backends/wince/CEActionsPocket.cpp new file mode 100644 index 0000000000..8ae9c96509 --- /dev/null +++ b/backends/wince/CEActionsPocket.cpp @@ -0,0 +1,218 @@ +/* ScummVM - Scumm Interpreter + * Copyright (C) 2001-2004 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * $Header$ + * + */ + + +#include "stdafx.h" +#include "CEActionsPocket.h" +#include "EventsBuffer.h" + +#include "gui/message.h" + +#include "scumm/scumm.h" + +#include "common/config-manager.h" + +const String pocketActionNames[] = { + "Pause", + "Save", + "Quit", + "Skip", + "Hide", + "Keyboard", + "Sound", + "Right click", + "Cursor", + "Free look", + "Zoom up", + "Zoom down" +}; + +void CEActionsPocket::init(GameDetector &detector) { + _instance = new CEActionsPocket(detector); +} + + +String CEActionsPocket::actionName(ActionType action) { + return pocketActionNames[action]; +} + +int CEActionsPocket::size() { + return POCKET_ACTION_LAST; +} + +String CEActionsPocket::domain() { + return "pocketpc"; +} + +int CEActionsPocket::version() { + return POCKET_ACTION_VERSION; +} + +CEActionsPocket::CEActionsPocket(GameDetector &detector) : + CEActions(detector) +{ + int i; + + _right_click_needed = false; + _hide_toolbar_needed = false; + _zoom_needed = false; + + for (i=0; i<POCKET_ACTION_LAST; i++) { + _action_mapping[i] = 0; + _action_enabled[i] = false; + } + +} + +void CEActionsPocket::initInstance(OSystem_WINCE3 *mainSystem) { + bool is_simon = (strncmp(_detector->_targetName.c_str(), "simon", 5) == 0); + bool is_sword1 = (_detector->_targetName == "sword1"); + bool is_sword2 = (strcmp(_detector->_targetName.c_str(), "sword2") == 0); + bool is_queen = (_detector->_targetName == "queen"); + bool is_sky = (_detector->_targetName == "sky"); + bool is_comi = (strncmp(_detector->_targetName.c_str(), "comi", 4) == 0); + + CEActions::initInstance(mainSystem); + + // See if a right click mapping could be needed + if (is_sword1 || is_sword2 || is_sky || is_queen || is_comi || + _detector->_targetName == "samnmax") + _right_click_needed = true; + + // See if a "hide toolbar" mapping could be needed + if (is_sword1 || is_sword2 || is_comi) + _hide_toolbar_needed = true; + + // Initialize keys for different actions + // Pause + _key_action[POCKET_ACTION_PAUSE].setAscii(VK_SPACE); + _action_enabled[POCKET_ACTION_PAUSE] = true; + // Save + if (is_simon || is_sword2) + _action_enabled[POCKET_ACTION_SAVE] = false; + else + if (is_queen) { + _action_enabled[POCKET_ACTION_SAVE] = true; + _key_action[POCKET_ACTION_SAVE].setAscii(282); // F1 key + } + else + if (is_sky) { + _action_enabled[POCKET_ACTION_SAVE] = true; + _key_action[POCKET_ACTION_SAVE].setAscii(63); + } + else { + _action_enabled[POCKET_ACTION_SAVE] = true; + _key_action[POCKET_ACTION_SAVE].setAscii(319); // F5 key + } + // Quit + _action_enabled[POCKET_ACTION_QUIT] = true; + // Skip + _action_enabled[POCKET_ACTION_SKIP] = true; + if (is_simon || is_sky || is_sword2 || is_queen || is_sword1) + _key_action[POCKET_ACTION_SKIP].setAscii(VK_ESCAPE); + else + _key_action[POCKET_ACTION_SKIP].setAscii(Scumm::KEY_ALL_SKIP); + // Hide + _action_enabled[POCKET_ACTION_HIDE] = true; + // Keyboard + _action_enabled[POCKET_ACTION_KEYBOARD] = true; + // Sound + _action_enabled[POCKET_ACTION_SOUND] = true; + // RightClick + _action_enabled[POCKET_ACTION_RIGHTCLICK] = true; + // Cursor + _action_enabled[POCKET_ACTION_CURSOR] = true; + // Freelook + _action_enabled[POCKET_ACTION_FREELOOK] = true; + // Zoom + if (is_sword1 || is_sword2 || is_comi) { + _zoom_needed = true; + _action_enabled[POCKET_ACTION_ZOOM_UP] = true; + _action_enabled[POCKET_ACTION_ZOOM_DOWN] = true; + } +} + + +CEActionsPocket::~CEActionsPocket() { +} + +bool CEActionsPocket::perform(ActionType action, bool pushed) { + if (!pushed) + return false; + + switch (action) { + case POCKET_ACTION_PAUSE: + case POCKET_ACTION_SAVE: + case POCKET_ACTION_SKIP: + EventsBuffer::simulateKey(&_key_action[action]); + return true; + case POCKET_ACTION_KEYBOARD: + _mainSystem->swap_panel(); + return true; + case POCKET_ACTION_HIDE: + _mainSystem->swap_panel_visibility(); + return true; + case POCKET_ACTION_SOUND: + _mainSystem->swap_sound_master(); + return true; + case POCKET_ACTION_RIGHTCLICK: + _mainSystem->add_right_click(); + return true; + case POCKET_ACTION_CURSOR: + _mainSystem->swap_mouse_visibility(); + return true; + case POCKET_ACTION_ZOOM_UP: + _mainSystem->swap_zoom_up(); + return true; + case POCKET_ACTION_ZOOM_DOWN: + _mainSystem->swap_zoom_down(); + return true; + case POCKET_ACTION_QUIT: + GUI::MessageDialog alert("Do you want to quit ?", "Yes", "No"); + if (alert.runModal() == 1) + _mainSystem->quit(); + return true; + } + return false; +} + +bool CEActionsPocket::needsRightClickMapping() { + if (!_right_click_needed) + return false; + else + return (_action_mapping[POCKET_ACTION_RIGHTCLICK] == 0); +} + +bool CEActionsPocket::needsHideToolbarMapping() { + if (!_hide_toolbar_needed) + return false; + else + return (_action_mapping[POCKET_ACTION_HIDE] == 0); +} + + +bool CEActionsPocket::needsZoomMapping() { + if (!_zoom_needed) + return false; + else + return (_action_mapping[POCKET_ACTION_ZOOM_UP] == 0 || _action_mapping[POCKET_ACTION_ZOOM_DOWN] == 0); +} + diff --git a/backends/wince/CEActionsPocket.h b/backends/wince/CEActionsPocket.h new file mode 100644 index 0000000000..348aba5553 --- /dev/null +++ b/backends/wince/CEActionsPocket.h @@ -0,0 +1,81 @@ +/* ScummVM - Scumm Interpreter + * Copyright (C) 2001-2004 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * $Header$ + * + */ + +#ifndef CEACTIONSPOCKET +#define CEACTIONSPOCKET + +#include "common/stdafx.h" +#include "common/scummsys.h" +#include "common/system.h" + + +#include "base/gameDetector.h" +#include "wince-sdl.h" +#include "Key.h" + +#include "CEActions.h" + +#define POCKET_ACTION_VERSION 3 + +enum pocketActionType { + POCKET_ACTION_PAUSE = 0, + POCKET_ACTION_SAVE, + POCKET_ACTION_QUIT, + POCKET_ACTION_SKIP, + POCKET_ACTION_HIDE, + POCKET_ACTION_KEYBOARD, + POCKET_ACTION_SOUND, + POCKET_ACTION_RIGHTCLICK, + POCKET_ACTION_CURSOR, + POCKET_ACTION_FREELOOK, + POCKET_ACTION_ZOOM_UP, + POCKET_ACTION_ZOOM_DOWN, + + POCKET_ACTION_LAST +}; + +class CEActionsPocket : public CEActions { + public: + // Actions + bool perform(ActionType action, bool pushed = true); + String actionName(ActionType action); + int size(); + static void init(GameDetector &detector); + void initInstance(OSystem_WINCE3 *mainSystem); + + // Action domain + String domain(); + int version(); + + // Utility + bool needsRightClickMapping(); + bool needsHideToolbarMapping(); + bool needsZoomMapping(); + + ~CEActionsPocket(); + private: + CEActionsPocket(GameDetector &detector); + bool _right_click_needed; + bool _hide_toolbar_needed; + bool _zoom_needed; + }; + +#endif
\ No newline at end of file diff --git a/backends/wince/CEActionsSmartphone.cpp b/backends/wince/CEActionsSmartphone.cpp new file mode 100644 index 0000000000..bf5e584412 --- /dev/null +++ b/backends/wince/CEActionsSmartphone.cpp @@ -0,0 +1,173 @@ +/* ScummVM - Scumm Interpreter + * Copyright (C) 2001-2004 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * $Header$ + * + */ + + +#ifdef WIN32_PLATFORM_WFSP + +#include "stdafx.h" +#include "CEActionsPocket.h" +#include "KeysBuffer.h" + +#include "gui/message.h" + +#include "scumm/scumm.h" + +#include "common/config-manager.h" + +const String smartphoneActionNames[] = { + "Up", + "Down", + "Left", + "Right", + "Left Click", + "Right Click", + "Save", + "Skip", + "Zone" +}; + +void CEActionsSmartphone::init(GameDetector &detector) { + _instance = new CEActionsSmartphone(detector); +} + + +String CEActionsSmartphone::actionName(ActionType action) { + return smartphoneActionNames[action]; +} + +int CEActionsSmartphone::size() { + return SMARTPHONE_ACTION_LAST; +} + +String CEActionsSmartphone::domain() { + return "smartphone"; +} + +int CEActionsSmartphone::version() { + return SMARTPHONE_ACTION_VERSION; +} + +CEActionsSmartphone::CEActionsSmartphone(GameDetector &detector) : + CEActions(detector) +{ + int i; + + for (i=0; i<SMARTPHONE_ACTION_LAST; i++) { + _action_mapping[i] = 0; + _action_enabled[i] = false; + } + +} + +void CEActionsSmartphone::initInstance(OSystem_WINCE3 *mainSystem) { +{ + int i; + bool is_simon = (strncmp(_detector->_targetName.c_str(), "simon", 5) == 0); + bool is_sky = (_detector->_targetName == "sky"); + + CEActions::initInstance(mainSystem); + + // See if a right click mapping could be needed + if (is_sky || _detector->_targetName == "samnmax") + _right_click_needed = true; + + // Initialize keys for different actions + // 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[ACTION_RIGHTCLICK] = true; + // Save + if (is_simon) + _action_enabled[SMARTPHONE_ACTION_SAVE] = false; + else + if (is_queen) { + _action_enabled[SMARTPHONE_ACTION_SAVE] = true; + _key_action[SMARTPHONE_ACTION_SAVE].setAscii(282); // F1 key + } + 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) + _key_action[SMARTPHONE_ACTION_SKIP].setAscii(VK_ESCAPE); + else + _key_action[SMARTPHONE_ACTION_SKIP].setAscii(Scumm::KEY_ALL_SKIP); + // Zone + _key_action[SMARTPHONE_ACTION_ZONE] = true; +} + + +CEActionsSmartphone::~CEActionsSmartphone() { +} + +bool CEActionsSmartphone::perform(ActionType action, bool pushed = true) { + if (!pushed) { + _mainSystem->clear_key_repeat(); + return true; + } + + switch (action) { + case SMARTPHONE_ACTION_SAVE: + case SMARTPHONE_ACTION_SKIP: + EventsBuffer::simulateKey(&_key_action[action]); + return true; + case SMARTPHONE_ACTION_RIGHTCLICK: + _mainSystem->add_right_click(); + return true; + case SMARTPHONE_ACTION_LEFTCLICK: + _mainSystem->add_left_click(); + return true; + case SMARTPHONE_ACTION_UP: + _mainSystem->move_cursor_up(); + return true; + case SMARTPHONE_ACTION_DOWN: + _mainSystem->move_cursor_down(); + return true; + case SMARTPHONE_ACTION_LEFT: + _mainSystem->move_cursor_left(); + return true; + case SMARTPHONE_ACTION_RIGHT: + _mainSystem->move_cursor_right(); + return true; + case SMARTPHONE_ACTION_ZONE: + _mainSystem->switch_zone(); + return true; + } + + return false; +} + +#endif diff --git a/backends/wince/CEActionsSmartphone.h b/backends/wince/CEActionsSmartphone.h new file mode 100644 index 0000000000..bbb9d244dc --- /dev/null +++ b/backends/wince/CEActionsSmartphone.h @@ -0,0 +1,75 @@ +/* ScummVM - Scumm Interpreter + * Copyright (C) 2001-2004 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * $Header$ + * + */ + +#ifndef CEACTIONSSMARTPHONE +#define CEACTIONSSMARTPHONE + +#ifdef WIN32_PLATFORM_WFSP + +#include "common/stdafx.h" +#include "common/scummsys.h" +#include "common/system.h" + + +#include "base/gameDetector.h" +#include "wince-sdl.h" +#include "Key.h" + +#include "CEActions.h" + +#define SMARTPHONE_ACTION_VERSION 3 + +enum smartphoneActionType { + SMARTPHONE_ACTION_UP = 0, + SMARTPHONE_ACTION_DOWN, + SMARTPHONE_ACTION_LEFT, + SMARTPHONE_ACTION_RIGHT, + SMARTPHONE_ACTION_LEFTCLICK, + SMARTPHONE_ACTION_RIGHTCLICK, + SMARTPHONE_ACTION_SAVE, + SMARTPHONE_ACTION_SKIP, + SMARTPHONE_ACTION_ZONE, + + SMARTPHONE_ACTION_LAST +}; + + +class CEActionsSmartphone : public CEActions { + public: + // Actions + bool perform(ActionType action, bool pushed = true); + String actionName(ActionType action); + int size(); + static void init(GameDetector &detector); + void initInstance(OSystem_WINCE3 *mainSystem); + + // Action domain + String domain(); + int version(); + + ~CEActionsSmartphone(); + private: + CEActionsSmartphone(GameDetector &detector); + }; + +#endif + +#endif
\ No newline at end of file |