Start a cross platform library for controller input
This idea was suggested on IRC. The argument is that the code in SDL2 doesn't look that bad, and since controllers might need feedback it won't work as window events.
Alternative is to write an abstraction.
Another benefit with this approach is the possibility to make it work with multiple threads. This will decouple the input from the game loop and give better accuracy.
UI widgets could use the mouse/keyboard events polled from the window, while gameplay could use an independent library.
Is there an example of using gamepad input with the currently system (in a non-portable way)?
@xaviershay I've done it with sdl2_window and sdl2. I opened https://github.com/PistonDevelopers/piston-examples/issues/306
An SDL2 example: https://github.com/AngryLawyer/rust-sdl2/blob/master/examples/game_controller.rs
https://github.com/PistonDevelopers/piston/pull/978
Found this on /r/rust: http://joostdevblog.blogspot.com.br/2012/08/the-craziness-that-is-joysticks-on-pc.html
I'm possibly interested in working on this. I'm one of the authors of the W3C Gamepad API spec, and I wrote most of the Gamepad API implementation in Firefox. I've been learning Rust over the past several months and I was thinking about trying to contribute a Gamepad API implementation to Servo.
Trying to do something sensible with game controllers devolves into a giant headache, and it's different on every platform, but it's feasible.
One thing that's bothering me right now about the code in Piston is the terminology--nobody calls game controllers "Joysticks" anymore. :) When I wrote the first prototype implementation of the Gamepad API I called it the "Joystick API" (too much time spent with DirectInput years ago, I guess) and I got a ton of pushback from people telling me that was silly, everyone uses gamepads nowadays.
@luser Sure, go ahead! I opened https://github.com/PistonDevelopers/piston/issues/1047
Some people already started on this. I opened https://github.com/PistonDevelopers/piston/issues/1113 to list external projects.
Closing as outdated.