Version: 3.1.0
wxJoystick Class Reference

#include <wx/joystick.h>

+ Inheritance diagram for wxJoystick:

Detailed Description

wxJoystick allows an application to control one or more joysticks.

Library:  wxAdvanced
Category:  Miscellaneous
See Also
wxJoystickEvent

Public Member Functions

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

Static Public Member Functions

static int GetNumberJoysticks ()
 Returns the number of joysticks currently attached to the computer.
 

Additional Inherited Members

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

Constructor & Destructor Documentation

wxJoystick::wxJoystick ( int  joystick = wxJOYSTICK1)

Constructor.

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

virtual wxJoystick::~wxJoystick ( )
virtual

Destroys the wxJoystick object.

Member Function Documentation

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.

bool wxJoystick::GetButtonState ( unsigned int  id) const

Returns the state of the specified joystick button.

Parameters
idThe button id to report, from 0 to GetNumberButtons() - 1
int wxJoystick::GetManufacturerId ( ) const

Returns the manufacturer id.

int wxJoystick::GetMovementThreshold ( ) const

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

int wxJoystick::GetNumberAxes ( ) const

Returns the number of axes for this joystick.

int wxJoystick::GetNumberButtons ( ) const

Returns the number of buttons for this joystick.

static int wxJoystick::GetNumberJoysticks ( )
static

Returns the number of joysticks currently attached to the computer.

int wxJoystick::GetPollingMax ( ) const

Returns the maximum polling frequency.

int wxJoystick::GetPollingMin ( ) const

Returns the minimum polling frequency.

wxPoint wxJoystick::GetPosition ( ) const

Returns the x, y position of the joystick.

int wxJoystick::GetPosition ( unsigned int  axis) const

Returns the position of the specified joystick axis.

Parameters
axisThe joystick axis to report, from 0 to GetNumberAxes() - 1.
int wxJoystick::GetPOVCTSPosition ( ) const

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

Returns -1 on error.

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.

int wxJoystick::GetProductId ( ) const

Returns the product id for the joystick.

wxString wxJoystick::GetProductName ( ) const

Returns the product name for the joystick.

int wxJoystick::GetRudderMax ( ) const

Returns the maximum rudder position.

int wxJoystick::GetRudderMin ( ) const

Returns the minimum rudder position.

int wxJoystick::GetRudderPosition ( ) const

Returns the rudder position.

int wxJoystick::GetUMax ( ) const

Returns the maximum U position.

int wxJoystick::GetUMin ( ) const

Returns the minimum U position.

int wxJoystick::GetUPosition ( ) const

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

int wxJoystick::GetVMax ( ) const

Returns the maximum V position.

int wxJoystick::GetVMin ( ) const

Returns the minimum V position.

int wxJoystick::GetVPosition ( ) const

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

int wxJoystick::GetXMax ( ) const

Returns the maximum x position.

int wxJoystick::GetXMin ( ) const

Returns the minimum x position.

int wxJoystick::GetYMax ( ) const

Returns the maximum y position.

int wxJoystick::GetYMin ( ) const

Returns the minimum y position.

int wxJoystick::GetZMax ( ) const

Returns the maximum z position.

int wxJoystick::GetZMin ( ) const

Returns the minimum z position.

int wxJoystick::GetZPosition ( ) const

Returns the z position of the joystick.

bool wxJoystick::HasPOV ( ) const

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

bool wxJoystick::HasPOV4Dir ( ) const

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

bool wxJoystick::HasPOVCTS ( ) const

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

bool wxJoystick::HasRudder ( ) const

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

bool wxJoystick::HasU ( ) const

Returns true if the joystick has a U axis.

bool wxJoystick::HasV ( ) const

Returns true if the joystick has a V axis.

bool wxJoystick::HasZ ( ) const

Returns true if the joystick has a Z axis.

bool wxJoystick::IsOk ( ) const

Returns true if the joystick is functioning.

bool wxJoystick::ReleaseCapture ( )

Releases the capture set by SetCapture.

Returns
true if the capture release succeeded.
See Also
SetCapture(), wxJoystickEvent
bool wxJoystick::SetCapture ( wxWindow win,
int  pollingFreq = 0 
)

Sets the capture to direct joystick events to win.

Parameters
winThe window that will receive joystick events.
pollingFreqIf 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
void wxJoystick::SetMovementThreshold ( int  threshold)

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