Sign in to follow this  

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

This topic is 1272 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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.

 

 

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
If it's a D-pad it's probably treated as 4 regular buttons.

Share this post


Link to post
Share on other sites
Sign in to follow this