1
System / Problems with controller on linux (ubuntu / SFML2.0)
« on: September 03, 2014, 11:42:54 pm »
Hello,
I implemented controller support for my game, and it was working correctly on windows.
I tried it on my laptop running ubuntu, and there was a strange behaviour:
My USB mouse is detected as a controller by SFML on ubuntu, having the contrer ID 1.
The X and Y axis return -100 and the GetButtonCount function said the controller had 320 buttons.
As a workaround, in my initialization I just check if the controller has less than 20 buttons. If it has more, the engine will ignore it. But I'm not really happy with this solution as I don't know if it would work for all possible scenarios (a controller with 13 buttons might be generated by another device, for example)
Do you guys have any idea what could be happening here or how to fix it?
Thanks!
Edit: Forgot to mention that I made sure to call sf::Joystick::update() during the initialization, before checking for any plugged in controllers.
I implemented controller support for my game, and it was working correctly on windows.
I tried it on my laptop running ubuntu, and there was a strange behaviour:
My USB mouse is detected as a controller by SFML on ubuntu, having the contrer ID 1.
The X and Y axis return -100 and the GetButtonCount function said the controller had 320 buttons.
As a workaround, in my initialization I just check if the controller has less than 20 buttons. If it has more, the engine will ignore it. But I'm not really happy with this solution as I don't know if it would work for all possible scenarios (a controller with 13 buttons might be generated by another device, for example)
Do you guys have any idea what could be happening here or how to fix it?
Thanks!
Edit: Forgot to mention that I made sure to call sf::Joystick::update() during the initialization, before checking for any plugged in controllers.