#include <joystick.h>
Definition at line 27 of file joystick.h.
Public Types | |
enum | { MAX_BUTTONS = 6 } |
Number of buttons we can handle. More... | |
enum | { UP = 1, DOWN = 2, LEFT = 4, RIGHT = 8 } |
Directions, to be used as bitmask values. More... | |
Public Member Functions | |
Joystick (int no) | |
Constructor, pass the number of the joystick the new object should access. | |
~Joystick () | |
bool | isEnabled () const |
void | setEnabled (bool enabled) |
void | update () |
Updates the direction and button information. | |
void | startCalibration () |
void | finishCalibration () |
bool | isCalibrating () const |
bool | buttonPressed (unsigned char no) const |
bool | isUp () const |
bool | isDown () const |
bool | isLeft () const |
bool | isRight () const |
Static Public Member Functions | |
static void | init () |
Initializes the joystick subsystem. | |
static int | getNumberOfJoysticks () |
Returns the number of available joysticks. | |
Protected Member Functions | |
void | doCalibration () |
Protected Attributes | |
unsigned char | mDirection |
bool | mButtons [MAX_BUTTONS] |
SDL_Joystick * | mJoystick |
int | mUpTolerance |
int | mDownTolerance |
int | mLeftTolerance |
int | mRightTolerance |
bool | mCalibrating |
bool | mEnabled |
Static Protected Attributes | |
static int | joystickCount = 0 |
anonymous enum |
anonymous enum |
Joystick::Joystick | ( | int | no | ) |
Constructor, pass the number of the joystick the new object should access.
Definition at line 43 of file joystick.cpp.
Joystick::~Joystick | ( | ) |
Definition at line 71 of file joystick.cpp.
void Joystick::init | ( | ) | [static] |
static int Joystick::getNumberOfJoysticks | ( | ) | [inline, static] |
bool Joystick::isEnabled | ( | ) | const [inline] |
Definition at line 67 of file joystick.h.
void Joystick::setEnabled | ( | bool | enabled | ) | [inline] |
Definition at line 69 of file joystick.h.
void Joystick::update | ( | ) |
void Joystick::startCalibration | ( | ) |
Definition at line 108 of file joystick.cpp.
void Joystick::finishCalibration | ( | ) |
Definition at line 134 of file joystick.cpp.
bool Joystick::isCalibrating | ( | ) | const [inline] |
Definition at line 80 of file joystick.h.
bool Joystick::buttonPressed | ( | unsigned char | no | ) | const |
Definition at line 143 of file joystick.cpp.
bool Joystick::isUp | ( | ) | const [inline] |
Definition at line 84 of file joystick.h.
bool Joystick::isDown | ( | ) | const [inline] |
Definition at line 85 of file joystick.h.
bool Joystick::isLeft | ( | ) | const [inline] |
Definition at line 86 of file joystick.h.
bool Joystick::isRight | ( | ) | const [inline] |
Definition at line 87 of file joystick.h.
void Joystick::doCalibration | ( | ) | [protected] |
Definition at line 117 of file joystick.cpp.
unsigned char Joystick::mDirection [protected] |
Definition at line 87 of file joystick.h.
bool Joystick::mButtons[MAX_BUTTONS] [protected] |
Definition at line 91 of file joystick.h.
SDL_Joystick* Joystick::mJoystick [protected] |
Definition at line 92 of file joystick.h.
int Joystick::mUpTolerance [protected] |
Definition at line 94 of file joystick.h.
int Joystick::mDownTolerance [protected] |
Definition at line 94 of file joystick.h.
int Joystick::mLeftTolerance [protected] |
Definition at line 94 of file joystick.h.
int Joystick::mRightTolerance [protected] |
Definition at line 94 of file joystick.h.
bool Joystick::mCalibrating [protected] |
Definition at line 95 of file joystick.h.
bool Joystick::mEnabled [protected] |
Definition at line 96 of file joystick.h.
int Joystick::joystickCount = 0 [static, protected] |
Definition at line 98 of file joystick.h.