summaryrefslogtreecommitdiff
path: root/src/joystick.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/joystick.h')
-rw-r--r--src/joystick.h38
1 files changed, 34 insertions, 4 deletions
diff --git a/src/joystick.h b/src/joystick.h
index 32efc5bff..be23599c9 100644
--- a/src/joystick.h
+++ b/src/joystick.h
@@ -25,6 +25,9 @@
#include <SDL.h>
+#include <string>
+#include <vector>
+
class Joystick
{
public:
@@ -33,7 +36,7 @@ class Joystick
*/
enum
{
- MAX_BUTTONS = 6
+ MAX_BUTTONS = 64
};
/**
@@ -66,12 +69,20 @@ class Joystick
~Joystick();
+ bool open();
+
+ void close();
+
bool isEnabled() const
{ return mEnabled; }
- void setEnabled(bool enabled)
+ void setNumber(int n);
+
+ static void setEnabled(bool enabled)
{ mEnabled = enabled; }
+ static void getNames(std::vector <std::string> &names);
+
/**
* Updates the direction and button information.
*/
@@ -98,18 +109,37 @@ class Joystick
bool isRight() const
{ return mEnabled && (mDirection & RIGHT); };
+ int getNumber() const
+ { return mNumber; }
+
+ void setUseInactive(bool b)
+ { mUseInactive = b; }
+
protected:
unsigned char mDirection;
bool mButtons[MAX_BUTTONS];
SDL_Joystick *mJoystick;
- int mUpTolerance, mDownTolerance, mLeftTolerance, mRightTolerance;
+ int mUpTolerance;
+ int mDownTolerance;
+ int mLeftTolerance;
+ int mRightTolerance;
bool mCalibrating;
- bool mEnabled;
+ int mNumber;
+ bool mCalibrated;
+ int mButtonsNumber;
+ bool mUseInactive;
+ bool mHaveHats;
+ /**
+ * Is joystick support enabled.
+ */
+ static bool mEnabled;
static int joystickCount;
void doCalibration();
};
+extern Joystick *joystick;
+
#endif // JOYSTICK_H