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