diff options
author | John Willis | 2010-10-12 07:50:33 +0000 |
---|---|---|
committer | John Willis | 2010-10-12 07:50:33 +0000 |
commit | 4f4ade6276d3b3263b5f62534da4d208bbd5ca1f (patch) | |
tree | b787574f2e93e24cde9680acf92ecd2f69731fa3 /backends/platform/openpandora | |
parent | 54b2a8c98df204dfe64a27fc830936ec62e3f9ed (diff) | |
download | scummvm-rg350-4f4ade6276d3b3263b5f62534da4d208bbd5ca1f.tar.gz scummvm-rg350-4f4ade6276d3b3263b5f62534da4d208bbd5ca1f.tar.bz2 scummvm-rg350-4f4ade6276d3b3263b5f62534da4d208bbd5ca1f.zip |
OPENPANDORA: Add latest backend code from branch-1-2-0.
* Ooops, forgot to sync this with HEAD. Sorry about that.
svn-id: r53162
Diffstat (limited to 'backends/platform/openpandora')
-rwxr-xr-x | backends/platform/openpandora/build/README-OPENPANDORA | 127 | ||||
-rwxr-xr-x | backends/platform/openpandora/build/runscummvm.sh | 2 | ||||
-rwxr-xr-x | backends/platform/openpandora/module.mk | 1 | ||||
-rwxr-xr-x | backends/platform/openpandora/op-events.cpp | 204 | ||||
-rwxr-xr-x | backends/platform/openpandora/op-graphics.cpp | 12 | ||||
-rwxr-xr-x | backends/platform/openpandora/op-main.cpp | 117 | ||||
-rwxr-xr-x | backends/platform/openpandora/op-options.cpp | 56 | ||||
-rwxr-xr-x | backends/platform/openpandora/op-options.h | 42 | ||||
-rwxr-xr-x | backends/platform/openpandora/op-sdl.h | 18 |
9 files changed, 303 insertions, 276 deletions
diff --git a/backends/platform/openpandora/build/README-OPENPANDORA b/backends/platform/openpandora/build/README-OPENPANDORA index c909ed56a6..c3aa5e8ea9 100755 --- a/backends/platform/openpandora/build/README-OPENPANDORA +++ b/backends/platform/openpandora/build/README-OPENPANDORA @@ -1,22 +1,5 @@ ScummVM - OPENPANDORA SPECIFIC README - HEAD SVN ------------------------------------------------------------------------ - -Contents: - - * About the backend/port <#About_the_backendport> - * Game compatability <#Game_compatibility> - * Included engines <#Included_engines> - * Supported audio options <#Supported_audio_options> - * Supported cut-scene options <#Supported_cut-scene_options> - * Recent changes <#Recent_changes> - * How to save <#How_to_save> - * Controller mappings <#Controller_mappings> - * Known issues <#Knonw_issues> - * Additional resources/links <#Additional_resourceslinks> - * Credits <#Credits> - ------------------------------------------------------------------------- - Please refer to the: ScummVM Forum: <http://forums.scummvm.org/> @@ -25,116 +8,12 @@ WiKi: <http://wiki.scummvm.org/index.php/OpenPandora> for the most current information on the port and any updates to this documentation. ------------------------------------------------------------------------- -About the backend/port - -This is the readme for the official GP2XWiz ScummVM backend (also known as -the GP2XWiz port). - -This is an SVN test release of ScummVM for the GP2XWiz, it would be -appreciated if this SVN test distribution was not mirrored and that -people be directed to http://scummvm.distant-earth.com/ instead for -updated SVN builds. - -Full supported official releases of the GP2X WIZ ScummVM backend are made in -line with main official releases and are avalalble from the ScummVM -downloads page <http://www.scummvm.org/downloads.php>. - -This build is in an active state of development and as such no -"expected" behavior can be guaranteed ;). - ------------------------------------------------------------------------- -Game compatibility - -For information on the compatability of a specific game please refer to -the GP2XWiz compatability section of the ScummVM WiKi -<http://wiki.scummvm.org/index.php/GP2XWiz#Compatibility_List>. - -Please note the version and date of the ScummVM build you are running -when reviewing the above list. - ------------------------------------------------------------------------- -Supported audio options - -Raw audio. -MP3 audio. -OGG Vorbis audio. - -FLAC audio is currently unsupported. - -For best results use uncompressed audio in games. - ------------------------------------------------------------------------- -How to save - -NOTE: Everything is saved to the SD card, saves are stored in the saves -folder under your main ScummVM executable unless you set another save -location. - -The configiration file for ScummVM (.scummvmrc) is stored in the same -place as the ScummVM executable. - -The save process below is for Scumm engine games but the principle is -the same for all. - -In Game. - -1. Menu Button -2. Select SAVE with B -3. Select a position with B -4. Right trigger puts 0 in the name box for some text. -5. Press B to save - -Basically the emulated keys you can use are equivelent to the values -buttons are mapped to, - ------------------------------------------------------------------------- -Controller mappings - -Touch screen: -Touch: Move Pointer and Left click - -Mouse emulation: - -dPad: Move Pointer -B: Left click -X: Right click - -Keyboard emulation: - -Right Trigger: Return -Select: Escape -Y: Space Bar (Pause) -Menu: Game Menu (Save, Load, Quit etc.) -Volume Buttons: Increase and Decrease volume - -Fancy button combos: - -NOTE: To use button combos press and hold the Left Trigger then... - -Right Trigger: Display Virtual Keyboard -Menu: Bring up the Global main menu for ScummVM -Select: Exit ScummVM completely (and gracefully) - ------------------------------------------------------------------------- -Known issues - -No major known issues - ------------------------------------------------------------------------- -Additional resources/links - - * ScummVM WiKi GP2X page <http://wiki.scummvm.org/index.php/GP2X> - * ScummVM forums GP2X forum - <http://forums.scummvm.org/viewforum.php?f=14> - * My own ScummVM page <http://scummvm.distant-earth.com/> (for - SVN/test builds) - * Main ScummVM site <http://www.scummvm.org> (for official supported - release builds) +The wiki includes detailed instructions on how to use the port and +control information. ------------------------------------------------------------------------ Credits Core ScummVM code (c) The ScummVM Team -GP2X Wiz backend (c) John Willis +OpenPandora backend (c) John Willis Detailed (c) information can be found within the source code diff --git a/backends/platform/openpandora/build/runscummvm.sh b/backends/platform/openpandora/build/runscummvm.sh index 0745bb41fd..48d24a2b81 100755 --- a/backends/platform/openpandora/build/runscummvm.sh +++ b/backends/platform/openpandora/build/runscummvm.sh @@ -11,4 +11,4 @@ mkdir saves mkdir runtime cd runtime -../bin/scummvm --fullscreen --gfx-mode=2x --config=scummvmrc --extrapath=../data --savepath=../saves +../bin/scummvm --fullscreen --gfx-mode=2x --config=../scummvm.config diff --git a/backends/platform/openpandora/module.mk b/backends/platform/openpandora/module.mk index 867908c840..1e5f6bcd69 100755 --- a/backends/platform/openpandora/module.mk +++ b/backends/platform/openpandora/module.mk @@ -3,6 +3,7 @@ MODULE := backends/platform/openpandora MODULE_OBJS := \ op-graphics.o \ op-events.o \ + op-options.o \ op-main.o MODULE_DIRS += \ diff --git a/backends/platform/openpandora/op-events.cpp b/backends/platform/openpandora/op-events.cpp index b1caa7bb8a..24283aa8ba 100755 --- a/backends/platform/openpandora/op-events.cpp +++ b/backends/platform/openpandora/op-events.cpp @@ -29,16 +29,104 @@ */ #include "backends/platform/openpandora/op-sdl.h" +#include "backends/platform/openpandora/op-options.h" + +/* Quick default button states for modifiers. */ +int BUTTON_STATE_L = false; + +enum { + /* Touchscreen TapMode */ + TAPMODE_LEFT = 0, + TAPMODE_RIGHT = 1, + TAPMODE_HOVER = 2 +}; + +/* On the OpenPandora by default the ABXY and L/R Trigger buttons are returned by SDL as + (A): SDLK_HOME (B): SDLK_END (X): SDLK_PAGEDOWN (Y): SDLK_PAGEUP (L): SDLK_RSHIFT (R): SDLK_RCTRL +*/ + +bool OSystem_OP::handleKeyDown(SDL_Event &ev, Common::Event &event) { + switch (ev.key.keysym.sym) { + case SDLK_HOME: + event.type = Common::EVENT_LBUTTONDOWN; + fillMouseEvent(event, _km.x, _km.y); + return true; + break; + case SDLK_END: + event.type = Common::EVENT_RBUTTONDOWN; + fillMouseEvent(event, _km.x, _km.y); + return true; + break; + case SDLK_PAGEDOWN: + event.type = Common::EVENT_MAINMENU; + return true; + break; + case SDLK_PAGEUP: + OP::ToggleTapMode(); + if (OP::tapmodeLevel == TAPMODE_LEFT) { + displayMessageOnOSD("Touchscreen 'Tap Mode' - Left Click"); + } else if (OP::tapmodeLevel == TAPMODE_RIGHT) { + displayMessageOnOSD("Touchscreen 'Tap Mode' - Right Click"); + } else if (OP::tapmodeLevel == TAPMODE_HOVER) { + displayMessageOnOSD("Touchscreen 'Tap Mode' - Hover (No Click)"); + } + break; + case SDLK_RSHIFT: + BUTTON_STATE_L = true; + break; + case SDLK_RCTRL: + break; + default: + return OSystem_SDL::handleKeyDown(ev, event); + break; + } + return false; +} + +bool OSystem_OP::handleKeyUp(SDL_Event &ev, Common::Event &event) { + switch (ev.key.keysym.sym) { + case SDLK_HOME: + event.type = Common::EVENT_LBUTTONUP; + fillMouseEvent(event, _km.x, _km.y); + return true; + break; + case SDLK_END: + event.type = Common::EVENT_RBUTTONUP; + fillMouseEvent(event, _km.x, _km.y); + return true; + break; + case SDLK_PAGEDOWN: + event.type = Common::EVENT_MAINMENU; + return true; + break; + case SDLK_PAGEUP: + break; + case SDLK_RSHIFT: + BUTTON_STATE_L = false; + break; + case SDLK_RCTRL: + break; + default: + return OSystem_SDL::handleKeyUp(ev, event); + break; + } + return false; +} + +/* Custom handleMouseButtonDown/handleMouseButtonUp to deal with 'Tap Mode' for the touchscreen */ bool OSystem_OP::handleMouseButtonDown(SDL_Event &ev, Common::Event &event) { if (ev.button.button == SDL_BUTTON_LEFT){ - SDLMod mod=SDL_GetModState(); - if (mod & KMOD_RCTRL) /* KMOD_RCTRL = Right Trigger */ + if (BUTTON_STATE_L == true) /* BUTTON_STATE_L = Left Trigger Held, force Right Click */ event.type = Common::EVENT_RBUTTONDOWN; - else if ( mod & KMOD_RSHIFT) /* KMOD_RSHIFT = Left Trigger */ + else if (OP::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 */ + event.type = Common::EVENT_RBUTTONDOWN; + else if (OP::tapmodeLevel == TAPMODE_HOVER) /* TAPMODE_HOVER = Hover (No Click) Tap Mode */ event.type = Common::EVENT_MOUSEMOVE; else - event.type = Common::EVENT_LBUTTONDOWN; + event.type = Common::EVENT_LBUTTONDOWN; /* For normal mice etc. */ } else if (ev.button.button == SDL_BUTTON_RIGHT) event.type = Common::EVENT_RBUTTONDOWN; @@ -55,10 +143,6 @@ bool OSystem_OP::handleMouseButtonDown(SDL_Event &ev, Common::Event &event) { else return false; - // People can use the touchscreen so may have no mouse motion events between taps. - // Not sure if this fixes anything ;). - // setMousePos(event.mouse.x, event.mouse.y); - fillMouseEvent(event, ev.button.x, ev.button.y); return true; @@ -66,13 +150,16 @@ bool OSystem_OP::handleMouseButtonDown(SDL_Event &ev, Common::Event &event) { bool OSystem_OP::handleMouseButtonUp(SDL_Event &ev, Common::Event &event) { if (ev.button.button == SDL_BUTTON_LEFT){ - SDLMod mod=SDL_GetModState(); - if (mod & KMOD_RCTRL) /* KMOD_RCTRL = Right Trigger */ + if (BUTTON_STATE_L == true) /* BUTTON_STATE_L = Left Trigger Held, force Right Click */ event.type = Common::EVENT_RBUTTONUP; - else if ( mod & KMOD_RSHIFT) /* KMOD_RSHIFT = Left Trigger */ + else if (OP::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 */ + event.type = Common::EVENT_RBUTTONUP; + else if (OP::tapmodeLevel == TAPMODE_HOVER) /* TAPMODE_HOVER = Hover (No Click) Tap Mode */ event.type = Common::EVENT_MOUSEMOVE; else - event.type = Common::EVENT_LBUTTONUP; + event.type = Common::EVENT_LBUTTONUP; /* For normal mice etc. */ } else if (ev.button.button == SDL_BUTTON_RIGHT) event.type = Common::EVENT_RBUTTONUP; @@ -87,96 +174,3 @@ bool OSystem_OP::handleMouseButtonUp(SDL_Event &ev, Common::Event &event) { return true; } - - -bool OSystem_OP::handleMouseMotion(SDL_Event &ev, Common::Event &event) { - event.type = Common::EVENT_MOUSEMOVE; - fillMouseEvent(event, ev.motion.x, ev.motion.y); - - setMousePos(event.mouse.x, event.mouse.y); - return true; -} - -void OSystem_OP::warpMouse(int x, int y) { - if (_mouseCurState.x != x || _mouseCurState.y != y) { - SDL_WarpMouse(x, y); - - // SDL_WarpMouse() generates a mouse movement event, so - // set_mouse_pos() would be called eventually. However, the - // cannon script in CoMI calls this function twice each time - // the cannon is reloaded. Unless we update the mouse position - // immediately the second call is ignored, causing the cannon - // to change its aim. - - setMousePos(x, y); - } -} - -void OSystem_OP::handleKbdMouse() { - uint32 curTime = getMillis(); - if (curTime >= _km.last_time + _km.delay_time) { - _km.last_time = curTime; - if (_km.x_down_count == 1) { - _km.x_down_time = curTime; - _km.x_down_count = 2; - } - if (_km.y_down_count == 1) { - _km.y_down_time = curTime; - _km.y_down_count = 2; - } - - if (_km.x_vel || _km.y_vel) { - if (_km.x_down_count) { - if (curTime > _km.x_down_time + _km.delay_time * 12) { - if (_km.x_vel > 0) - _km.x_vel++; - else - _km.x_vel--; - } else if (curTime > _km.x_down_time + _km.delay_time * 8) { - if (_km.x_vel > 0) - _km.x_vel = 5; - else - _km.x_vel = -5; - } - } - if (_km.y_down_count) { - if (curTime > _km.y_down_time + _km.delay_time * 12) { - if (_km.y_vel > 0) - _km.y_vel++; - else - _km.y_vel--; - } else if (curTime > _km.y_down_time + _km.delay_time * 8) { - if (_km.y_vel > 0) - _km.y_vel = 5; - else - _km.y_vel = -5; - } - } - - _km.x += _km.x_vel; - _km.y += _km.y_vel; - - if (_km.x < 0) { - _km.x = 0; - _km.x_vel = -1; - _km.x_down_count = 1; - } else if (_km.x > _km.x_max) { - _km.x = _km.x_max; - _km.x_vel = 1; - _km.x_down_count = 1; - } - - if (_km.y < 0) { - _km.y = 0; - _km.y_vel = -1; - _km.y_down_count = 1; - } else if (_km.y > _km.y_max) { - _km.y = _km.y_max; - _km.y_vel = 1; - _km.y_down_count = 1; - } - - warpMouse((Uint16)_km.x, (Uint16)_km.y); - } - } -} diff --git a/backends/platform/openpandora/op-graphics.cpp b/backends/platform/openpandora/op-graphics.cpp index 4abe034ae4..ef95f52e99 100755 --- a/backends/platform/openpandora/op-graphics.cpp +++ b/backends/platform/openpandora/op-graphics.cpp @@ -24,9 +24,19 @@ */ #include "backends/platform/openpandora/op-sdl.h" +#include "common/mutex.h" +#include "common/translation.h" +#include "common/util.h" + +#include "graphics/scaler/aspect.h" +#include "graphics/surface.h" bool OSystem_OP::loadGFXMode() { - _videoMode.overlayWidth = 800; + /* FIXME: For now we just cheat and set the overlay to 640*480 not 800*480 and let SDL + deal with the boarders (it saves cleaning up the overlay when the game screen is + smaller than the overlay ;) + */ + _videoMode.overlayWidth = 640; _videoMode.overlayHeight = 480; _videoMode.fullscreen = true; diff --git a/backends/platform/openpandora/op-main.cpp b/backends/platform/openpandora/op-main.cpp index a6f20369af..4febd404c3 100755 --- a/backends/platform/openpandora/op-main.cpp +++ b/backends/platform/openpandora/op-main.cpp @@ -55,8 +55,9 @@ /* Dump console info to files. */ #define DUMP_STDOUT -int main(int argc, char *argv[]) { +static SDL_Cursor *hiddenCursor; +int main(int argc, char *argv[]) { g_system = new OSystem_OP(); assert(g_system); @@ -71,15 +72,39 @@ int main(int argc, char *argv[]) { return res; } +static Uint32 timer_handler(Uint32 interval, void *param) { + ((DefaultTimerManager *)param)->handler(); + return interval; +} + void OSystem_OP::initBackend() { + assert(!_inited); + + uint8_t hiddenCursorData = 0; + + int joystick_num = ConfMan.getInt("joystick_num"); + uint32 sdlFlags = SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_TIMER; + + if (ConfMan.hasKey("disable_sdl_parachute")) + sdlFlags |= SDL_INIT_NOPARACHUTE; + + if (joystick_num > -1) + sdlFlags |= SDL_INIT_JOYSTICK; + + if (SDL_Init(sdlFlags) == -1) { + error("Could not initialize SDL: %s", SDL_GetError()); + } + + hiddenCursor = SDL_CreateCursor(&hiddenCursorData, &hiddenCursorData, 8, 1, 0, 0); + /* Setup default save path to be workingdir/saves */ char savePath[PATH_MAX+1]; char workDirName[PATH_MAX+1]; if (getcwd(workDirName, PATH_MAX) == NULL) { - error("Could not obtain current working directory"); + error("Could not obtain current working directory."); } else { printf("Current working directory: %s\n", workDirName); } @@ -103,8 +128,8 @@ void OSystem_OP::initBackend() { strcpy(STDOUT_FILE, workDirName); strcpy(STDERR_FILE, workDirName); - strcat(STDOUT_FILE, "/../scummvm.stdout.txt"); - strcat(STDERR_FILE, "/../scummvm.stderr.txt"); + strcat(STDOUT_FILE, "/scummvm.stdout.txt"); + strcat(STDERR_FILE, "/scummvm.stderr.txt"); // Flush the output in case anything is queued fclose(stdout); @@ -142,60 +167,94 @@ void OSystem_OP::initBackend() { /* Trigger autosave every 4 minutes. */ ConfMan.registerDefault("autosave_period", 4 * 60); + ConfMan.registerDefault("fullscreen", true); + /* Make sure that aspect ratio correction is enabled on the 1st run to stop users asking me what the 'wasted space' at the bottom is ;-). */ ConfMan.registerDefault("aspect_ratio", true); - /* Make sure that aspect ratio correction is enabled on the 1st run to stop - users asking me what the 'wasted space' at the bottom is ;-). */ - ConfMan.registerDefault("desired_screen_aspect_ratio", "5/4" ); - /* Make sure SDL knows that we have a joystick we want to use. */ ConfMan.setInt("joystick_num", 0); - printf("%s\n", "Passing to OSystem::SDL initBackend."); + _graphicsMutex = createMutex(); + + /* On the OpenPandora we need to work around an SDL assumption that + returns relative mouse coordinates when you get to the screen + edges using the touchscreen. The workaround is to set a blank + SDL cursor and not disable it (Hackish I know). + + The root issues likes in the Windows Manager GRAB code in SDL. + That is why the issue is not seen on framebuffer devices like the + GP2X (there is no X window manager ;)). + */ + SDL_ShowCursor(SDL_ENABLE); + SDL_SetCursor(hiddenCursor); - /* Pass to SDL backend to do the heavy lifting */ - OSystem_SDL::initBackend(); + // Enable unicode support if possible + SDL_EnableUNICODE(1); + + memset(&_oldVideoMode, 0, sizeof(_oldVideoMode)); + memset(&_videoMode, 0, sizeof(_videoMode)); + memset(&_transactionDetails, 0, sizeof(_transactionDetails)); + + _videoMode.mode = GFX_DOUBLESIZE; + _videoMode.scaleFactor = 2; + _videoMode.aspectRatioCorrection = ConfMan.getBool("aspect_ratio"); + _scalerProc = Normal2x; + _scalerType = 0; + + _videoMode.fullscreen = true; + + // enable joystick + if (joystick_num > -1 && SDL_NumJoysticks() > 0) { + printf("Using joystick: %s\n", SDL_JoystickName(0)); + _joystick = SDL_JoystickOpen(joystick_num); + } + + setupMixer(); + + // Note: We could implement a custom SDLTimerManager by using + // SDL_AddTimer. That might yield better timer resolution, but it would + // also change the semantics of a timer: Right now, ScummVM timers + // *never* run in parallel, due to the way they are implemented. If we + // switched to SDL_AddTimer, each timer might run in a separate thread. + // However, not all our code is prepared for that, so we can't just + // switch. Still, it's a potential future change to keep in mind. + _timer = new DefaultTimerManager(); + _timerID = SDL_AddTimer(10, &timer_handler, _timer); + + // Invoke parent implementation of this method + OSystem::initBackend(); + + _inited = true; } void OSystem_OP::addSysArchivesToSearchSet(Common::SearchSet &s, int priority) { /* Setup default extra data paths for engine data files and plugins */ + char workDirName[PATH_MAX+1]; if (getcwd(workDirName, PATH_MAX) == NULL) { - error("Error: Could not obtain current working directory"); - } - - Common::FSNode workdirNode(workDirName); - if (workdirNode.exists() && workdirNode.isDirectory()) { - s.add("__OPENPANDORA_WORKDIR__", new Common::FSDirectory(workDirName), priority); + error("Error: Could not obtain current working directory."); } char enginedataPath[PATH_MAX+1]; strcpy(enginedataPath, workDirName); - strcat(enginedataPath, "./../data"); + strcat(enginedataPath, "/../data"); + printf("Default engine data directory: %s\n", enginedataPath); Common::FSNode engineNode(enginedataPath); if (engineNode.exists() && engineNode.isDirectory()) { - s.add("__OPENPANDORA_ENGDATA__", new Common::FSDirectory(enginedataPath), priority); - } - - char pluginsPath[PATH_MAX+1]; - - strcpy(pluginsPath, workDirName); - strcat(pluginsPath, "./../plugins"); - - Common::FSNode pluginsNode(pluginsPath); - if (pluginsNode.exists() && pluginsNode.isDirectory()) { - s.add("__OPENPANDORA_PLUGINS__", new Common::FSDirectory(pluginsPath), priority); + s.add("__OP_ENGDATA__", new Common::FSDirectory(enginedataPath), priority); } } void OSystem_OP::quit() { + SDL_FreeCursor(hiddenCursor); + #ifdef DUMP_STDOUT printf("%s\n", "Debug: STDOUT and STDERR text files closed."); fclose(stdout); diff --git a/backends/platform/openpandora/op-options.cpp b/backends/platform/openpandora/op-options.cpp new file mode 100755 index 0000000000..f8711b868a --- /dev/null +++ b/backends/platform/openpandora/op-options.cpp @@ -0,0 +1,56 @@ +/* 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. + * + * $URL$ + * $Id$ + * + */ + +/* + * 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 +}; + +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 OP */ diff --git a/backends/platform/openpandora/op-options.h b/backends/platform/openpandora/op-options.h new file mode 100755 index 0000000000..8c2bb1cc89 --- /dev/null +++ b/backends/platform/openpandora/op-options.h @@ -0,0 +1,42 @@ +/* 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. + * + * $URL$ + * $Id$ + * + */ + +/* + * 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 diff --git a/backends/platform/openpandora/op-sdl.h b/backends/platform/openpandora/op-sdl.h index 5fd9bf4ed4..8561b42498 100755 --- a/backends/platform/openpandora/op-sdl.h +++ b/backends/platform/openpandora/op-sdl.h @@ -40,27 +40,13 @@ public: OSystem_OP() {} /* Events */ + bool handleKeyDown(SDL_Event &ev, Common::Event &event); + bool handleKeyUp(SDL_Event &ev, Common::Event &event); bool handleMouseButtonDown(SDL_Event &ev, Common::Event &event); bool handleMouseButtonUp(SDL_Event &ev, Common::Event &event); - bool handleMouseMotion(SDL_Event &ev, Common::Event &event); - void warpMouse(int, int); - void handleKbdMouse(); /* Graphics */ -// void initSize(uint w, uint h); -// void setGraphicsModeIntern(); -// bool setGraphicsMode(int mode); -// void internUpdateScreen(); -// const OSystem::GraphicsMode *getSupportedGraphicsModes() const; -// bool setGraphicsMode(const char *name); -// int getDefaultGraphicsMode() const; bool loadGFXMode(); -// void drawMouse(); -// void undrawMouse(); -// void showOverlay(); -// void hideOverlay(); - -// void warpMouse(int, int); /* Platform Setup Stuff */ void addSysArchivesToSearchSet(Common::SearchSet &s, int priority); |