SDL++
C++wrapperfortheSDLlibrary.

sdl::devices::Joystick Class Reference

Represents a joystick. More...

#include <Joystick.h>

List of all members.

Public Member Functions

 Joystick (int index)
 ~Joystick ()
std::string name ()
int index ()
int numAxes ()
int numButtons ()
int numHats ()
int numTrackballs ()
short axisPosition (int axis)
bool isPressed (int button)
char hatState (int hat)
pair< int, int > trackballMotion (int trackball)

Detailed Description

Represents a joystick.

Definition at line 41 of file Joystick.h.


Constructor & Destructor Documentation

sdl::devices::Joystick::Joystick ( int  index) [inline]

Constructs a Joystick.

Parameters:
indexThe index of the joystick.

Definition at line 48 of file Joystick.h.

sdl::devices::Joystick::~Joystick ( ) [inline]

Destroy a Joystick.

Definition at line 58 of file Joystick.h.


Member Function Documentation

short sdl::devices::Joystick::axisPosition ( int  axis) [inline]

Returns the position of the given joystick axis.

Parameters:
axisThe axis.
Returns:
The position.

Definition at line 109 of file Joystick.h.

char sdl::devices::Joystick::hatState ( int  hat) [inline]

Returns the state of the given joystick hat.

Parameters:
hatThe hat.
Returns:
The state.

Definition at line 127 of file Joystick.h.

int sdl::devices::Joystick::index ( ) [inline]

Returns the index of the joystick.

Returns:
The index of the joystick.

Definition at line 72 of file Joystick.h.

bool sdl::devices::Joystick::isPressed ( int  button) [inline]

Determines if the button is pressed.

Parameters:
buttonThe button.
Returns:
True if the button is pressed, false otherwise.

Definition at line 118 of file Joystick.h.

std::string sdl::devices::Joystick::name ( ) [inline]

Gets the implementation dependent name of the joystick.

Returns:
The joystick's name.

Definition at line 65 of file Joystick.h.

int sdl::devices::Joystick::numAxes ( ) [inline]

Gets the number of joystick axes.

return The number of joystick axes.

Definition at line 79 of file Joystick.h.

int sdl::devices::Joystick::numButtons ( ) [inline]

Gets the number of joystick buttons.

return The number of joystick buttons.

Definition at line 86 of file Joystick.h.

int sdl::devices::Joystick::numHats ( ) [inline]

Gets the number of joystick hats.

return The number of joystick hats.

Definition at line 93 of file Joystick.h.

int sdl::devices::Joystick::numTrackballs ( ) [inline]

Gets the number of joystick trackballs.

return The number of joystick trackballs.

Definition at line 100 of file Joystick.h.

pair<int, int> sdl::devices::Joystick::trackballMotion ( int  trackball) [inline]

Returns the relative motion of the given joystick trackball.

Parameters:
trackballThe trackball.
Returns:
The relative motion.
Exceptions:
runtime_errorThrows a runtime_error if unable to determine trackball motion.

Definition at line 138 of file Joystick.h.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs