summaryrefslogtreecommitdiff
path: root/platform/android
diff options
context:
space:
mode:
Diffstat (limited to 'platform/android')
-rw-r--r--platform/android/display_server_android.cpp38
-rw-r--r--platform/android/export/export.cpp28
-rw-r--r--platform/android/java_godot_lib_jni.cpp12
-rw-r--r--platform/android/os_android.cpp2
4 files changed, 49 insertions, 31 deletions
diff --git a/platform/android/display_server_android.cpp b/platform/android/display_server_android.cpp
index 9534387d35..60d10b2457 100644
--- a/platform/android/display_server_android.cpp
+++ b/platform/android/display_server_android.cpp
@@ -424,7 +424,7 @@ DisplayServerAndroid::DisplayServerAndroid(const String &p_rendering_driver, Dis
}
#endif
- InputFilter::get_singleton()->set_event_dispatch_function(_dispatch_input_events);
+ Input::get_singleton()->set_event_dispatch_function(_dispatch_input_events);
}
DisplayServerAndroid::~DisplayServerAndroid() {
@@ -445,16 +445,16 @@ DisplayServerAndroid::~DisplayServerAndroid() {
void DisplayServerAndroid::process_joy_event(DisplayServerAndroid::JoypadEvent p_event) {
switch (p_event.type) {
case JOY_EVENT_BUTTON:
- InputFilter::get_singleton()->joy_button(p_event.device, p_event.index, p_event.pressed);
+ Input::get_singleton()->joy_button(p_event.device, p_event.index, p_event.pressed);
break;
case JOY_EVENT_AXIS:
- InputFilter::JoyAxis value;
+ Input::JoyAxis value;
value.min = -1;
value.value = p_event.value;
- InputFilter::get_singleton()->joy_axis(p_event.device, p_event.index, value);
+ Input::get_singleton()->joy_axis(p_event.device, p_event.index, value);
break;
case JOY_EVENT_HAT:
- InputFilter::get_singleton()->joy_hat(p_event.device, p_event.hat);
+ Input::get_singleton()->joy_hat(p_event.device, p_event.hat);
break;
default:
return;
@@ -484,7 +484,7 @@ void DisplayServerAndroid::process_key_event(int p_keycode, int p_scancode, int
OS_Android::get_singleton()->main_loop_request_go_back();
}
- InputFilter::get_singleton()->parse_input_event(ev);
+ Input::get_singleton()->parse_input_event(ev);
}
void DisplayServerAndroid::process_touch(int p_what, int p_pointer, const Vector<DisplayServerAndroid::TouchPos> &p_points) {
@@ -499,7 +499,7 @@ void DisplayServerAndroid::process_touch(int p_what, int p_pointer, const Vector
ev->set_index(touch[i].id);
ev->set_pressed(false);
ev->set_position(touch[i].pos);
- InputFilter::get_singleton()->parse_input_event(ev);
+ Input::get_singleton()->parse_input_event(ev);
}
}
@@ -517,7 +517,7 @@ void DisplayServerAndroid::process_touch(int p_what, int p_pointer, const Vector
ev->set_index(touch[i].id);
ev->set_pressed(true);
ev->set_position(touch[i].pos);
- InputFilter::get_singleton()->parse_input_event(ev);
+ Input::get_singleton()->parse_input_event(ev);
}
} break;
@@ -545,7 +545,7 @@ void DisplayServerAndroid::process_touch(int p_what, int p_pointer, const Vector
ev->set_index(touch[i].id);
ev->set_position(p_points[idx].pos);
ev->set_relative(p_points[idx].pos - touch[i].pos);
- InputFilter::get_singleton()->parse_input_event(ev);
+ Input::get_singleton()->parse_input_event(ev);
touch.write[i].pos = p_points[idx].pos;
}
@@ -560,7 +560,7 @@ void DisplayServerAndroid::process_touch(int p_what, int p_pointer, const Vector
ev->set_index(touch[i].id);
ev->set_pressed(false);
ev->set_position(touch[i].pos);
- InputFilter::get_singleton()->parse_input_event(ev);
+ Input::get_singleton()->parse_input_event(ev);
}
touch.clear();
}
@@ -577,7 +577,7 @@ void DisplayServerAndroid::process_touch(int p_what, int p_pointer, const Vector
ev->set_index(tp.id);
ev->set_pressed(true);
ev->set_position(tp.pos);
- InputFilter::get_singleton()->parse_input_event(ev);
+ Input::get_singleton()->parse_input_event(ev);
break;
}
@@ -592,7 +592,7 @@ void DisplayServerAndroid::process_touch(int p_what, int p_pointer, const Vector
ev->set_index(touch[i].id);
ev->set_pressed(false);
ev->set_position(touch[i].pos);
- InputFilter::get_singleton()->parse_input_event(ev);
+ Input::get_singleton()->parse_input_event(ev);
touch.remove(i);
break;
@@ -613,7 +613,7 @@ void DisplayServerAndroid::process_hover(int p_type, Point2 p_pos) {
ev->set_position(p_pos);
ev->set_global_position(p_pos);
ev->set_relative(p_pos - hover_prev_pos);
- InputFilter::get_singleton()->parse_input_event(ev);
+ Input::get_singleton()->parse_input_event(ev);
hover_prev_pos = p_pos;
} break;
}
@@ -626,7 +626,7 @@ void DisplayServerAndroid::process_double_tap(Point2 p_pos) {
ev->set_global_position(p_pos);
ev->set_pressed(false);
ev->set_doubleclick(true);
- InputFilter::get_singleton()->parse_input_event(ev);
+ Input::get_singleton()->parse_input_event(ev);
}
void DisplayServerAndroid::process_scroll(Point2 p_pos) {
@@ -634,22 +634,22 @@ void DisplayServerAndroid::process_scroll(Point2 p_pos) {
ev.instance();
ev->set_position(p_pos);
ev->set_delta(p_pos - scroll_prev_pos);
- InputFilter::get_singleton()->parse_input_event(ev);
+ Input::get_singleton()->parse_input_event(ev);
scroll_prev_pos = p_pos;
}
void DisplayServerAndroid::process_accelerometer(const Vector3 &p_accelerometer) {
- InputFilter::get_singleton()->set_accelerometer(p_accelerometer);
+ Input::get_singleton()->set_accelerometer(p_accelerometer);
}
void DisplayServerAndroid::process_gravity(const Vector3 &p_gravity) {
- InputFilter::get_singleton()->set_gravity(p_gravity);
+ Input::get_singleton()->set_gravity(p_gravity);
}
void DisplayServerAndroid::process_magnetometer(const Vector3 &p_magnetometer) {
- InputFilter::get_singleton()->set_magnetometer(p_magnetometer);
+ Input::get_singleton()->set_magnetometer(p_magnetometer);
}
void DisplayServerAndroid::process_gyroscope(const Vector3 &p_gyroscope) {
- InputFilter::get_singleton()->set_gyroscope(p_gyroscope);
+ Input::get_singleton()->set_gyroscope(p_gyroscope);
}
diff --git a/platform/android/export/export.cpp b/platform/android/export/export.cpp
index 71febd3433..d4fc52eaa9 100644
--- a/platform/android/export/export.cpp
+++ b/platform/android/export/export.cpp
@@ -1179,14 +1179,32 @@ class EditorExportPlatformAndroid : public EditorExportPlatform {
static String _parse_string(const uint8_t *p_bytes, bool p_utf8) {
uint32_t offset = 0;
- uint32_t len = decode_uint16(&p_bytes[offset]);
+ uint32_t len = 0;
if (p_utf8) {
- //don't know how to read extended utf8, this will have to be for now
- len >>= 8;
+ uint8_t byte = p_bytes[offset];
+ if (byte & 0x80)
+ offset += 2;
+ else
+ offset += 1;
+ byte = p_bytes[offset];
+ offset++;
+ if (byte & 0x80) {
+ len = byte & 0x7F;
+ len = (len << 8) + p_bytes[offset];
+ offset++;
+ } else {
+ len = byte;
+ }
+ } else {
+ len = decode_uint16(&p_bytes[offset]);
+ offset += 2;
+ if (len & 0x8000) {
+ len &= 0x7FFF;
+ len = (len << 16) + decode_uint16(&p_bytes[offset]);
+ offset += 2;
+ }
}
- offset += 2;
- //printf("len %i, unicode: %i\n",len,int(p_utf8));
if (p_utf8) {
diff --git a/platform/android/java_godot_lib_jni.cpp b/platform/android/java_godot_lib_jni.cpp
index 8b38113e09..a6730903cc 100644
--- a/platform/android/java_godot_lib_jni.cpp
+++ b/platform/android/java_godot_lib_jni.cpp
@@ -38,7 +38,7 @@
#include "api/jni_singleton.h"
#include "audio_driver_jandroid.h"
#include "core/engine.h"
-#include "core/input/input_filter.h"
+#include "core/input/input.h"
#include "core/project_settings.h"
#include "dir_access_jandroid.h"
#include "display_server_android.h"
@@ -311,15 +311,15 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_joyhat(JNIEnv *env, j
int hat = 0;
if (p_hat_x != 0) {
if (p_hat_x < 0)
- hat |= InputFilter::HAT_MASK_LEFT;
+ hat |= Input::HAT_MASK_LEFT;
else
- hat |= InputFilter::HAT_MASK_RIGHT;
+ hat |= Input::HAT_MASK_RIGHT;
}
if (p_hat_y != 0) {
if (p_hat_y < 0)
- hat |= InputFilter::HAT_MASK_UP;
+ hat |= Input::HAT_MASK_UP;
else
- hat |= InputFilter::HAT_MASK_DOWN;
+ hat |= Input::HAT_MASK_DOWN;
}
jevent.hat = hat;
@@ -329,7 +329,7 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_joyhat(JNIEnv *env, j
JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_joyconnectionchanged(JNIEnv *env, jclass clazz, jint p_device, jboolean p_connected, jstring p_name) {
if (os_android) {
String name = jstring_to_string(p_name, env);
- InputFilter::get_singleton()->joy_connection_changed(p_device, p_connected, name);
+ Input::get_singleton()->joy_connection_changed(p_device, p_connected, name);
}
}
diff --git a/platform/android/os_android.cpp b/platform/android/os_android.cpp
index 760157595c..9ae18415ba 100644
--- a/platform/android/os_android.cpp
+++ b/platform/android/os_android.cpp
@@ -88,7 +88,7 @@ void OS_Android::initialize() {
}
void OS_Android::initialize_joypads() {
- InputFilter::get_singleton()->set_fallback_mapping(godot_java->get_input_fallback_mapping());
+ Input::get_singleton()->set_fallback_mapping(godot_java->get_input_fallback_mapping());
// This queries/updates the currently connected devices/joypads.
godot_java->init_input_devices();