PistonDevelopers / glfw-rs

GLFW3 bindings and idiomatic wrapper for Rust.
Apache License 2.0
641 stars 124 forks source link

Controller not recognized as gamepad #503

Open KyleNBurke opened 2 years ago

KyleNBurke commented 2 years ago

I have a standard Xbox One controller plugged into my PC but it's not being recognized as a gamepad even though the mapping for it is defined in the GLFW source.

Here is the code I'm running.

let mut glfw = glfw::init(glfw::FAIL_ON_ERRORS).unwrap();
let joystick = glfw.get_joystick(glfw::JoystickId::Joystick1);

println!("{}", joystick.get_guid().unwrap());
println!("{}", joystick.is_gamepad());

get_guid() returns 78696e70757401000000000000000000 and is_gamepad() returns false which is strange because I can see that exact GUID defined in the GLFW source at the links below. https://github.com/glfw/glfw/blob/201400b974b63eb7f23eb7d8563589df9c699d7c/src/mappings.h.in#L65 https://github.com/glfw/glfw/blob/201400b974b63eb7f23eb7d8563589df9c699d7c/src/mappings.h#L422

Also, it's the literal GUID mentioned in the documentation below. Search the page for that GUID. https://www.glfw.org/docs/3.3/input_guide.html#joystick

So why is .is_gamepad() returning false?

DeciStudios commented 3 months ago

Did you ever figure this out?

KyleNBurke commented 3 months ago

@DeciStudios I did not. What I can say thought is, I've been using the Odin programming language with it's GLFW bindings and haven't ran into this issue. I do get true from the gamepad check procedure. So if you or anyone else is is still seeing this issue, I believe it to be an issue with this bindings library, not GLFW itself.