#include <inp_joystick.hh>

Public Types | |
| enum | eAxis { eAxis_NONE, eAxis_LEFT_RIGHT, eAxis_UP_DOWN, eAxis_THIRD } |
| enum | eButton { eButton_NONE, eButton_1, eButton_2, eButton_3, eButton_4, eButton_LAST = eButton_4 } |
Public Member Functions | |
| virtual void | PrintStatus (void)=0 |
| bool | Enable (bool flag=true) |
| enable/disable joystick, returns true if present/enabled | |
| bool | IfEnabled (void) |
| bool | CalibrateDefault (void) |
| bool | CalibrateMin (int left, int right, int up, int down, int slow, int fast) |
| throttle | |
| bool | CalibrateMax (int left, int right, int up, int down, int slow, int fast) |
| throttle | |
| bool | CalibrateDeadzone (const int dz[3]) |
| bool | CalibrateDirection (const int d[3]) |
Public Attributes | |
| CLASS_CONST int | JOY_LO = 8000 |
| Joystick axis extremes. | |
| CLASS_CONST int | JOY_HI = 32767 |
| keep this 32767 | |
| Calibration | mCalibration |
| TinyArray< 3, int > | mAxisDir |
| to reverse an axis | |
Protected Member Functions | |
| Joystick (void) | |
| virtual | ~Joystick () |
| virtual bool | PollEvent (Event &event)=0 |
| virtual bool | Open (void)=0 |
| virtual void | Close (void)=0 |
Protected Attributes | |
| CLASS_VAR int | msInstanceCnt |
| counts an instance of any class of Joystick | |
| bool | mEnabled |
| base Enable() assigns from derived Open()/Close() | |
Private Member Functions | |
| void | PollAndEnqueueEvents (const uint limit=JOY_EVENT_ENQUEUE_LIMIT) |
| enqueues into InputQueue | |
| int | CheckMin (int val) |
| int | CheckMax (int val) |
Private Attributes | |
| CLASS_CONST uint | JOY_EVENT_ENQUEUE_LIMIT = 20 |
| limit the enqueueing of events per tick | |
Friends | |
| class | Global |
| class | InputQueue |
Classes | |
| struct | Calibration |
| class | Event |
| Joystick event class. More... | |
| enum inp::Joystick::eAxis |
| inp::Joystick::Joystick | ( | void | ) | [protected] |
ctor/dtor. Joystick is initially disabled to give chance for client/module to become ready to respond to joystick events.
| inp::Joystick::~Joystick | ( | ) | [protected, virtual] |
| virtual void inp::Joystick::PrintStatus | ( | void | ) | [pure virtual] |
Implemented in inp::JoystickGlut, and inp::JoystickNop.
| bool inp::Joystick::Enable | ( | bool | enable = true |
) |
enable/disable joystick, returns true if present/enabled
Enable/disable joystick.
| bool inp::Joystick::IfEnabled | ( | void | ) | [inline] |
| bool inp::Joystick::CalibrateDefault | ( | void | ) |
Default joystick calibration.
| bool inp::Joystick::CalibrateMin | ( | int | left, | |
| int | right, | |||
| int | up, | |||
| int | down, | |||
| int | slow, | |||
| int | fast | |||
| ) |
throttle
Set joystick calibration (range of axises). Can tolerate bad args (from cmd-line). The sign of the args don't matter.
| bool inp::Joystick::CalibrateMax | ( | int | left, | |
| int | right, | |||
| int | up, | |||
| int | down, | |||
| int | slow, | |||
| int | fast | |||
| ) |
throttle
| bool inp::Joystick::CalibrateDeadzone | ( | const int | dz[3] | ) |
Set joystick center/deadzone. Can tolerate bad args (from cmd-line). Not as accurate since same deadzone value is reused for both directions but is convenient.
| bool inp::Joystick::CalibrateDirection | ( | const int | d[3] | ) |
Set joystick axis directions. Can tolerate bad args (from cmd-line).
| void inp::Joystick::PollAndEnqueueEvents | ( | const uint | limit = JOY_EVENT_ENQUEUE_LIMIT |
) | [private] |
enqueues into InputQueue
Poll all joystick events (up to a limit) from Linux driver and enqueue them into InputQueue.
| virtual bool inp::Joystick::PollEvent | ( | Event & | event | ) | [protected, pure virtual] |
| virtual bool inp::Joystick::Open | ( | void | ) | [protected, pure virtual] |
Implemented in inp::JoystickGlut, and inp::JoystickNop.
| virtual void inp::Joystick::Close | ( | void | ) | [protected, pure virtual] |
Implemented in inp::JoystickGlut, and inp::JoystickNop.
| int inp::Joystick::CheckMin | ( | int | val | ) | [private] |
Check/correct joystick value. SIDE-EFFECT: May return a value with a different sign.
| int inp::Joystick::CheckMax | ( | int | val | ) | [private] |
friend class Global [friend] |
Reimplemented in inp::JoystickGlut.
friend class InputQueue [friend] |
| CLASS_CONST int inp::Joystick::JOY_LO = 8000 |
Joystick axis extremes.
JOY_LO can be changed
| CLASS_CONST int inp::Joystick::JOY_HI = 32767 |
keep this 32767
CLASS_CONST uint inp::Joystick::JOY_EVENT_ENQUEUE_LIMIT = 20 [private] |
limit the enqueueing of events per tick
int inp::Joystick::msInstanceCnt [protected] |
counts an instance of any class of Joystick
bool inp::Joystick::mEnabled [protected] |
| TinyArray<3,int> inp::Joystick::mAxisDir |
to reverse an axis
Palomino 3D Engine documents generated by doxygen 1.5.3 on Fri Nov 23 11:26:28 2007