diff options
author | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2006-08-28 23:04:08 +0000 |
---|---|---|
committer | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2006-08-28 23:04:08 +0000 |
commit | 391203d83ed7a72b54fb7d7c72dbe35db14f0ea9 (patch) | |
tree | a9a9e14bbbdde0b48c66b99038d505a42a51609b /src/joystick.h | |
parent | af61e1e7df91b97c3f7516e9eb2b37b621f069ad (diff) | |
download | mana-client-391203d83ed7a72b54fb7d7c72dbe35db14f0ea9.tar.gz mana-client-391203d83ed7a72b54fb7d7c72dbe35db14f0ea9.tar.bz2 mana-client-391203d83ed7a72b54fb7d7c72dbe35db14f0ea9.tar.xz mana-client-391203d83ed7a72b54fb7d7c72dbe35db14f0ea9.zip |
Merged trunk development between revisions 2530 and 2618 to the 0.1.0 branch.
Diffstat (limited to 'src/joystick.h')
-rw-r--r-- | src/joystick.h | 39 |
1 files changed, 26 insertions, 13 deletions
diff --git a/src/joystick.h b/src/joystick.h index ebdfabeb..f0759add 100644 --- a/src/joystick.h +++ b/src/joystick.h @@ -30,12 +30,12 @@ class Joystick { public: /** - * Number of buttons we can handle + * Number of buttons we can handle. */ static const unsigned char MAX_BUTTONS = 6; /** - * Directions, to be used as bitmask values + * Directions, to be used as bitmask values. */ static const char UP = 1; static const char DOWN = 2; @@ -43,12 +43,12 @@ class Joystick static const char RIGHT = 8; /** - * Initializes the joystick subsystem + * Initializes the joystick subsystem. */ static void init(); /** - * Returns the number of available joysticks + * Returns the number of available joysticks. */ static int getNumberOfJoysticks() { return joystickCount; } @@ -60,21 +60,33 @@ class Joystick ~Joystick(); + bool + isEnabled() const { return mEnabled; } + + void + setEnabled(bool enabled) { mEnabled = enabled; } + /** * Updates the direction and button information. */ - void update(); + void + update(); + + void + startCalibration(); + + void + finishCalibration(); - void startCalibration(); - void finishCalibration(); - bool isCalibrating() { return mCalibrating; }; + bool + isCalibrating() const { return mCalibrating; } - bool buttonPressed(unsigned char no); + bool buttonPressed(unsigned char no) const; - bool isUp() { return mDirection & UP; }; - bool isDown() { return mDirection & DOWN; }; - bool isLeft() { return mDirection & LEFT; }; - bool isRight() { return mDirection & RIGHT; }; + bool isUp() const { return mDirection & UP; }; + bool isDown() const { return mDirection & DOWN; }; + bool isLeft() const { return mDirection & LEFT; }; + bool isRight() const { return mDirection & RIGHT; }; protected: unsigned char mDirection; @@ -83,6 +95,7 @@ class Joystick int mUpTolerance, mDownTolerance, mLeftTolerance, mRightTolerance; bool mCalibrating; + bool mEnabled; static int joystickCount; |