SFML community forums

Help => Window => Topic started by: bumblecorn on January 23, 2013, 10:14:56 pm

Title: Right analog stick is not working. [SFML 2.0]
Post by: bumblecorn on January 23, 2013, 10:14:56 pm
I'm trying to make an Asteroids type game where you use the left stick to move around and the right stick to rotate and shoot in different directions.
I'm using a wired Xbox 360 game-pad, left analog stick works fine, returns 1 for all the axis, but the right one may as well not even be there. When it's pushed down it still works as a button, but it's as if it has no axis.

sf::Joystick::hasAxis(0, sf::Joystick::X);
//returns 1

sf::Joystick::hasAxis(1, sf::Joystick::X);
//returns 0

Am I missing something? Or is it a problem with SFML 2.0 itself?
Title: Re: Right analog stick is not working. [SFML 2.0]
Post by: G. on January 23, 2013, 10:26:12 pm
Look at the sf::Joystick documentation (http://www.sfml-dev.org/documentation/2.0/classsf_1_1Joystick.php), the first parameter is the joystick identifier (if you have multiple joysticks/gamepads plugged in).
Title: Re: Right analog stick is not working. [SFML 2.0]
Post by: bumblecorn on January 23, 2013, 10:27:36 pm
Oh I see, I'm trying to return values from another game-pad, that's not even there. And the other axis (Z, U, V, etc.) are for the other stick and the triggers? Well this was a waste of forum space, I do apologise. And thank you for setting me on the right track, I'm still a beginner in both C++ and SFML.
Title: Re: Right analog stick is not working. [SFML 2.0]
Post by: G. on January 23, 2013, 10:31:04 pm
Yep, exactly. ^^