summaryrefslogtreecommitdiff
path: root/src/SFML/Window/Linux/Joystick.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/SFML/Window/Linux/Joystick.hpp')
-rwxr-xr-xsrc/SFML/Window/Linux/Joystick.hpp26
1 files changed, 19 insertions, 7 deletions
diff --git a/src/SFML/Window/Linux/Joystick.hpp b/src/SFML/Window/Linux/Joystick.hpp
index a035f61..3122264 100755
--- a/src/SFML/Window/Linux/Joystick.hpp
+++ b/src/SFML/Window/Linux/Joystick.hpp
@@ -28,6 +28,13 @@
////////////////////////////////////////////////////////////
// Headers
////////////////////////////////////////////////////////////
+#if defined(SFML_SYSTEM_LINUX)
+ #include <linux/joystick.h>
+ #include <fcntl.h>
+#elif defined(SFML_SYSTEM_FREEBSD)
+ // #include <sys/joystick.h> ?
+ #define ABS_MAX 1
+#endif
namespace sf
@@ -58,12 +65,14 @@ public :
JoystickState UpdateState();
////////////////////////////////////////////////////////////
- /// Get the number of axes supported by the joystick
+ /// Check if the joystick supports the given axis
///
- /// \return Number of axis
+ /// \param Axis : Axis to check
+ ///
+ /// \return True of the axis is supported, false otherwise
///
////////////////////////////////////////////////////////////
- unsigned int GetAxesCount() const;
+ bool HasAxis(Joy::Axis Axis) const;
////////////////////////////////////////////////////////////
/// Get the number of buttons supported by the joystick
@@ -78,10 +87,13 @@ private :
////////////////////////////////////////////////////////////
// Member data
////////////////////////////////////////////////////////////
- int myDescriptor; ///< Linux descriptor of the joystick
- unsigned int myNbAxes; ///< Number of axis supported by the joystick
- unsigned int myNbButtons; ///< Number of buttons supported by the joystick
- JoystickState myState; ///< Current state of the joystick
+ int myDescriptor; ///< Linux descriptor of the joystick
+ unsigned int myNbButtons; ///< Number of buttons supported by the joystick
+ bool myAxes[Joy::AxisCount]; ///< Supported axes
+ JoystickState myState; ///< Current state of the joystick
+ int myPovX; ///< Last X position of the POV
+ int myPovY; ///< Last Y position of the POV
+ char myAxesMapping[ABS_MAX + 1]; ///< Axes mapping (index --> axis id)
};
} // namespace priv