-
-
Notifications
You must be signed in to change notification settings - Fork 21.4k
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
[3.x] Add rotary input support for Android platform #88490
[3.x] Add rotary input support for Android platform #88490
Conversation
aae49f4
to
d926eb6
Compare
@@ -352,6 +352,8 @@ protected void onGodotSetupCompleted() { | |||
if (godotHost != null) { | |||
godotHost.onGodotSetupCompleted(); | |||
} | |||
int rotaryInputAxis = java.lang.Integer.parseInt(GodotLib.getGlobal("input_devices/pointing/android/rotary_input_scroll_axis")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you move this below boolean panScaleEnabled = ...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
@@ -352,6 +352,8 @@ protected void onGodotSetupCompleted() { | |||
if (godotHost != null) { | |||
godotHost.onGodotSetupCompleted(); | |||
} | |||
int rotaryInputAxis = java.lang.Integer.parseInt(GodotLib.getGlobal("input_devices/pointing/android/rotary_input_scroll_axis")); | |||
GodotInputHandler.setRotaryInputAxis(rotaryInputAxis); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you move this logic within the runOnUiThread(...
block
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
main/main.cpp
Outdated
GLOBAL_DEF("input_devices/pointing/android/rotary_input_scroll_axis", 1); | ||
ProjectSettings::get_singleton()->set_custom_property_info("input_devices/pointing/android/rotary_input_scroll_axis", | ||
PropertyInfo(Variant::INT, | ||
"input_devices/pointing/android/rotary_input_scroll_axis", | ||
PROPERTY_HINT_ENUM, "Horizontal,Vertical")); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you keep this with the other set of input_devices/pointing/android
settings
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
d926eb6
to
19c85cc
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Third time's the charm
@@ -342,6 +342,8 @@ protected void onGodotSetupCompleted() { | |||
if (inputHandler != null) { | |||
inputHandler.enableLongPress(longPressEnabled); | |||
inputHandler.enablePanningAndScalingGestures(panScaleEnabled); | |||
int rotaryInputAxis = java.lang.Integer.parseInt(GodotLib.getGlobal("input_devices/pointing/android/rotary_input_scroll_axis")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This logic should be outside of the runOnUiThread
block (and below boolean panScaleEnabled = ...
) because the settings are being retrieved on the render thread.
Only the line below should remain within this block.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
@@ -342,6 +342,8 @@ protected void onGodotSetupCompleted() { | |||
if (inputHandler != null) { | |||
inputHandler.enableLongPress(longPressEnabled); | |||
inputHandler.enablePanningAndScalingGestures(panScaleEnabled); | |||
int rotaryInputAxis = java.lang.Integer.parseInt(GodotLib.getGlobal("input_devices/pointing/android/rotary_input_scroll_axis")); | |||
GodotInputHandler.setRotaryInputAxis(rotaryInputAxis); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can move this outside of the if
block since it's setting a static
variable using a static
method.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
19c85cc
to
99c8cd2
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
Thanks! |
This PR adds Rotary input support for wear os devices. It converts RotaryInput to vertical mouse wheel event. Without it Godot does not recognise this event at all. The same feature wich implemented #88130 , but for Godot 3.x.
Proposal: godotengine/godot-proposals#9062