]>
git.saurik.com Git - wxWidgets.git/blob - interface/wx/joystick.h
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: interface of wxJoystick
4 // Author: wxWidgets team
6 // Licence: wxWindows license
7 /////////////////////////////////////////////////////////////////////////////
12 wxJoystick allows an application to control one or more joysticks.
19 class wxJoystick
: public wxObject
23 Constructor. @a joystick may be one of wxJOYSTICK1, wxJOYSTICK2, indicating the
25 controller of interest.
27 wxJoystick(int joystick
= wxJOYSTICK1
);
30 Destroys the wxJoystick object.
32 virtual ~wxJoystick();
36 Returns the state of the specified joystick button.
39 The button id to report, from 0 to GetNumberButtons() - 1
41 int GetButtonState() const;
42 const bool GetButtonState(unsigned id
) const;
46 Returns the manufacturer id.
48 int GetManufacturerId() const;
51 Returns the movement threshold, the number of steps outside which the joystick
55 int GetMovementThreshold() const;
58 Returns the number of axes for this joystick.
60 int GetNumberAxes() const;
63 Returns the number of buttons for this joystick.
65 int GetNumberButtons() const;
68 Returns the number of joysticks currently attached to the computer.
70 static int GetNumberJoysticks();
73 Returns the point-of-view position, expressed in continuous, one-hundredth of a
77 int GetPOVCTSPosition() const;
80 Returns the point-of-view position, expressed in continuous, one-hundredth of a
82 but limited to return 0, 9000, 18000 or 27000.
85 int GetPOVPosition() const;
88 Returns the maximum polling frequency.
90 int GetPollingMax() const;
93 Returns the minimum polling frequency.
95 int GetPollingMin() const;
99 Returns the position of the specified joystick axis.
102 The joystick axis to report, from 0 to GetNumberAxes() - 1.
104 wxPoint
GetPosition() const;
105 const int GetPosition(unsigned axis
) const;
109 Returns the product id for the joystick.
111 int GetProductId() const;
114 Returns the product name for the joystick.
116 wxString
GetProductName() const;
119 Returns the maximum rudder position.
121 int GetRudderMax() const;
124 Returns the minimum rudder position.
126 int GetRudderMin() const;
129 Returns the rudder position.
131 int GetRudderPosition() const;
134 Returns the maximum U position.
139 Returns the minimum U position.
144 Gets the position of the fifth axis of the joystick, if it exists.
146 int GetUPosition() const;
149 Returns the maximum V position.
154 Returns the minimum V position.
159 Gets the position of the sixth axis of the joystick, if it exists.
161 int GetVPosition() const;
164 Returns the maximum x position.
169 Returns the minimum x position.
174 Returns the maximum y position.
179 Returns the minimum y position.
184 Returns the maximum z position.
189 Returns the minimum z position.
194 Returns the z position of the joystick.
196 int GetZPosition() const;
199 Returns @true if the joystick has a point of view control.
204 Returns @true if the joystick point-of-view supports discrete values (centered,
205 forward, backward, left, and right).
207 bool HasPOV4Dir() const;
210 Returns @true if the joystick point-of-view supports continuous degree bearings.
212 #define bool HasPOVCTS() const /* implementation is private */
215 Returns @true if there is a rudder attached to the computer.
217 bool HasRudder() const;
220 Returns @true if the joystick has a U axis.
225 Returns @true if the joystick has a V axis.
230 Returns @true if the joystick has a Z axis.
235 Returns @true if the joystick is functioning.
240 Releases the capture set by @b SetCapture.
242 @return @true if the capture release succeeded.
244 @see SetCapture(), wxJoystickEvent
246 bool ReleaseCapture();
249 Sets the capture to direct joystick events to @e win.
252 The window that will receive joystick events.
254 If zero, movement events are sent when above the
255 threshold. If greater than zero, events are received every pollingFreq
258 @return @true if the capture succeeded.
260 @see ReleaseCapture(), wxJoystickEvent
262 bool SetCapture(wxWindow
* win
, int pollingFreq
= 0);
265 Sets the movement threshold, the number of steps outside which the joystick is
269 void SetMovementThreshold(int threshold
);