Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Right analog stick is not working. [SFML 2.0]  (Read 2369 times)

0 Members and 1 Guest are viewing this topic.

bumblecorn

  • Newbie
  • *
  • Posts: 18
    • View Profile
Right analog stick is not working. [SFML 2.0]
« 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?

G.

  • Hero Member
  • *****
  • Posts: 1590
    • View Profile
Re: Right analog stick is not working. [SFML 2.0]
« Reply #1 on: January 23, 2013, 10:26:12 pm »
Look at the sf::Joystick documentation, the first parameter is the joystick identifier (if you have multiple joysticks/gamepads plugged in).

bumblecorn

  • Newbie
  • *
  • Posts: 18
    • View Profile
Re: Right analog stick is not working. [SFML 2.0]
« Reply #2 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.

G.

  • Hero Member
  • *****
  • Posts: 1590
    • View Profile
Re: Right analog stick is not working. [SFML 2.0]
« Reply #3 on: January 23, 2013, 10:31:04 pm »
Yep, exactly. ^^

 

anything