Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | Related Pages

wftk::Joystick Class Reference

A class to handle joystick information. More...

#include <joystick.h>

List of all members.

Public Types

enum  Hat {
  CENTERED = SDL_HAT_CENTERED, LEFT = SDL_HAT_LEFT, RIGHT = SDL_HAT_RIGHT, UP = SDL_HAT_UP,
  DOWN = SDL_HAT_DOWN, RIGHTUP = RIGHT | UP, RIGHTDOWN = RIGHT | DOWN, LEFTUP = LEFT | UP,
  LEFTDOWN = LEFT | DOWN
}
 Flags used in the hat status mask.

Public Member Functions

 Joystick (unsigned)
 joystick constructor, used internally
const char * name ()
 Get the system-dependent name of a joystick.
Uint8 numAxes ()
 Get the number of axes of a joystick.
Uint8 numBalls ()
 Get the number of trackballs of a joystick.
Uint8 numHats ()
 Get the number of hats for a joystick.
Uint8 numButtons ()
 Get the number of buttons on a joystick.
Sint16 getAxis (Uint8 axis)
 returns the position of the joystick on a particular axis
unsigned getHat (Uint8 hat)
 returns a mask based on the Hat enum
Point getBall (Uint8 ball)
 return motion delta since last call to getBall()
bool getButton (Uint8 button)
 returns true if pressed, false if not

Static Public Member Functions

static unsigned number ()
 returns the number of joysticks on the system
static Joystickinstance (unsigned n=0)
 returns a particular Joystick, or 0 if n >= number()
static bool handleEvent (const SDL_Event *)
 called by the wftk mainloop

Public Attributes

SigC::Signal2< bool, Uint8,
Sint16, BoolMarshal
axisEvent
 emitted if the joystick axis changes
SigC::Signal2< bool, Uint8,
unsigned, BoolMarshal
hatEvent
 emitted if the joystick hat changes
SigC::Signal2< bool, Uint8,
const Point &, BoolMarshal
ballEvent
 emitted if the joystick trackball changes
SigC::Signal2< bool, Uint8,
bool, BoolMarshal
buttonEvent
 emitted if the joystick button changes


Detailed Description

A class to handle joystick information.


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

Generated Tue Aug 9 18:40:26 2005.
Copyright © 1998-2003 by the respective authors.

This document is licensed under the terms of the GNU Free Documentation License and may be freely distributed under the conditions given by this license.