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