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

Author Topic: Joystick axes query per joystick under macOS enhancement suggestion  (Read 3694 times)

0 Members and 1 Guest are viewing this topic.

AshleyF

  • Newbie
  • *
  • Posts: 30
    • View Profile
Dear All,

I was wondering if it might be possible to change:

unsigned int axes = sf::Joystick::AxisCount;

to:

unsigned int axes = sf::Joystick::AxisCount(joystickNumber);

such that it's possible to test exactly how many axes are available on a given joystick, or, going further with it, would it be possible to return appropriate information on a given joystick such that I'd immediately know what axes were available?

The reason why I'm suggesting this is because under macOS, irrespective of the joystick being tested, it always returns 8 as the answer to the query.

Kind regards,

AshleyF

Hiura

  • SFML Team
  • Hero Member
  • *****
  • Posts: 4321
    • View Profile
    • Email
Re: Joystick axes query per joystick under macOS enhancement suggestion
« Reply #1 on: November 15, 2016, 06:32:55 pm »
This is an enum; that's why the value is always the same. Modifying it at runtime is therefore not possible. Also, changing it to a function would break API so this is a no go. BUT we could have a static `getAxisCount` function similar to `getButtonCount`, yes. Or probably better yet: `bool hasAxis(joystick, axis)`.

Edit: Apparently we already have a hasAxis function...
« Last Edit: November 17, 2016, 10:13:05 am by Hiura »
SFML / OS X developer

Mario

  • SFML Team
  • Hero Member
  • *****
  • Posts: 879
    • View Profile
Re: Joystick axes query per joystick under macOS enhancement suggestion
« Reply #2 on: November 16, 2016, 09:29:06 am »
Fully agree.

To further add: The enum value is there to get the maximum number of axes supported by SFML, not the actual number of any particular controller.

Hiura

  • SFML Team
  • Hero Member
  • *****
  • Posts: 4321
    • View Profile
    • Email
Re: Joystick axes query per joystick under macOS enhancement suggestion
« Reply #3 on: November 17, 2016, 10:00:53 am »
Ashley, feel free to open an issue on github linking to this discussion. Additionally, if you have time, a PR would be more than welcome, even if you can provide only the Mac implementation (we'll try to find some other good fellows for Linux and Windows implementations).
« Last Edit: November 17, 2016, 10:12:09 am by Hiura »
SFML / OS X developer

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Laurent Gomila - SFML developer

Hiura

  • SFML Team
  • Hero Member
  • *****
  • Posts: 4321
    • View Profile
    • Email
Re: Joystick axes query per joystick under macOS enhancement suggestion
« Reply #5 on: November 17, 2016, 10:11:53 am »
 :o
SFML / OS X developer

 

anything