diff options
author | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2006-08-26 20:19:39 +0000 |
---|---|---|
committer | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2006-08-26 20:19:39 +0000 |
commit | be3b639a879a5a8eb73b2e652683da222796af44 (patch) | |
tree | 35d5ed3957c283dbb49fd9b92112c7cc919b7ba9 /src/joystick.h | |
parent | ef82a7df8aafb569f6db5e77ff2dd67fde860148 (diff) | |
download | mana-be3b639a879a5a8eb73b2e652683da222796af44.tar.gz mana-be3b639a879a5a8eb73b2e652683da222796af44.tar.bz2 mana-be3b639a879a5a8eb73b2e652683da222796af44.tar.xz mana-be3b639a879a5a8eb73b2e652683da222796af44.zip |
Applied patch by Pascal, adding sliders to configure the scrolling behaviour
and a checkbox to enable or disable the joystick.
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; |