Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean-up and refactor of the Android input implementation #65434

Merged
merged 2 commits into from
Sep 8, 2022

Conversation

m4gr3d
Copy link
Contributor

@m4gr3d m4gr3d commented Sep 6, 2022

The first commit cleans up and refactors the Android input implementation:

  • All input logic is delegated to the GodotInputHandler.java class which is now responsible for setting up and configuring the gesture handler logic
  • The mouse & touch input logic has been refactored to rely primarily on the gesture handler
  • The gesture handler logic was updated to include support for long press, multi-finger panning and scaling gestures. These gestures are disabled by default to mirror the current behavior
  • The native input implementation was cleaned up to consolidate the logic in a few methods: process_touch_event for touch, process_mouse_event for mouse & stylus, and process_magnify and process_pan for scaling and panning gestures.

In the process, the PR addresses several existing Android input bugs:
Fixes #8151, fixes #46100, fixes #46101

Supersedes #59760, #54225

The second commit enables the long press, multi-finger panning and scaling gestures for the Godot Android Editor and fixes an input related bug that uses to cause a crash when clicking on the play button from the editor window.

Addresses some of the issues reported in godotengine/godot-proposals#3931

godot_android_editor_multi_touch_pixel5.mp4

3.x version

Copy link
Contributor

@thebestnom thebestnom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really clean overall, love it!

@madmiraal
Copy link
Contributor

This should be backed up by a proposal, because it directly conflicts with the approach suggested in godotengine/godot-proposals#4340.

@m4gr3d m4gr3d force-pushed the cleanup_input_logic_main branch from f07a40a to 696bb6d Compare September 7, 2022 08:15
@m4gr3d m4gr3d force-pushed the cleanup_input_logic_main branch from 696bb6d to c3c0bea Compare September 7, 2022 20:30
@akien-mga akien-mga merged commit 83df155 into godotengine:master Sep 8, 2022
@akien-mga
Copy link
Member

Thanks!

@m4gr3d m4gr3d deleted the cleanup_input_logic_main branch September 8, 2022 07:19
@Chikiak
Copy link

Chikiak commented Sep 9, 2022

I'm new to github, how can I use this?

@Calinou
Copy link
Member

Calinou commented Sep 9, 2022

I'm new to github, how can I use this?

You could compile the Android editor from source, but it's not trivial and not well-documented right now. If you don't feel like compiling from source, wait for 3.6beta1 to be released.

@ygingras
Copy link

This is really interesting! Has it made it into 4-beta10? I can't seem to produce any of those gesture with my Android builds.

@m4gr3d
Copy link
Contributor Author

m4gr3d commented Dec 31, 2022

This is really interesting! Has it made it into 4-beta10? I can't seem to produce any of those gesture with my Android builds.

@ygingras The logic to enable the gestures is not yet exposed to gdscript in order to allow the functionality to stabilize (since it was a fairly large rewrite to the Android input logic).

At the moment enabling them requires rebuilding the engine (see here for reference).

Once the logic is stabilized, we'll make it configurable through gdscript.

@ygingras
Copy link

ygingras commented Jan 1, 2023

Got it! Is there an issue or another source of info that I can follow to know when this is ready for consumption in GDScript? I might try the engine rebuild if this is scheduled passed 4.1, but otherwise, I will probably wait patiently.

@m4gr3d
Copy link
Contributor Author

m4gr3d commented Oct 11, 2023

Got it! Is there an issue or another source of info that I can follow to know when this is ready for consumption in GDScript? I might try the engine rebuild if this is scheduled passed 4.1, but otherwise, I will probably wait patiently.

@ygingras The following project settings were added in Godot 4.2 beta to enable gestures on Android:

Screenshot 2023-10-11 at 10 01 07 AM

@ygingras
Copy link

Great! I can't wait to give those a try.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment