Jump to content

View more

Image of the Day

雑魚は多めにして、爽快感重視にしつつ・・・(´・ω・`)
早いとこ、ベースを作って、完成にもっていかないとね。
タイトルもまだ迷ってるだよなぁ。 
#indiedev  #indiegame #screenshotsaturday https://t.co/IwVbswGrhe
IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.


Sign up now

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

4: Adsense

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   

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.

 

 



#2 BitMaster   Members   

8647
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   

1088
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.