summaryrefslogtreecommitdiff
path: root/platform/android/java/src/com
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2014-03-13 23:14:35 -0300
committerJuan Linietsky <reduzio@gmail.com>2014-03-13 23:14:35 -0300
commit0a717ffee270b3d2761aaae6a42c06d999a5b823 (patch)
treea52dd64a8c76e24f4734f917af3a124f4dea6d4b /platform/android/java/src/com
parent31ce3c5fd0300aac1e86bced1efc5f9ec94bdb6b (diff)
parent81757d2e977d959e6b0bc26f9fa990417ca91de9 (diff)
Merge branch 'master' of https://github.com/okamstudio/godot
Conflicts: modules/multiscript/register_types.cpp platform/android/java/src/com/android/godot/GodotLib.java
Diffstat (limited to 'platform/android/java/src/com')
-rw-r--r--platform/android/java/src/com/android/godot/Godot.java35
-rw-r--r--platform/android/java/src/com/android/godot/GodotLib.java4
2 files changed, 37 insertions, 2 deletions
diff --git a/platform/android/java/src/com/android/godot/Godot.java b/platform/android/java/src/com/android/godot/Godot.java
index 9868e62957..276ba63b29 100644
--- a/platform/android/java/src/com/android/godot/Godot.java
+++ b/platform/android/java/src/com/android/godot/Godot.java
@@ -303,13 +303,44 @@ public class Godot extends Activity implements SensorEventListener
return true;
}
+ @Override public boolean onKeyMultiple(final int inKeyCode, int repeatCount, KeyEvent event) {
+ String s = event.getCharacters();
+ if (s == null || s.length() == 0)
+ return super.onKeyMultiple(inKeyCode, repeatCount, event);
+
+ final char[] cc = s.toCharArray();
+ int cnt = 0;
+ for (int i = cc.length; --i >= 0; cnt += cc[i] != 0 ? 1 : 0);
+ if (cnt == 0) return super.onKeyMultiple(inKeyCode, repeatCount, event);
+ final Activity me = this;
+ queueEvent(new Runnable() {
+ // This method will be called on the rendering thread:
+ public void run() {
+ for (int i = 0, n = cc.length; i < n; i++) {
+ int keyCode;
+ if ((keyCode = cc[i]) != 0) {
+ // Simulate key down and up...
+ GodotLib.key(0, keyCode, true);
+ GodotLib.key(0, keyCode, false);
+ }
+ }
+ }
+ });
+ return true;
+ }
+
+ private void queueEvent(Runnable runnable) {
+ // TODO Auto-generated method stub
+
+ }
+
@Override public boolean onKeyUp(int keyCode, KeyEvent event) {
- GodotLib.key(event.getUnicodeChar(0), false);
+ GodotLib.key(keyCode, event.getUnicodeChar(0), false);
return super.onKeyUp(keyCode, event);
};
@Override public boolean onKeyDown(int keyCode, KeyEvent event) {
- GodotLib.key(event.getUnicodeChar(0), true);
+ GodotLib.key(keyCode, event.getUnicodeChar(0), true);
return super.onKeyDown(keyCode, event);
}
diff --git a/platform/android/java/src/com/android/godot/GodotLib.java b/platform/android/java/src/com/android/godot/GodotLib.java
index ffa3f306f1..e496d81356 100644
--- a/platform/android/java/src/com/android/godot/GodotLib.java
+++ b/platform/android/java/src/com/android/godot/GodotLib.java
@@ -51,7 +51,11 @@ public class GodotLib {
public static native void step();
public static native void touch(int what,int pointer,int howmany, int[] arr);
public static native void accelerometer(float x, float y, float z);
+<<<<<<< HEAD
public static native void key(int p_unicode_char, boolean p_pressed);
+=======
+ public static native void key(int p_scancode, int p_unicode_char, boolean p_pressed);
+>>>>>>> 81757d2e977d959e6b0bc26f9fa990417ca91de9
public static native void focusin();
public static native void focusout();
public static native void audio();