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

Allow interpreting JoyAxis as JoyButton #80944

Closed
wants to merge 1 commit into from

Conversation

Sauermann
Copy link
Contributor

@Sauermann Sauermann commented Aug 23, 2023

Let the user configure, if a JoyAxis should be interpreted as a pair of JoyButtons (negative and positive side).

When an axis is configured as a button, then InputEventJoypadButton-events are sent instead of InputEventJoypadMotion-events for this axis.

resolve #72636

Being unfamiliar with this part of the code-base, It is likely, that I have missed some details.

MRP for testing: AxisButton.zip
image

@Sauermann Sauermann added this to the 4.x milestone Aug 23, 2023
@Sauermann Sauermann requested review from a team as code owners August 23, 2023 21:16
@Sauermann Sauermann force-pushed the fix-axis-button branch 2 times, most recently from 60d1910 to 8e0a125 Compare August 23, 2023 22:44
float previous_value = 0.0;
};

LocalVector<LocalVector<JoyAxisButtonMapping>> axis_to_button_mapper;
Copy link
Member

@KoBeWi KoBeWi Sep 21, 2023

Choose a reason for hiding this comment

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

Why not HashMap<int, LocalVector> ?
EDIT:
Actually LocalVector might be faster, idk.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was under the impression, that LocalVector was more appropriate than HashMap, because I can access the content by integer indices, so there is no need for creating the hash values.

Copy link
Member

@KoBeWi KoBeWi left a comment

Choose a reason for hiding this comment

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

I left some comments, but looks fine overall.

@YuriSizov YuriSizov modified the milestones: 4.x, 4.3 Oct 2, 2023
Let the user configure, if a JoyAxis should be interpreted as a pair of
JoyButtons (negative and positive side).

When an axis is configured as a button, then
`InputEventJoypadButton`-events are sent instead of
`InputEventJoypadMotion`-events for this axis.
@Sauermann Sauermann marked this pull request as draft October 12, 2023 08:00
@RandomShaper
Copy link
Member

If there's the problem that is_action_pressed/released() doesn't have enough resolution (e.g., two quick presses in a row are registered as a continuous press, with no release in the middle), #77062 could help. That one would only address the problem on Android, and for other OS abstrations that are rearchitected to split main and OS threads.

It'd be interesting to know if on non-Android platforms, there's an issues at the moment with is_action_pressed/released() and that's forcing games to need a feature like the one implemented here.

@Sauermann
Copy link
Contributor Author

As discussed in a previous PR-review meeting, there are better ways to resolve the linked issue. Closing.

@Sauermann Sauermann closed this Jan 19, 2024
@Sauermann Sauermann removed this from the 4.3 milestone Jan 19, 2024
@Sauermann Sauermann deleted the fix-axis-button branch January 19, 2024 20:06
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.

Can't bind controller trigger axis events (L2, R2) as if buttons (4.0 beta)
5 participants