aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Bacca2004-12-23 01:15:27 +0000
committerNicolas Bacca2004-12-23 01:15:27 +0000
commitb4e9a4b92f971d74895473c9f6825ba3f6e24962 (patch)
treef475ea4dc2edb18e2ce85ffe0bc65bd68fd38af8
parent9942dc55d0891be4c5398c713278b884f1fda16e (diff)
downloadscummvm-rg350-b4e9a4b92f971d74895473c9f6825ba3f6e24962.tar.gz
scummvm-rg350-b4e9a4b92f971d74895473c9f6825ba3f6e24962.tar.bz2
scummvm-rg350-b4e9a4b92f971d74895473c9f6825ba3f6e24962.zip
Add Zone key support for Smartphones. Last commit for today
svn-id: r16266
-rw-r--r--backends/wince/wince-sdl.cpp32
-rw-r--r--backends/wince/wince-sdl.h18
2 files changed, 50 insertions, 0 deletions
diff --git a/backends/wince/wince-sdl.cpp b/backends/wince/wince-sdl.cpp
index 4edf203d03..19749c40e6 100644
--- a/backends/wince/wince-sdl.cpp
+++ b/backends/wince/wince-sdl.cpp
@@ -340,6 +340,16 @@ void OSystem_WINCE3::swap_zoom_down() {
//#ifdef WIN32_PLATFORM_WFSP
// Smartphone actions
+void OSystem_WINCE3::initZones() {
+ int i;
+
+ _currentZone = 0;
+ for (i=0; i<TOTAL_ZONES; i++) {
+ _mouseXZone[i] = _zones[i].x + (_zones[i].width / 2);
+ _mouseYZone[i] = _zones[i].y + (_zones[i].height / 2);
+ }
+}
+
void OSystem_WINCE3::loadSmartphoneConfigurationElement(String element, int &value, int defaultValue) {
value = ConfMan.getInt(element, "smartphone");
if (!value) {
@@ -436,6 +446,23 @@ void OSystem_WINCE3::move_cursor_right() {
}
void OSystem_WINCE3::switch_zone() {
+ int x,y;
+ int i;
+ retrieve_mouse_location(x, y);
+
+ for (i=0; i<TOTAL_ZONES; i++)
+ if (x >= _zones[i].x && y >= _zones[i].y &&
+ x <= _zones[i].x + _zones[i].width && y <= _zones[i].y + _zones[i].height
+ ) {
+ _mouseXZone[i] = x;
+ _mouseYZone[i] = y;
+ break;
+ }
+ _currentZone++;
+ if (_currentZone >= TOTAL_ZONES)
+ _currentZone = 0;
+
+ EventsBuffer::simulateMouseMove(_mouseXZone[_currentZone], _mouseYZone[_currentZone]);
}
//#endif
@@ -1600,3 +1627,8 @@ void OSystem_WINCE3::quit() {
int OSystem_WINCE3::_platformScreenWidth;
int OSystem_WINCE3::_platformScreenHeight;
bool OSystem_WINCE3::_isOzone;
+OSystem_WINCE3::zoneDesc OSystem_WINCE3::_zones[TOTAL_ZONES] = {
+ { 0, 0, 320, 145 },
+ { 0, 145, 150, 55 },
+ { 150, 145, 170, 55 }
+}; \ No newline at end of file
diff --git a/backends/wince/wince-sdl.h b/backends/wince/wince-sdl.h
index cbc2e6083a..296cc5150b 100644
--- a/backends/wince/wince-sdl.h
+++ b/backends/wince/wince-sdl.h
@@ -36,6 +36,8 @@
#include <SDL.h>
+#define TOTAL_ZONES 3
+
class OSystem_WINCE3 : public OSystem_SDL {
public:
OSystem_WINCE3();
@@ -72,6 +74,7 @@ public:
//#ifdef WIN32_PLATFORM_WFSP
// Smartphone actions
+ void initZones();
void loadSmartphoneConfigurationElement(String element, int &value, int defaultValue);
void loadSmartphoneConfiguration();
void add_left_click(bool pushed);
@@ -181,6 +184,21 @@ private:
int _stepY1; // offset for up and down cursor moves (slowest)
int _stepY2; // offset for up and down cursor moves (faster)
int _stepY3; // offset for up and down cursor moves (fastest)
+
+ int _mouseXZone[TOTAL_ZONES];
+ int _mouseYZone[TOTAL_ZONES];
+ int _currentZone;
+
+ typedef struct zoneDesc {
+ int x;
+ int y;
+ int width;
+ int height;
+ } zoneDesc;
+
+ static zoneDesc _zones[TOTAL_ZONES];
+
+
};
#endif