SFML community forums
Help => General => Topic started by: CyanPrime on March 31, 2011, 05:34:19 am
-
How would I do that?
I tried
if((Event.Type == sf::Event::JoyMoved) && (Event.JoyMove.Axis == 0) && (Event.JoyMove.Position == 90))
But that didn't work.
-
- you forget to test the joystick index
- POV is sf::Joy::AxisPOV, not 0
- axes positions are float, so they could be 89.9999 or 90.00001 but never 90 (for example), use a small range instead of strict equality
-
if((Event.Type == sf::Event::JoyMoved) && (Event.JoyMove.Axis == sf::Joy::AxisPOV) && (Event.JoyMove.Position >= 80 && Event.JoyMove.Position <= 100)){
Sound.Play();
cout << Event.JoyMove.Position <<endl;
}
Still not working. tried on 2 controllers.
-
You can print the different values that you test and see which one is wrong.