Adds name, vendor ID and product ID for joysticks.

- Implemented on Windows, Mac OS and Linux.
- Adds sf::Joystick::Identification structure to hold
  name, vendor ID and product ID.
This commit is contained in:
NoobsArePeople2 2014-01-03 18:12:26 -08:00
parent a8ba35171a
commit 29c0f14911
14 changed files with 447 additions and 27 deletions

View file

@ -29,6 +29,7 @@
// Headers
////////////////////////////////////////////////////////////
#include <SFML/Window/Export.hpp>
#include <SFML/System/String.hpp>
namespace sf
@ -68,6 +69,19 @@ public :
PovY ///< The Y axis of the point-of-view hat
};
////////////////////////////////////////////////////////////
/// \brief Structure holding a joystick's identification
///
////////////////////////////////////////////////////////////
struct Identification
{
Identification();
sf::String name; ///< Name of the joystick
unsigned int vendorId; ///< Manufacturer identifier
unsigned int productId; ///< Product identifier
};
////////////////////////////////////////////////////////////
/// \brief Check if a joystick is connected
///
@ -129,6 +143,16 @@ public :
////////////////////////////////////////////////////////////
static float getAxisPosition(unsigned int joystick, Axis axis);
////////////////////////////////////////////////////////////
/// \brief Get the joystick information
///
/// \param joystick Index of the joystick
///
/// \return Structure containing joystick information.
///
////////////////////////////////////////////////////////////
static Identification getIdentification(unsigned int joystick);
////////////////////////////////////////////////////////////
/// \brief Update the states of all joysticks
///