piston icon indicating copy to clipboard operation
piston copied to clipboard

Start a cross platform library for controller input

Open bvssvni opened this issue 10 years ago • 12 comments

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.

bvssvni avatar Apr 25 '15 20:04 bvssvni

Alternative is to write an abstraction.

bvssvni avatar May 04 '15 19:05 bvssvni

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.

bvssvni avatar May 22 '15 18:05 bvssvni

UI widgets could use the mouse/keyboard events polled from the window, while gameplay could use an independent library.

bvssvni avatar May 22 '15 18:05 bvssvni

Is there an example of using gamepad input with the currently system (in a non-portable way)?

xaviershay avatar Sep 14 '15 00:09 xaviershay

@xaviershay I've done it with sdl2_window and sdl2. I opened https://github.com/PistonDevelopers/piston-examples/issues/306

bvssvni avatar Sep 14 '15 10:09 bvssvni

An SDL2 example: https://github.com/AngryLawyer/rust-sdl2/blob/master/examples/game_controller.rs

xaviershay avatar Sep 20 '15 21:09 xaviershay

https://github.com/PistonDevelopers/piston/pull/978

xaviershay avatar Sep 27 '15 00:09 xaviershay

Found this on /r/rust: http://joostdevblog.blogspot.com.br/2012/08/the-craziness-that-is-joysticks-on-pc.html

bvssvni avatar Oct 02 '15 04:10 bvssvni

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.

luser avatar Mar 17 '16 14:03 luser

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 avatar Mar 17 '16 14:03 luser

@luser Sure, go ahead! I opened https://github.com/PistonDevelopers/piston/issues/1047

bvssvni avatar Mar 18 '16 14:03 bvssvni

Some people already started on this. I opened https://github.com/PistonDevelopers/piston/issues/1113 to list external projects.

bvssvni avatar Sep 01 '16 20:09 bvssvni

Closing as outdated.

bvssvni avatar Apr 30 '24 17:04 bvssvni