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

refactor: Add InputEvent #19544

Merged
merged 2 commits into from
Feb 18, 2025
Merged

refactor: Add InputEvent #19544

merged 2 commits into from
Feb 18, 2025

Conversation

kjarosh
Copy link
Member

@kjarosh kjarosh commented Feb 17, 2025

This refactor simplifies code and is a first step towards tidying up and unifying input handling across platforms.

The most important improvement is the addition of InputEvent, which represents a mapped PlayerEvent related to input. It proves to be useful even now by discarding gamepad events and having click index present at all times. In the future this will make it possible to pass information about keys in PlayerEvent without any knowledge about Flash Player (so no KeyCode).

@kjarosh kjarosh added A-input Area: Input handling T-refactor Type: Refactor / Cleanup labels Feb 17, 2025
@kjarosh kjarosh added the waiting-on-review Waiting on review from a Ruffle team member label Feb 17, 2025
@kjarosh kjarosh force-pushed the input-event branch 2 times, most recently from 9396767 to bcc8281 Compare February 17, 2025 19:23
This refactor makes code simpler by merging map_input_event and
handle_event in input into process_input_event.
This makes it unnecessary to invoke map_input_event from input and then
pass the mapped input again to handle_event.
This refactor adds InputEvent, which is a processed PlayerEvent:

1. it does not contain gamepad events, as they are already mapped,
2. it always contains click index, as it's inferred when processing input.
@kjarosh kjarosh removed the waiting-on-review Waiting on review from a Ruffle team member label Feb 18, 2025
@kjarosh kjarosh merged commit 78fd707 into ruffle-rs:master Feb 18, 2025
21 of 22 checks passed
@kjarosh kjarosh deleted the input-event branch February 18, 2025 22:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-input Area: Input handling T-refactor Type: Refactor / Cleanup
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants