mirror of
https://github.com/SFML/CSFML.git
synced 2026-10-26 13:06:13 +01:00
Merge pull request #59 from zsbzsb/feature/joystick_identification
Added support for joystick identification
This commit is contained in:
commit
a7ff14c407
4 files changed
+76
No files matched your search
@@ -11,6 +11,7 @@ set(SRC
|
||||
${INCROOT}/Event.h
|
||||
${SRCROOT}/Joystick.cpp
|
||||
${INCROOT}/Joystick.h
|
||||
${INCROOT}/JoystickIdentification.h
|
||||
${SRCROOT}/Keyboard.cpp
|
||||
${INCROOT}/Keyboard.h
|
||||
${SRCROOT}/Mouse.cpp
|
||||
|
||||
@@ -64,6 +64,22 @@ float sfJoystick_getAxisPosition(unsigned int joystick, sfJoystickAxis axis)
|
||||
return sf::Joystick::getAxisPosition(joystick, static_cast<sf::Joystick::Axis>(axis));
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
sfJoystickIdentification sfJoystick_getIdentification(unsigned int joystick)
|
||||
{
|
||||
static std::string name;
|
||||
|
||||
sf::Joystick::Identification identification = sf::Joystick::getIdentification(joystick);
|
||||
name = identification.name;
|
||||
|
||||
sfJoystickIdentification result;
|
||||
|
||||
result.name = name.c_str();
|
||||
result.productId = identification.productId;
|
||||
result.vendorId = identification.vendorId;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfJoystick_update(void)
|
||||
|
||||
Reference in new issue
Block a user