| Version: 3.2.8

Public Member Functions | Static Public Member Functions | List of all members
wxJoystick Class Reference
Class List by Category » Miscellaneous

`#include <wx/joystick.h>`

Inheritance diagram for wxJoystick:
[legend]

## Detailed Description

wxJoystick allows an application to control one or more joysticks.

##

Library: wxCore
Category: Miscellaneous

See also
  wxJoystickEvent

## Public Member Functions
| wxJoystick (int joystick=wxJOYSTICK1)
| Constructor. More...
virtual | ~wxJoystick ()
| Destroys the wxJoystick object. More...
int | GetButtonState () const
| Returns the state of the joystick buttons. More...
bool | GetButtonState (unsigned int id) const
| Returns the state of the specified joystick button. More...
int | GetManufacturerId () const
| Returns the manufacturer id. More...
int | GetMovementThreshold () const
| Returns the movement threshold, the number of steps outside which the joystick is deemed to have moved. More...
int | GetNumberAxes () const
| Returns the number of axes for this joystick. More...
int | GetNumberButtons () const
| Returns the number of buttons for this joystick. More...
int | GetPOVCTSPosition () const
| Returns the point-of-view position, expressed in continuous, one-hundredth of a degree units. More...
int | GetPOVPosition () const
| Returns the point-of-view position, expressed in continuous, one-hundredth of a degree units, but limited to return 0, 9000, 18000 or 27000. More...
int | GetPollingMax () const
| Returns the maximum polling frequency. More...
int | GetPollingMin () const
| Returns the minimum polling frequency. More...
wxPoint | GetPosition () const
| Returns the x, y position of the joystick. More...
int | GetPosition (unsigned int axis) const
| Returns the position of the specified joystick axis. More...
int | GetProductId () const
| Returns the product id for the joystick. More...
wxString | GetProductName () const
| Returns the product name for the joystick. More...
int | GetRudderMax () const
| Returns the maximum rudder position. More...
int | GetRudderMin () const
| Returns the minimum rudder position. More...
int | GetRudderPosition () const
| Returns the rudder position. More...
int | GetUMax () const
| Returns the maximum U position. More...
int | GetUMin () const
| Returns the minimum U position. More...
int | GetUPosition () const
| Gets the position of the fifth axis of the joystick, if it exists. More...
int | GetVMax () const
| Returns the maximum V position. More...
int | GetVMin () const
| Returns the minimum V position. More...
int | GetVPosition () const
| Gets the position of the sixth axis of the joystick, if it exists. More...
int | GetXMax () const
| Returns the maximum x position. More...
int | GetXMin () const
| Returns the minimum x position. More...
int | GetYMax () const
| Returns the maximum y position. More...
int | GetYMin () const
| Returns the minimum y position. More...
int | GetZMax () const
| Returns the maximum z position. More...
int | GetZMin () const
| Returns the minimum z position. More...
int | GetZPosition () const
| Returns the z position of the joystick. More...
bool | HasPOV () const
| Returns true if the joystick has a point of view control. More...
bool | HasPOV4Dir () const
| Returns true if the joystick point-of-view supports discrete values (centered, forward, backward, left, and right). More...
bool | HasPOVCTS () const
| Returns true if the joystick point-of-view supports continuous degree bearings. More...
bool | HasRudder () const
| Returns true if there is a rudder attached to the computer. More...
bool | HasU () const
| Returns true if the joystick has a U axis. More...
bool | HasV () const
| Returns true if the joystick has a V axis. More...
bool | HasZ () const
| Returns true if the joystick has a Z axis. More...
bool | IsOk () const
| Returns true if the joystick is functioning. More...
bool | ReleaseCapture ()
| Releases the capture set by SetCapture. More...
bool | SetCapture (wxWindow *win, int pollingFreq=0)
| Sets the capture to direct joystick events to win. More...
void | SetMovementThreshold (int threshold)
| Sets the movement threshold, the number of steps outside which the joystick is deemed to have moved. More...
Public Member Functions inherited from wxObject
| wxObject ()
| Default ctor; initializes to NULL the internal reference data. More...
| wxObject (const wxObject &other)
| Copy ctor. More...
virtual | ~wxObject ()
| Destructor. More...
virtual wxClassInfo * | GetClassInfo () const
| This virtual function is redefined for every class that requires run-time type information, when using the wxDECLARE_CLASS macro (or similar). More...
wxObjectRefData * | GetRefData () const
| Returns the wxObject::m_refData pointer, i.e. the data referenced by this object. More...
bool | IsKindOf (const wxClassInfo *info) const
| Determines whether this class is a subclass of (or the same class as) the given class. More...
bool | IsSameAs (const wxObject &obj) const
| Returns true if this object has the same data pointer as obj. More...
void | Ref (const wxObject &clone)
| Makes this object refer to the data in clone. More...
void | SetRefData (wxObjectRefData *data)
| Sets the wxObject::m_refData pointer. More...
void | UnRef ()
| Decrements the reference count in the associated data, and if it is zero, deletes the data. More...
void | UnShare ()
| This is the same of AllocExclusive() but this method is public. More...
void | operator delete (void *buf)
| The delete operator is defined for debugging versions of the library only, when the identifier `__WXDEBUG__` is defined. More...
void * | operator new (size_t size, const wxString &filename=NULL, int lineNum=0)
| The new operator is defined for debugging versions of the library only, when the identifier `__WXDEBUG__` is defined. More...

## Static Public Member Functions
static int | GetNumberJoysticks ()
| Returns the number of joysticks currently attached to the computer. More...

## Additional Inherited Members
Protected Member Functions inherited from wxObject
void | AllocExclusive ()
| Ensure that this object's data is not shared with any other object. More...
virtual wxObjectRefData * | CreateRefData () const
| Creates a new instance of the wxObjectRefData-derived class specific to this object and returns it. More...
virtual wxObjectRefData * | CloneRefData (const wxObjectRefData *data) const
| Creates a new instance of the wxObjectRefData-derived class specific to this object and initializes it copying data. More...
Protected Attributes inherited from wxObject
wxObjectRefData * | m_refData
| Pointer to an object which is the object's reference-counted data. More...

## Constructor & Destructor Documentation

## ◆ wxJoystick()

wxJoystick::wxJoystick | ( | int | joystick = `wxJOYSTICK1` | ) |

Constructor.

joystick may be one of wxJOYSTICK1, wxJOYSTICK2, indicating the joystick controller of interest.

## ◆ ~wxJoystick()

virtual wxJoystick::~wxJoystick | ( |  | ) |
| virtual

Destroys the wxJoystick object.

## Member Function Documentation

## ◆ GetButtonState() [1/2]

int wxJoystick::GetButtonState | ( |  | ) | const

Returns the state of the joystick buttons.

Every button is mapped to a single bit in the returned integer, with the first button being mapped to the least significant bit, and so on.

A bitlist of wxJOY_BUTTONn identifiers, where n is 1, 2, 3 or 4 is available for historical reasons.

## ◆ GetButtonState() [2/2]

bool wxJoystick::GetButtonState | ( | unsigned int | id | ) | const

Returns the state of the specified joystick button.

Parameters

  id | The button id to report, from 0 to GetNumberButtons() - 1

## ◆ GetManufacturerId()

int wxJoystick::GetManufacturerId | ( |  | ) | const

Returns the manufacturer id.

## ◆ GetMovementThreshold()

int wxJoystick::GetMovementThreshold | ( |  | ) | const

Returns the movement threshold, the number of steps outside which the joystick is deemed to have moved.

## ◆ GetNumberAxes()

int wxJoystick::GetNumberAxes | ( |  | ) | const

Returns the number of axes for this joystick.

## ◆ GetNumberButtons()

int wxJoystick::GetNumberButtons | ( |  | ) | const

Returns the number of buttons for this joystick.

## ◆ GetNumberJoysticks()

static int wxJoystick::GetNumberJoysticks | ( |  | ) |
| static

Returns the number of joysticks currently attached to the computer.

## ◆ GetPollingMax()

int wxJoystick::GetPollingMax | ( |  | ) | const

Returns the maximum polling frequency.

## ◆ GetPollingMin()

int wxJoystick::GetPollingMin | ( |  | ) | const

Returns the minimum polling frequency.

## ◆ GetPosition() [1/2]

wxPoint wxJoystick::GetPosition | ( |  | ) | const

Returns the x, y position of the joystick.

## ◆ GetPosition() [2/2]

int wxJoystick::GetPosition | ( | unsigned int | axis | ) | const

Returns the position of the specified joystick axis.

Parameters

  axis | The joystick axis to report, from 0 to GetNumberAxes() - 1.

## ◆ GetPOVCTSPosition()

int wxJoystick::GetPOVCTSPosition | ( |  | ) | const

Returns the point-of-view position, expressed in continuous, one-hundredth of a degree units.

Returns -1 on error.

## ◆ GetPOVPosition()

int wxJoystick::GetPOVPosition | ( |  | ) | const

Returns the point-of-view position, expressed in continuous, one-hundredth of a degree units, but limited to return 0, 9000, 18000 or 27000.

Returns -1 on error.

## ◆ GetProductId()

int wxJoystick::GetProductId | ( |  | ) | const

Returns the product id for the joystick.

## ◆ GetProductName()

wxString wxJoystick::GetProductName | ( |  | ) | const

Returns the product name for the joystick.

## ◆ GetRudderMax()

int wxJoystick::GetRudderMax | ( |  | ) | const

Returns the maximum rudder position.

## ◆ GetRudderMin()

int wxJoystick::GetRudderMin | ( |  | ) | const

Returns the minimum rudder position.

## ◆ GetRudderPosition()

int wxJoystick::GetRudderPosition | ( |  | ) | const

Returns the rudder position.

## ◆ GetUMax()

int wxJoystick::GetUMax | ( |  | ) | const

Returns the maximum U position.

## ◆ GetUMin()

int wxJoystick::GetUMin | ( |  | ) | const

Returns the minimum U position.

## ◆ GetUPosition()

int wxJoystick::GetUPosition | ( |  | ) | const

Gets the position of the fifth axis of the joystick, if it exists.

## ◆ GetVMax()

int wxJoystick::GetVMax | ( |  | ) | const

Returns the maximum V position.

## ◆ GetVMin()

int wxJoystick::GetVMin | ( |  | ) | const

Returns the minimum V position.

## ◆ GetVPosition()

int wxJoystick::GetVPosition | ( |  | ) | const

Gets the position of the sixth axis of the joystick, if it exists.

## ◆ GetXMax()

int wxJoystick::GetXMax | ( |  | ) | const

Returns the maximum x position.

## ◆ GetXMin()

int wxJoystick::GetXMin | ( |  | ) | const

Returns the minimum x position.

## ◆ GetYMax()

int wxJoystick::GetYMax | ( |  | ) | const

Returns the maximum y position.

## ◆ GetYMin()

int wxJoystick::GetYMin | ( |  | ) | const

Returns the minimum y position.

## ◆ GetZMax()

int wxJoystick::GetZMax | ( |  | ) | const

Returns the maximum z position.

## ◆ GetZMin()

int wxJoystick::GetZMin | ( |  | ) | const

Returns the minimum z position.

## ◆ GetZPosition()

int wxJoystick::GetZPosition | ( |  | ) | const

Returns the z position of the joystick.

## ◆ HasPOV()

bool wxJoystick::HasPOV | ( |  | ) | const

Returns true if the joystick has a point of view control.

## ◆ HasPOV4Dir()

bool wxJoystick::HasPOV4Dir | ( |  | ) | const

Returns true if the joystick point-of-view supports discrete values (centered, forward, backward, left, and right).

## ◆ HasPOVCTS()

bool wxJoystick::HasPOVCTS | ( |  | ) | const

Returns true if the joystick point-of-view supports continuous degree bearings.

## ◆ HasRudder()

bool wxJoystick::HasRudder | ( |  | ) | const

Returns true if there is a rudder attached to the computer.

## ◆ HasU()

bool wxJoystick::HasU | ( |  | ) | const

Returns true if the joystick has a U axis.

## ◆ HasV()

bool wxJoystick::HasV | ( |  | ) | const

Returns true if the joystick has a V axis.

## ◆ HasZ()

bool wxJoystick::HasZ | ( |  | ) | const

Returns true if the joystick has a Z axis.

## ◆ IsOk()

bool wxJoystick::IsOk | ( |  | ) | const

Returns true if the joystick is functioning.

## ◆ ReleaseCapture()

bool wxJoystick::ReleaseCapture | ( |  | ) |

Releases the capture set by SetCapture.

Returns
  true if the capture release succeeded.

See also
  SetCapture(), wxJoystickEvent

## ◆ SetCapture()

bool wxJoystick::SetCapture | ( | wxWindow * | win,
|  | int | pollingFreq = `0`
| ) |  |

Sets the capture to direct joystick events to win.

Parameters

  win | The window that will receive joystick events.
  pollingFreq | If zero, movement events are sent when above the threshold. If greater than zero, events are received every pollingFreq milliseconds.

Returns
  true if the capture succeeded.

See also
  ReleaseCapture(), wxJoystickEvent

## ◆ SetMovementThreshold()

void wxJoystick::SetMovementThreshold | ( | int | threshold | ) |

Sets the movement threshold, the number of steps outside which the joystick is deemed to have moved.