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

Author Topic: Joystick PoV Axes Flipped  (Read 13615 times)

0 Members and 1 Guest are viewing this topic.

wintertime

  • Sr. Member
  • ****
  • Posts: 255
    • View Profile
Re: Joystick PoV Axes Flipped
« Reply #15 on: November 22, 2013, 05:21:03 pm »
That it can be returned in two ways:
Quote
JOY_RETURNPOV   The dwPOV member contains valid information about the point-of-view control, expressed in discrete units.
JOY_RETURNPOVCTS   The dwPOV member contains valid information about the point-of-view control expressed in continuous, one-hundredth degree units.
Quote
The default joystick driver currently supports these five discrete directions. If an application can accept only the defined point-of-view values, it must use the JOY_RETURNPOV flag. If an application can accept other degree readings, it should use the JOY_RETURNPOVCTS flag to obtain continuous data if it is available. The JOY_RETURNPOVCTS flag also supports the JOY_POV constants used with the JOY_RETURNPOV flag.
« Last Edit: November 22, 2013, 05:22:42 pm by wintertime »

Mario

  • SFML Team
  • Hero Member
  • *****
  • Posts: 879
    • View Profile
Re: Joystick PoV Axes Flipped
« Reply #16 on: November 24, 2013, 09:07:45 pm »
Guess it's working as intended. It's quirky, yes, but I think this is intentional, considering the POV originated as a coolie hat. Due to this X is indeed forward/backward, while Y is left/right. I'd say leave the current behavior, but add a note to the documentation, maybe even some simple vector graphics explaining orientations?

From MSDN (note this is about DirectInput):
Quote
Hat switch controls must report a Null value when not pressed. When pressed, the logical minimum value represents north, and increasing logical values represent directions equally spaced clockwise around the compass. For example, Table 2 describes two different types of hat switches, one with eight positions and one with four positions.
Of course this speaks of enum/logical values rather than angles, but I'd say it's just the logical next step. The important part is the orientation: 0 degrees is north here.

So SFML's orientation is correct and it's obviously not hardware dependent (as long as the hardware follows these guidelines). So question is which orientation should SFML use? How's the orientation on other platforms?

NoobsArePeople2

  • Newbie
  • *
  • Posts: 47
    • View Profile
    • Email
Re: Joystick PoV Axes Flipped
« Reply #17 on: November 24, 2013, 09:34:02 pm »
So SFML's orientation is correct and it's obviously not hardware dependent (as long as the hardware follows these guidelines). So question is which orientation should SFML use? How's the orientation on other platforms?

My feeling is that it should be left as-is for a couple reasons.

First, legacy support: this is (probably) how SFML has always worked and it hasn't been an issue til now. While not the best reason this is certainly worth considering.

Second: sf::Joystick is a thin wrapper over each platform's joystick API, as such it shouldn't interpret or normalize data returned by a platform's API. For example, on Windows the 360 pad's triggers report a value of 0 when not pressed but they report a value of -100 when not pressed on Mac. Likewise, button indexes are inconsistent across joysticks and platforms. I feel that sf::Joystick should just report what the system gives it and leave it to the developer to properly interpret that information.

Regardless, making a note of this in the docs is definitely a good idea as this feels like a bug.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Joystick PoV Axes Flipped
« Reply #18 on: November 24, 2013, 10:40:17 pm »
Although it's fine to have 0 at north (it's just a valid convention like any other), I think it's definitely wrong to report "left" when you move your POV up -- because "left" is not a convention, it has a unique physical meaning ;).

And this is not what the OS reports, it is just how SFML converts the angle to axes. So this is a bug. And it should be fixed.
Laurent Gomila - SFML developer

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Joystick PoV Axes Flipped
« Reply #19 on: November 26, 2013, 10:30:55 pm »
Done. Feel free to check if it is working as expected now :)
Laurent Gomila - SFML developer