fyne-io / fyne

Cross platform GUI toolkit in Go inspired by Material Design
https://fyne.io/
Other
25.27k stars 1.4k forks source link

Add API for gamepads and joysticks #4454

Open Jacalz opened 11 months ago

Jacalz commented 11 months ago

Checklist

Is your feature request related to a problem?

While Fyne isn't designed to be used for building games necessarily, there are other use-cases where it makes sense to have a clean and simple interface for accessing gamepads and joysticks. As an example, we are building a control application (not built in Fyne but might as well have been) for a remote controlled car and it would be nice to steer with the controller when not in automatic driving mode.

Is it possible to construct a solution with the existing API?

GLFW has some kind of support for joysticks and gamepads, see https://www.glfw.org/docs/latest/input_guide.html#joystick.

Describe the solution you'd like to see.

Some kind of coherent API, not necessarily too different from the keyboard button API, for accessing gamepads and joysticks.

andydotxyz commented 11 months ago

It's interesting to consider how remotes overlap with this. There is an open PR to add some android remote buttons and I wonder if it fits closer to gamepad than keyboard?

Jacalz commented 11 months ago

Yeah, I think that might be the case. I suspect that introducing gamepad buttons into the keyboard details would make us run into problems when we want to add joystick support (well, axis controls in general) later on down the line.