1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-05 12:10:55 +00:00

Add double_tap attribute to InputEventScreenTouch

This provides parity with the `InputEventMouseButton` allowing for proper conversion between the two events.
This commit is contained in:
Fredia Huya-Kouadio
2022-10-18 20:03:31 -07:00
parent 2342f174a4
commit be4b07c3e4
12 changed files with 54 additions and 43 deletions

View File

@@ -100,7 +100,7 @@ void AndroidInputHandler::process_key_event(int p_scancode, int p_physical_scanc
input->parse_input_event(ev);
}
void AndroidInputHandler::_parse_all_touch(bool p_pressed) {
void AndroidInputHandler::_parse_all_touch(bool p_pressed, bool p_double_tap) {
if (touch.size()) {
//end all if exist
for (int i = 0; i < touch.size(); i++) {
@@ -109,17 +109,18 @@ void AndroidInputHandler::_parse_all_touch(bool p_pressed) {
ev->set_index(touch[i].id);
ev->set_pressed(p_pressed);
ev->set_position(touch[i].pos);
ev->set_double_tap(p_double_tap);
input->parse_input_event(ev);
}
}
}
void AndroidInputHandler::_release_all_touch() {
_parse_all_touch(false);
_parse_all_touch(false, false);
touch.clear();
}
void AndroidInputHandler::process_touch_event(int p_event, int p_pointer, const Vector<TouchPos> &p_points) {
void AndroidInputHandler::process_touch_event(int p_event, int p_pointer, const Vector<TouchPos> &p_points, bool p_double_tap) {
switch (p_event) {
case AMOTION_EVENT_ACTION_DOWN: { //gesture begin
// Release any remaining touches or mouse event
@@ -133,7 +134,7 @@ void AndroidInputHandler::process_touch_event(int p_event, int p_pointer, const
}
//send touch
_parse_all_touch(true);
_parse_all_touch(true, p_double_tap);
} break;
case AMOTION_EVENT_ACTION_MOVE: { //motion