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

feat: Added GamepadState that can be updated #43

Merged
merged 6 commits into from
Oct 3, 2024

Conversation

Levi-Lesches
Copy link
Contributor

@Levi-Lesches Levi-Lesches commented Sep 20, 2024

Usage:

final gamepads = await Gamepads.listGamepads();
final gamepad = gamepads.first;

// Now, at any point, you can check gamepad
print(gamepad.state.buttonInputs);
print(gamepad.state.analogInputs);

// When you're done with the gamepad, call dispose:
await gamepad.dispose();

Was not able to test on Windows due to some long compiler errors (see my message here) but will hopefully be able to test on Linux later this week

Fixes #12

@Levi-Lesches Levi-Lesches changed the title Added GamepadState that can be updated [feat] Added GamepadState that can be updated Sep 20, 2024
@Levi-Lesches Levi-Lesches changed the title [feat] Added GamepadState that can be updated [feat]: Added GamepadState that can be updated Sep 20, 2024
@Levi-Lesches Levi-Lesches changed the title [feat]: Added GamepadState that can be updated feat: Added GamepadState that can be updated Sep 20, 2024
@spydon
Copy link
Member

spydon commented Sep 21, 2024

The class looks good, but I bit strange that the user has to update it themselves?

@Levi-Lesches
Copy link
Contributor Author

Updated the API, see the new example. I had to pass an instance of the plugin to the GamepadController constructor to automatically subscribe, but now you check state and call dispose

Copy link
Member

@spydon spydon left a comment

Choose a reason for hiding this comment

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

Other than some missing dartdocs and the formatting issue it looks good to me!

@Levi-Lesches
Copy link
Contributor Author

Done, thanks for the quick review

Copy link
Member

@spydon spydon left a comment

Choose a reason for hiding this comment

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

Lgtm, thanks for the patience waiting for the final review, I was away for a conference.

@spydon spydon merged commit 0c9890e into flame-engine:main Oct 3, 2024
7 checks passed
@Levi-Lesches Levi-Lesches deleted the state branch October 7, 2024 21:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support different kinds of user-facing interfaces for exposing the data
2 participants