1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-06 12:20:30 +00:00
Conflicts:
	modules/multiscript/register_types.cpp
	platform/android/java/src/com/android/godot/GodotLib.java
This commit is contained in:
Juan Linietsky
2014-03-13 23:14:35 -03:00
24 changed files with 598 additions and 87 deletions

View File

@@ -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);
}

View File

@@ -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();