| ## Public API Reference

- Main Page
- Modules
- Namespaces
- Classes
- Files
- Related Pages

- Alphabetical List
- Class List
- Class Hierarchy
- Class Members

# iJoystickDriver Struct Reference
[Event handling, Event handling]

Generic Joystick driver. More...

`#include <iutil/csinput.h>`

Inheritance diagram for iJoystickDriver:

[legend]
List of all members.

## Public Member Functions
virtual void | DoButton (uint number, int button, bool down, const int32 *axes, uint numAxes)=0
| Call this to add a 'button down/up' event to queue.
virtual void | DoMotion (uint number, const int32 *axes, uint nunmAxes)=0
| Call this to add a 'moved' event to queue for joystick 'number'.
virtual int | GetLast (uint number, uint axis) const =0
| Query last position on 'axis' of joystick 'number'.
virtual const int32 * | GetLast (uint number) const =0
| Query last position on all axes of joystick 'number'.
virtual bool | GetLastButton (uint number, int button) const =0
| Query the last known button state of joystick 'number'.
virtual int | GetLastX (uint number) const =0
| Query last X position of joystick 'number'.
virtual int | GetLastY (uint number) const =0
| Query last Y position of joystick 'number'.
virtual void | Reset ()=0
| Call to release all joystick buttons (when focus switches from application window, for example).

## Detailed Description

Generic Joystick driver.

The joystick driver is responsible for tracking current joystick state and also for synthesizing joystick movement events. Multiple joysticks are supported; they are numbered starting at zero. Joystick button numbers also start at zero. Typically, a single instance of this object is available from the shared-object registry (iObjectRegistry) under the name "crystalspace.driver.input.generic.joystick".

Main creators of instances implementing this interface:

- csInitializer::CreateEnvironment()
- csInitializer::CreateInputDrivers()

Main ways to get pointers to this interface:

- CS_QUERY_REGISTRY()

Definition at line 233 of file csinput.h.

## Member Function Documentation

virtual void iJoystickDriver::DoButton | ( | uint | number,
|  | int | button,
|  | bool | down,
|  | const int32 * | axes,
|  | uint | numAxes |
| ) |  |  | `[pure virtual]`

Call this to add a 'button down/up' event to queue.

Joystick numbers start at 0. Button numbers start at 0.

Implemented in csJoystickDriver.

virtual void iJoystickDriver::DoMotion | ( | uint | number,
|  | const int32 * | axes,
|  | uint | nunmAxes |
| ) |  |  | `[pure virtual]`

Call this to add a 'moved' event to queue for joystick 'number'.

Implemented in csJoystickDriver.

virtual int iJoystickDriver::GetLast | ( | uint | number,
|  | uint | axis |
| ) |  |  | const`[pure virtual]`

Query last position on 'axis' of joystick 'number'.

Implemented in csJoystickDriver.

virtual const int32* iJoystickDriver::GetLast | ( | uint | number | ) | const`[pure virtual]`

Query last position on all axes of joystick 'number'.

Implemented in csJoystickDriver.

virtual bool iJoystickDriver::GetLastButton | ( | uint | number,
|  | int | button |
| ) |  |  | const`[pure virtual]`

Query the last known button state of joystick 'number'.

Joystick numbers start at 0. Button numbers start at 0.

Implemented in csJoystickDriver.

virtual int iJoystickDriver::GetLastX | ( | uint | number | ) | const`[pure virtual]`

Query last X position of joystick 'number'.

Implemented in csJoystickDriver.

virtual int iJoystickDriver::GetLastY | ( | uint | number | ) | const`[pure virtual]`

Query last Y position of joystick 'number'.

Implemented in csJoystickDriver.

virtual void iJoystickDriver::Reset | ( |  | ) | `[pure virtual]`

Call to release all joystick buttons (when focus switches from application window, for example).

Implemented in csJoystickDriver.

The documentation for this struct was generated from the following file:

- iutil/csinput.h