diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2019-10-08 10:05:39 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-10-08 10:05:39 +0200 |
commit | 98497ff71928daff6afb393b26e230e28bf18e3e (patch) | |
tree | 717b14d4fa32e718773521ad941e25bb63cb885a /platform/android/os_android.cpp | |
parent | 02d75f99b96e5d060b537863644c9b6679737b49 (diff) | |
parent | db582a2c8cc0bf7d237a973f17ad099fdf424859 (diff) |
Merge pull request #21621 from AlexHolly/android-pen-hover-support
Adds Pen support for Android
Diffstat (limited to 'platform/android/os_android.cpp')
-rw-r--r-- | platform/android/os_android.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/platform/android/os_android.cpp b/platform/android/os_android.cpp index 49ab0ea84a..91bd6cbdd2 100644 --- a/platform/android/os_android.cpp +++ b/platform/android/os_android.cpp @@ -477,6 +477,23 @@ void OS_Android::process_touch(int p_what, int p_pointer, const Vector<TouchPos> } } +void OS_Android::process_hover(int p_type, Point2 p_pos) { + // https://developer.android.com/reference/android/view/MotionEvent.html#ACTION_HOVER_ENTER + switch (p_type) { + case 7: // hover move + case 9: // hover enter + case 10: { // hover exit + Ref<InputEventMouseMotion> ev; + ev.instance(); + ev->set_position(p_pos); + ev->set_global_position(p_pos); + ev->set_relative(p_pos - hover_prev_pos); + input->parse_input_event(ev); + hover_prev_pos = p_pos; + } break; + } +} + void OS_Android::process_accelerometer(const Vector3 &p_accelerometer) { input->set_accelerometer(p_accelerometer); |