aboutsummaryrefslogtreecommitdiff
path: root/backends/platform/android/org
diff options
context:
space:
mode:
authorMarcus Comstedt2013-08-08 14:53:36 +0200
committerMarcus Comstedt2013-08-08 14:53:36 +0200
commita50ede203b0424d800d2a1d4460121f9f1de8e7a (patch)
tree0d3fd31307258ca481d37c956415f74525a94265 /backends/platform/android/org
parent1b69f8aedee240af79ea871c32a9caadc6a0dd98 (diff)
downloadscummvm-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/org')
-rw-r--r--backends/platform/android/org/scummvm/scummvm/ScummVMActivity.java8
-rw-r--r--backends/platform/android/org/scummvm/scummvm/ScummVMEvents.java14
2 files changed, 22 insertions, 0 deletions
diff --git a/backends/platform/android/org/scummvm/scummvm/ScummVMActivity.java b/backends/platform/android/org/scummvm/scummvm/ScummVMActivity.java
index 829a948435..5d041dafd2 100644
--- a/backends/platform/android/org/scummvm/scummvm/ScummVMActivity.java
+++ b/backends/platform/android/org/scummvm/scummvm/ScummVMActivity.java
@@ -240,6 +240,14 @@ public class ScummVMActivity extends Activity {
return false;
}
+ @Override
+ public boolean onGenericMotionEvent(final MotionEvent e) {
+ if (_events != null)
+ return _events.onGenericMotionEvent(e);
+
+ return false;
+ }
+
private void showKeyboard(boolean show) {
SurfaceView main_surface = (SurfaceView)findViewById(R.id.main_surface);
InputMethodManager imm = (InputMethodManager)
diff --git a/backends/platform/android/org/scummvm/scummvm/ScummVMEvents.java b/backends/platform/android/org/scummvm/scummvm/ScummVMEvents.java
index 9278e7ff1c..21f177f0c7 100644
--- a/backends/platform/android/org/scummvm/scummvm/ScummVMEvents.java
+++ b/backends/platform/android/org/scummvm/scummvm/ScummVMEvents.java
@@ -9,6 +9,7 @@ import android.view.MotionEvent;
import android.view.View;
import android.view.ViewConfiguration;
import android.view.GestureDetector;
+import android.view.InputDevice;
import android.view.inputmethod.InputMethodManager;
public class ScummVMEvents implements
@@ -32,6 +33,7 @@ public class ScummVMEvents implements
public static final int JE_RMB_UP = 12;
public static final int JE_MOUSE_MOVE = 13;
public static final int JE_GAMEPAD = 14;
+ public static final int JE_JOYSTICK = 15;
public static final int JE_QUIT = 0x1000;
final protected Context _context;
@@ -64,6 +66,18 @@ public class ScummVMEvents implements
return true;
}
+ public boolean onGenericMotionEvent(final MotionEvent e) {
+ if((e.getSource() & InputDevice.SOURCE_CLASS_JOYSTICK) != 0) {
+ _scummvm.pushEvent(JE_JOYSTICK, e.getAction(),
+ (int)(e.getAxisValue(MotionEvent.AXIS_X)*100),
+ (int)(e.getAxisValue(MotionEvent.AXIS_Y)*100),
+ 0, 0);
+ return true;
+ }
+
+ return false;
+ }
+
final static int MSG_MENU_LONG_PRESS = 1;
final private Handler keyHandler = new Handler() {