]>
git.saurik.com Git - wxWidgets.git/blob - interface/wx/joystick.h
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: interface of wxJoystick
4 // Author: wxWidgets team
5 // Licence: wxWindows licence
6 /////////////////////////////////////////////////////////////////////////////
11 wxJoystick allows an application to control one or more joysticks.
18 class wxJoystick
: public wxObject
24 @a joystick may be one of wxJOYSTICK1, wxJOYSTICK2, indicating the joystick
25 controller of interest.
27 wxJoystick(int joystick
= wxJOYSTICK1
);
30 Destroys the wxJoystick object.
32 virtual ~wxJoystick();
35 Returns the state of the joystick buttons.
36 Every button is mapped to a single bit in the returned integer, with the
37 first button being mapped to the least significant bit, and so on.
39 A bitlist of wxJOY_BUTTONn identifiers, where n is 1, 2, 3 or 4 is available
40 for historical reasons.
42 int GetButtonState() const;
45 Returns the state of the specified joystick button.
48 The button id to report, from 0 to GetNumberButtons() - 1
50 bool GetButtonState(unsigned int id
) const;
53 Returns the manufacturer id.
55 int GetManufacturerId() const;
58 Returns the movement threshold, the number of steps outside which the joystick
62 int GetMovementThreshold() const;
65 Returns the number of axes for this joystick.
67 int GetNumberAxes() const;
70 Returns the number of buttons for this joystick.
72 int GetNumberButtons() const;
75 Returns the number of joysticks currently attached to the computer.
77 static int GetNumberJoysticks();
80 Returns the point-of-view position, expressed in continuous, one-hundredth of a
85 int GetPOVCTSPosition() const;
88 Returns the point-of-view position, expressed in continuous, one-hundredth of a
89 degree units, but limited to return 0, 9000, 18000 or 27000.
93 int GetPOVPosition() const;
96 Returns the maximum polling frequency.
98 int GetPollingMax() const;
101 Returns the minimum polling frequency.
103 int GetPollingMin() const;
106 Returns the x, y position of the joystick.
108 wxPoint
GetPosition() const;
111 Returns the position of the specified joystick axis.
114 The joystick axis to report, from 0 to GetNumberAxes() - 1.
116 int GetPosition(unsigned int axis
) const;
119 Returns the product id for the joystick.
121 int GetProductId() const;
124 Returns the product name for the joystick.
126 wxString
GetProductName() const;
129 Returns the maximum rudder position.
131 int GetRudderMax() const;
134 Returns the minimum rudder position.
136 int GetRudderMin() const;
139 Returns the rudder position.
141 int GetRudderPosition() const;
144 Returns the maximum U position.
149 Returns the minimum U position.
154 Gets the position of the fifth axis of the joystick, if it exists.
156 int GetUPosition() const;
159 Returns the maximum V position.
164 Returns the minimum V position.
169 Gets the position of the sixth axis of the joystick, if it exists.
171 int GetVPosition() const;
174 Returns the maximum x position.
179 Returns the minimum x position.
184 Returns the maximum y position.
189 Returns the minimum y position.
194 Returns the maximum z position.
199 Returns the minimum z position.
204 Returns the z position of the joystick.
206 int GetZPosition() const;
209 Returns @true if the joystick has a point of view control.
214 Returns @true if the joystick point-of-view supports discrete values
215 (centered, forward, backward, left, and right).
217 bool HasPOV4Dir() const;
220 Returns @true if the joystick point-of-view supports continuous degree bearings.
222 bool HasPOVCTS() const;
225 Returns @true if there is a rudder attached to the computer.
227 bool HasRudder() const;
230 Returns @true if the joystick has a U axis.
235 Returns @true if the joystick has a V axis.
240 Returns @true if the joystick has a Z axis.
245 Returns @true if the joystick is functioning.
250 Releases the capture set by @b SetCapture.
252 @return @true if the capture release succeeded.
254 @see SetCapture(), wxJoystickEvent
256 bool ReleaseCapture();
259 Sets the capture to direct joystick events to @a win.
262 The window that will receive joystick events.
264 If zero, movement events are sent when above the threshold.
265 If greater than zero, events are received every @a pollingFreq milliseconds.
267 @return @true if the capture succeeded.
269 @see ReleaseCapture(), wxJoystickEvent
271 bool SetCapture(wxWindow
* win
, int pollingFreq
= 0);
274 Sets the movement threshold, the number of steps outside which the joystick is
275 deemed to have moved.
277 void SetMovementThreshold(int threshold
);