Jump to content

  • Log In with Google      Sign In   
  • Create Account

Banner advertising on our site currently available from just $5!


1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!


C-SFML - How to detect pressing up/down on a joystick?


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
2 replies to this topic

#1 shinypixel   Members   -  Reputation: 226

Like
0Likes
Like

Posted 24 July 2014 - 02:01 PM

IsConnected() is telling me my gamepad is working. It detects when I press buttons.

 

However, when I try to press down or up on the gamepad, I'm getting 0.0 for joy.y_pos.

 

joy.y_pos = sfJoystick_getAxisPosition(JOYSTICK_ID_0, sfJoystickY);
 
if (joy.y_pos < 0) {
joy.blnDown = FALSE;
joy.blnUp = TRUE;
} 
 
else if (joy.y_pos > 0) { 
joy.blnDown = TRUE;
joy.blnUp = FALSE;
} 

 

Am I checking this the right way? Thanks.

 

 



Sponsor:

#2 BitMaster   Crossbones+   -  Reputation: 5003

Like
0Likes
Like

Posted 25 July 2014 - 02:03 AM

Maybe that direction is mapped to a different axis? I don't know if there is more detailled C documentation but according to the C++ documentation the movement could be mapped to one of the eight available axis.

#3 Wooh   Members   -  Reputation: 766

Like
0Likes
Like

Posted 25 July 2014 - 02:31 AM

If it's a D-pad it's probably treated as 4 regular buttons.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS