]>
git.saurik.com Git - wxWidgets.git/blob - interface/joystick.h
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: interface of wxJoystick
4 // Author: wxWidgets team
6 // Licence: wxWindows license
7 /////////////////////////////////////////////////////////////////////////////
13 wxJoystick allows an application to control one or more joysticks.
20 class wxJoystick
: public wxObject
24 Constructor. @a joystick may be one of wxJOYSTICK1, wxJOYSTICK2, indicating the
26 controller of interest.
28 wxJoystick(int joystick
= wxJOYSTICK1
);
31 Destroys the wxJoystick object.
37 Returns the state of the specified joystick button.
40 The button id to report, from 0 to GetNumberButtons() - 1
42 int GetButtonState() const;
43 const bool GetButtonState(unsigned id
) const;
47 Returns the manufacturer id.
49 int GetManufacturerId() const;
52 Returns the movement threshold, the number of steps outside which the joystick
56 int GetMovementThreshold() const;
59 Returns the number of axes for this joystick.
61 int GetNumberAxes() const;
64 Returns the number of buttons for this joystick.
66 int GetNumberButtons() const;
69 Returns the number of joysticks currently attached to the computer.
71 static int GetNumberJoysticks();
74 Returns the point-of-view position, expressed in continuous, one-hundredth of a
78 int GetPOVCTSPosition() const;
81 Returns the point-of-view position, expressed in continuous, one-hundredth of a
83 but limited to return 0, 9000, 18000 or 27000.
86 int GetPOVPosition() const;
89 Returns the maximum polling frequency.
91 int GetPollingMax() const;
94 Returns the minimum polling frequency.
96 int GetPollingMin() const;
100 Returns the position of the specified joystick axis.
103 The joystick axis to report, from 0 to GetNumberAxes() - 1.
105 wxPoint
GetPosition() const;
106 const int GetPosition(unsigned axis
) const;
110 Returns the product id for the joystick.
112 int GetProductId() const;
115 Returns the product name for the joystick.
117 wxString
GetProductName() const;
120 Returns the maximum rudder position.
122 int GetRudderMax() const;
125 Returns the minimum rudder position.
127 int GetRudderMin() const;
130 Returns the rudder position.
132 int GetRudderPosition() const;
135 Returns the maximum U position.
140 Returns the minimum U position.
145 Gets the position of the fifth axis of the joystick, if it exists.
147 int GetUPosition() const;
150 Returns the maximum V position.
155 Returns the minimum V position.
160 Gets the position of the sixth axis of the joystick, if it exists.
162 int GetVPosition() const;
165 Returns the maximum x position.
170 Returns the minimum x position.
175 Returns the maximum y position.
180 Returns the minimum y position.
185 Returns the maximum z position.
190 Returns the minimum z position.
195 Returns the z position of the joystick.
197 int GetZPosition() const;
200 Returns @true if the joystick has a point of view control.
205 Returns @true if the joystick point-of-view supports discrete values (centered,
206 forward, backward, left, and right).
208 bool HasPOV4Dir() const;
211 Returns @true if the joystick point-of-view supports continuous degree bearings.
213 #define bool HasPOVCTS() const /* implementation is private */
216 Returns @true if there is a rudder attached to the computer.
218 bool HasRudder() const;
221 Returns @true if the joystick has a U axis.
226 Returns @true if the joystick has a V axis.
231 Returns @true if the joystick has a Z axis.
236 Returns @true if the joystick is functioning.
241 Releases the capture set by @b SetCapture.
243 @return @true if the capture release succeeded.
245 @see SetCapture(), wxJoystickEvent
247 bool ReleaseCapture();
250 Sets the capture to direct joystick events to @e win.
253 The window that will receive joystick events.
255 If zero, movement events are sent when above the
256 threshold. If greater than zero, events are received every pollingFreq
259 @return @true if the capture succeeded.
261 @see ReleaseCapture(), wxJoystickEvent
263 bool SetCapture(wxWindow
* win
, int pollingFreq
= 0);
266 Sets the movement threshold, the number of steps outside which the joystick is
270 void SetMovementThreshold(int threshold
);