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

Fixed UI navigation using joy axis inputs #31880

Merged
merged 1 commit into from
Sep 3, 2019

Conversation

pouleyKetchoupp
Copy link
Contributor

This change fixes glitches when using joy axis inputs for ui navigation. Now inputs are only applied on the first frame they occur, even when joystick events are still being received.

Fixes #31879

Copy link
Member

@groud groud left a comment

Choose a reason for hiding this comment

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

For each action, the is_action_pressed check should be removed, it becomes redundant with the is_action_just_pressed check.

@pouleyKetchoupp
Copy link
Contributor Author

Are you sure it would be safe?
p_event->is_action_pressed() is checking the actual event the Viewport received, whereas input->is_action_just_pressed() just checks the global action to be triggered. I don't want a viewport to trigger events that it's not supposed to in some edge cases, that's why I kept both checks.

@akien-mga akien-mga added this to the 3.2 milestone Sep 2, 2019
@groud
Copy link
Member

groud commented Sep 2, 2019

I see what you mean, but what you are doing here is likely not really consistent then.
Either you use the global action system, either you use events, else that's where you might end up with inconsistencies when you have several Viewports. Could be merged like that until we find a better solution though.

Anyway, I kind of think this is not the perfect solution. I believe you should be able to keep the stick pressed to navigate on several entries, so you don't have to bring the stick to the center all the time on long lists. However that would require to setup a configurable timer between two focus change (and maybe another one offset the first change before it changes repeatedly).

groud
groud previously approved these changes Sep 2, 2019
@groud groud dismissed their stale review September 2, 2019 08:47

Reconsidered

@pouleyKetchoupp
Copy link
Contributor Author

I agree, there's probably a more consistent solution to be implemented for this. This implementation just seemed safe and easy to do :)

Concerning moving through the menu by holding the stick, I love the idea but I think it could be added in a more general way for all input types, since there's also no support for key repeat on keyboard or joy buttons as far as I know.

@akien-mga akien-mga merged commit a1fe20a into godotengine:master Sep 3, 2019
@akien-mga
Copy link
Member

Thanks!

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

Successfully merging this pull request may close these issues.

UI navigation with joystick is not functional
4 participants