Joystick Class Reference

#include <joystick.h>

List of all members.


Detailed Description

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

Member Enumeration Documentation

anonymous enum

Number of buttons we can handle.

Enumerator:
MAX_BUTTONS 

Definition at line 33 of file joystick.h.

anonymous enum

Directions, to be used as bitmask values.

Enumerator:
UP 
DOWN 
LEFT 
RIGHT 

Definition at line 41 of file joystick.h.


Constructor & Destructor Documentation

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.


Member Function Documentation

void Joystick::init (  )  [static]

Initializes the joystick subsystem.

Definition at line 30 of file joystick.cpp.

static int Joystick::getNumberOfJoysticks (  )  [inline, static]

Returns the number of available joysticks.

Definition at line 57 of file joystick.h.

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 (  ) 

Updates the direction and button information.

Definition at line 76 of file joystick.cpp.

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.


Member Data Documentation

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.


The documentation for this class was generated from the following files:

Generated on Sun Apr 26 17:30:43 2009 for The Mana World by  doxygen 1.5.5