]> git.saurik.com Git - wxWidgets.git/blob - interface/wx/joystick.h
general docview.cpp code cleanup; use wxVector<> instead of manually-allocated arrays...
[wxWidgets.git] / interface / wx / joystick.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: joystick.h
3 // Purpose: interface of wxJoystick
4 // Author: wxWidgets team
5 // RCS-ID: $Id$
6 // Licence: wxWindows license
7 /////////////////////////////////////////////////////////////////////////////
8
9 /**
10 @class wxJoystick
11
12 wxJoystick allows an application to control one or more joysticks.
13
14 @library{wxadv}
15 @category{FIXME}
16
17 @see wxJoystickEvent
18 */
19 class wxJoystick : public wxObject
20 {
21 public:
22 /**
23 Constructor. @a joystick may be one of wxJOYSTICK1, wxJOYSTICK2, indicating the
24 joystick
25 controller of interest.
26 */
27 wxJoystick(int joystick = wxJOYSTICK1);
28
29 /**
30 Destroys the wxJoystick object.
31 */
32 ~wxJoystick();
33
34 //@{
35 /**
36 Returns the state of the specified joystick button.
37
38 @param id
39 The button id to report, from 0 to GetNumberButtons() - 1
40 */
41 int GetButtonState() const;
42 const bool GetButtonState(unsigned id) const;
43 //@}
44
45 /**
46 Returns the manufacturer id.
47 */
48 int GetManufacturerId() const;
49
50 /**
51 Returns the movement threshold, the number of steps outside which the joystick
52 is deemed to have
53 moved.
54 */
55 int GetMovementThreshold() const;
56
57 /**
58 Returns the number of axes for this joystick.
59 */
60 int GetNumberAxes() const;
61
62 /**
63 Returns the number of buttons for this joystick.
64 */
65 int GetNumberButtons() const;
66
67 /**
68 Returns the number of joysticks currently attached to the computer.
69 */
70 static int GetNumberJoysticks();
71
72 /**
73 Returns the point-of-view position, expressed in continuous, one-hundredth of a
74 degree units.
75 Returns -1 on error.
76 */
77 int GetPOVCTSPosition() const;
78
79 /**
80 Returns the point-of-view position, expressed in continuous, one-hundredth of a
81 degree units,
82 but limited to return 0, 9000, 18000 or 27000.
83 Returns -1 on error.
84 */
85 int GetPOVPosition() const;
86
87 /**
88 Returns the maximum polling frequency.
89 */
90 int GetPollingMax() const;
91
92 /**
93 Returns the minimum polling frequency.
94 */
95 int GetPollingMin() const;
96
97 //@{
98 /**
99 Returns the position of the specified joystick axis.
100
101 @param axis
102 The joystick axis to report, from 0 to GetNumberAxes() - 1.
103 */
104 wxPoint GetPosition() const;
105 const int GetPosition(unsigned axis) const;
106 //@}
107
108 /**
109 Returns the product id for the joystick.
110 */
111 int GetProductId() const;
112
113 /**
114 Returns the product name for the joystick.
115 */
116 wxString GetProductName() const;
117
118 /**
119 Returns the maximum rudder position.
120 */
121 int GetRudderMax() const;
122
123 /**
124 Returns the minimum rudder position.
125 */
126 int GetRudderMin() const;
127
128 /**
129 Returns the rudder position.
130 */
131 int GetRudderPosition() const;
132
133 /**
134 Returns the maximum U position.
135 */
136 int GetUMax() const;
137
138 /**
139 Returns the minimum U position.
140 */
141 int GetUMin() const;
142
143 /**
144 Gets the position of the fifth axis of the joystick, if it exists.
145 */
146 int GetUPosition() const;
147
148 /**
149 Returns the maximum V position.
150 */
151 int GetVMax() const;
152
153 /**
154 Returns the minimum V position.
155 */
156 int GetVMin() const;
157
158 /**
159 Gets the position of the sixth axis of the joystick, if it exists.
160 */
161 int GetVPosition() const;
162
163 /**
164 Returns the maximum x position.
165 */
166 int GetXMax() const;
167
168 /**
169 Returns the minimum x position.
170 */
171 int GetXMin() const;
172
173 /**
174 Returns the maximum y position.
175 */
176 int GetYMax() const;
177
178 /**
179 Returns the minimum y position.
180 */
181 int GetYMin() const;
182
183 /**
184 Returns the maximum z position.
185 */
186 int GetZMax() const;
187
188 /**
189 Returns the minimum z position.
190 */
191 int GetZMin() const;
192
193 /**
194 Returns the z position of the joystick.
195 */
196 int GetZPosition() const;
197
198 /**
199 Returns @true if the joystick has a point of view control.
200 */
201 bool HasPOV() const;
202
203 /**
204 Returns @true if the joystick point-of-view supports discrete values (centered,
205 forward, backward, left, and right).
206 */
207 bool HasPOV4Dir() const;
208
209 /**
210 Returns @true if the joystick point-of-view supports continuous degree bearings.
211 */
212 #define bool HasPOVCTS() const /* implementation is private */
213
214 /**
215 Returns @true if there is a rudder attached to the computer.
216 */
217 bool HasRudder() const;
218
219 /**
220 Returns @true if the joystick has a U axis.
221 */
222 bool HasU() const;
223
224 /**
225 Returns @true if the joystick has a V axis.
226 */
227 bool HasV() const;
228
229 /**
230 Returns @true if the joystick has a Z axis.
231 */
232 bool HasZ() const;
233
234 /**
235 Returns @true if the joystick is functioning.
236 */
237 bool IsOk() const;
238
239 /**
240 Releases the capture set by @b SetCapture.
241
242 @return @true if the capture release succeeded.
243
244 @see SetCapture(), wxJoystickEvent
245 */
246 bool ReleaseCapture();
247
248 /**
249 Sets the capture to direct joystick events to @e win.
250
251 @param win
252 The window that will receive joystick events.
253 @param pollingFreq
254 If zero, movement events are sent when above the
255 threshold. If greater than zero, events are received every pollingFreq
256 milliseconds.
257
258 @return @true if the capture succeeded.
259
260 @see ReleaseCapture(), wxJoystickEvent
261 */
262 bool SetCapture(wxWindow* win, int pollingFreq = 0);
263
264 /**
265 Sets the movement threshold, the number of steps outside which the joystick is
266 deemed to have
267 moved.
268 */
269 void SetMovementThreshold(int threshold);
270 };
271