diff options
| author | Marcus Comstedt | 2013-08-08 14:53:36 +0200 |
|---|---|---|
| committer | Marcus Comstedt | 2013-08-08 14:53:36 +0200 |
| commit | a50ede203b0424d800d2a1d4460121f9f1de8e7a (patch) | |
| tree | 0d3fd31307258ca481d37c956415f74525a94265 /backends/platform/android/events.cpp | |
| parent | 1b69f8aedee240af79ea871c32a9caadc6a0dd98 (diff) | |
| download | scummvm-rg350-a50ede203b0424d800d2a1d4460121f9f1de8e7a.tar.gz scummvm-rg350-a50ede203b0424d800d2a1d4460121f9f1de8e7a.tar.bz2 scummvm-rg350-a50ede203b0424d800d2a1d4460121f9f1de8e7a.zip | |
ANDROID: Add support for joystick motion
Diffstat (limited to 'backends/platform/android/events.cpp')
| -rw-r--r-- | backends/platform/android/events.cpp | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/backends/platform/android/events.cpp b/backends/platform/android/events.cpp index 5ad9ed825c..4d7ef9caf2 100644 --- a/backends/platform/android/events.cpp +++ b/backends/platform/android/events.cpp @@ -65,6 +65,7 @@ enum { JE_RMB_UP = 12, JE_MOUSE_MOVE = 13, JE_GAMEPAD = 14, + JE_JOYSTICK = 15, JE_QUIT = 0x1000 }; @@ -896,6 +897,31 @@ void OSystem_Android::pushEvent(int type, int arg1, int arg2, int arg3, break; + case JE_JOYSTICK: + e.mouse = getEventManager()->getMousePos(); + + switch (arg1) { + case JACTION_MULTIPLE: + e.type = Common::EVENT_MOUSEMOVE; + + // already multiplied by 100 + e.mouse.x += arg2 * _joystick_scale / _eventScaleX; + e.mouse.y += arg3 * _joystick_scale / _eventScaleY; + + clipMouse(e.mouse); + + break; + default: + LOGE("unhandled jaction on joystick: %d", arg1); + return; + } + + lockMutex(_event_queue_lock); + _event_queue.push(e); + unlockMutex(_event_queue_lock); + + return; + case JE_QUIT: e.type = Common::EVENT_QUIT; |
