I've made an update to expose the name, product ID and manufacturer ID for joysticks. This is
ticket #152 on Github. The commit with these changes is
on my fork of SFML.
I'm a C++ noob so I'd like to get a good code review of this change before doing a pull request. Also, I haven't been able to properly test this on Linux (it compiles in VM but by VM software doesn't allow me to connect USB devices) so I'm not certain it functions properly on that platform. If a pull request is preferrable to this forum post let me know and I can do that.
The ChangesJoystickCaps has been renamed
JoystickInfo. In addition to the name change three properties have been added to it:
1.
name: the name of the joystick.
2.
manufacturerID: the joystick manufacturer's ID.
3.
productID: the product ID of the joystick.
sf::Joystick has three new functions that correspond with these values:
1.
getName(unsigned int index): return the name of the joystick at
index as an
sf::String.
2.
getManufacturerID(unsigned int index): returns the manufacturer ID at
index as an
unsigned int.
3.
getProductID(unsigned int index): returns the product ID at
index as an
unsigned int.
TestingI've been using this update on Mac OS and Windows for awhile and all is well (for me anyway). The Linux implementation compiles but I'm running Ubuntu in a virtual machine and am unable to connect USB devices to it so I cannot put it to the test.
PlatformsOn the Mac side of things I'm running 10.7 Lion with Xcode 4.6. I'm compiling with C++11 support using Clang.
On Windows I'm running Windows 8 x64 with Mingw 4.6.2.
On Ubuntu I'm running 13.10 x64 with GCC 4.8.x.
ControllersI've tested with the following controllers (drivers listed in instances were the manufacturer does not provide one for the platform):
- Xbox 360, wired (Windows, Mac via
Tattiebogle v0.08 Driver)
- Xbox 360, wireless (Windows)
- PS3 (Windows via
Motioninjoy v0.7 Driver, Mac)
- Wiimote, no attachments, with nunchuck, with classic controller (Mac via
WJoy v0.7.1 Driver)
I feel good about the Mac and Windows implementations. Can someone please give the Linux version a try and let me know how/if it works?