SFML community forums

Help => System => Topic started by: Karleon on September 03, 2014, 11:42:54 pm

Title: Problems with controller on linux (ubuntu / SFML2.0)
Post by: Karleon 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.
Title: Re: Problems with controller on linux (ubuntu / SFML2.0)
Post by: G. on September 04, 2014, 12:15:20 am
2.0 is not the last released version, maybe it's fixed in 2.1 or later.