]>
git.saurik.com Git - wxWidgets.git/blob - interface/wx/joystick.h
eb519f3037a52248d5c621f2ce9368a421a3c34d
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: interface of wxJoystick
4 // Author: wxWidgets team
6 // Licence: wxWindows licence
7 /////////////////////////////////////////////////////////////////////////////
12 wxJoystick allows an application to control one or more joysticks.
19 class wxJoystick
: public wxObject
25 @a joystick may be one of wxJOYSTICK1, wxJOYSTICK2, indicating the joystick
26 controller of interest.
28 wxJoystick(int joystick
= wxJOYSTICK1
);
31 Destroys the wxJoystick object.
33 virtual ~wxJoystick();
36 Returns the state of the joystick buttons.
37 Every button is mapped to a single bit in the returned integer, with the
38 first button being mapped to the least significant bit, and so on.
40 A bitlist of wxJOY_BUTTONn identifiers, where n is 1, 2, 3 or 4 is available
41 for historical reasons.
43 int GetButtonState() const;
46 Returns the state of the specified joystick button.
49 The button id to report, from 0 to GetNumberButtons() - 1
51 bool GetButtonState(unsigned int id
) const;
54 Returns the manufacturer id.
56 int GetManufacturerId() const;
59 Returns the movement threshold, the number of steps outside which the joystick
63 int GetMovementThreshold() const;
66 Returns the number of axes for this joystick.
68 int GetNumberAxes() const;
71 Returns the number of buttons for this joystick.
73 int GetNumberButtons() const;
76 Returns the number of joysticks currently attached to the computer.
78 static int GetNumberJoysticks();
81 Returns the point-of-view position, expressed in continuous, one-hundredth of a
86 int GetPOVCTSPosition() const;
89 Returns the point-of-view position, expressed in continuous, one-hundredth of a
90 degree units, but limited to return 0, 9000, 18000 or 27000.
94 int GetPOVPosition() const;
97 Returns the maximum polling frequency.
99 int GetPollingMax() const;
102 Returns the minimum polling frequency.
104 int GetPollingMin() const;
107 Returns the x, y position of the joystick.
109 wxPoint
GetPosition() const;
112 Returns the position of the specified joystick axis.
115 The joystick axis to report, from 0 to GetNumberAxes() - 1.
117 int GetPosition(unsigned int axis
) const;
120 Returns the product id for the joystick.
122 int GetProductId() const;
125 Returns the product name for the joystick.
127 wxString
GetProductName() const;
130 Returns the maximum rudder position.
132 int GetRudderMax() const;
135 Returns the minimum rudder position.
137 int GetRudderMin() const;
140 Returns the rudder position.
142 int GetRudderPosition() const;
145 Returns the maximum U position.
150 Returns the minimum U position.
155 Gets the position of the fifth axis of the joystick, if it exists.
157 int GetUPosition() const;
160 Returns the maximum V position.
165 Returns the minimum V position.
170 Gets the position of the sixth axis of the joystick, if it exists.
172 int GetVPosition() const;
175 Returns the maximum x position.
180 Returns the minimum x position.
185 Returns the maximum y position.
190 Returns the minimum y position.
195 Returns the maximum z position.
200 Returns the minimum z position.
205 Returns the z position of the joystick.
207 int GetZPosition() const;
210 Returns @true if the joystick has a point of view control.
215 Returns @true if the joystick point-of-view supports discrete values
216 (centered, forward, backward, left, and right).
218 bool HasPOV4Dir() const;
221 Returns @true if the joystick point-of-view supports continuous degree bearings.
223 bool HasPOVCTS() const;
226 Returns @true if there is a rudder attached to the computer.
228 bool HasRudder() const;
231 Returns @true if the joystick has a U axis.
236 Returns @true if the joystick has a V axis.
241 Returns @true if the joystick has a Z axis.
246 Returns @true if the joystick is functioning.
251 Releases the capture set by @b SetCapture.
253 @return @true if the capture release succeeded.
255 @see SetCapture(), wxJoystickEvent
257 bool ReleaseCapture();
260 Sets the capture to direct joystick events to @a win.
263 The window that will receive joystick events.
265 If zero, movement events are sent when above the threshold.
266 If greater than zero, events are received every @a pollingFreq milliseconds.
268 @return @true if the capture succeeded.
270 @see ReleaseCapture(), wxJoystickEvent
272 bool SetCapture(wxWindow
* win
, int pollingFreq
= 0);
275 Sets the movement threshold, the number of steps outside which the joystick is
276 deemed to have moved.
278 void SetMovementThreshold(int threshold
);