Mercurial > sdl-ios-xcode
comparison include/SDL_haptic.h @ 3407:d3baf5ac4e37
Partial fix for bug #859
Header file update from Ken for improved doxygen output
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Mon, 19 Oct 2009 13:31:58 +0000 |
parents | 0906692aa6a4 |
children | 78fc8ea578b2 |
comparison
equal
deleted
inserted
replaced
3406:8ae607392409 | 3407:d3baf5ac4e37 |
---|---|
19 Sam Lantinga | 19 Sam Lantinga |
20 slouken@libsdl.org | 20 slouken@libsdl.org |
21 */ | 21 */ |
22 | 22 |
23 /** | 23 /** |
24 * \file SDL_haptic.h | 24 * \file SDL_haptic.h |
25 * | 25 * |
26 * \brief The SDL Haptic subsystem allows you to control haptic (force feedback) | 26 * \brief The SDL Haptic subsystem allows you to control haptic (force feedback) |
27 * devices. | 27 * devices. |
28 * | 28 * |
29 * The basic usage is as follows: | 29 * The basic usage is as follows: |
30 * - Initialize the Subsystem (SDL_INIT_HAPTIC). | 30 * - Initialize the Subsystem (::SDL_INIT_HAPTIC). |
31 * - Open a Haptic Device. | 31 * - Open a Haptic Device. |
32 * - SDL_HapticOpen(...) to open from index. | 32 * - SDL_HapticOpen() to open from index. |
33 * - SDL_HapticOpenFromJoystick(...) to open from an existing joystick. | 33 * - SDL_HapticOpenFromJoystick() to open from an existing joystick. |
34 * - Create an effect (SDL_HapticEffect). | 34 * - Create an effect (::SDL_HapticEffect). |
35 * - Upload the effect with SDL_HapticNewEffect(...). | 35 * - Upload the effect with SDL_HapticNewEffect(). |
36 * - Run the effect with SDL_HapticRunEffect(...). | 36 * - Run the effect with SDL_HapticRunEffect(). |
37 * - (optional) Free the effect with SDL_HapticDestroyEffect(...). | 37 * - (optional) Free the effect with SDL_HapticDestroyEffect(). |
38 * - Close the haptic device with SDL_HapticClose(...). | 38 * - Close the haptic device with SDL_HapticClose(). |
39 * | 39 * |
40 * Example: | 40 * \par Example: |
41 * | |
42 * \code | 41 * \code |
43 * int test_haptic( SDL_Joystick * joystick ) { | 42 * int test_haptic( SDL_Joystick * joystick ) { |
44 * SDL_Haptic *haptic; | 43 * SDL_Haptic *haptic; |
45 * SDL_HapticEffect effect; | 44 * SDL_HapticEffect effect; |
46 * int effect_id; | 45 * int effect_id; |
80 * SDL_HapticClose(haptic); | 79 * SDL_HapticClose(haptic); |
81 * | 80 * |
82 * return 0; // Success | 81 * return 0; // Success |
83 * } | 82 * } |
84 * \endcode | 83 * \endcode |
85 * | |
86 * \author Edgar Simo Serra | 84 * \author Edgar Simo Serra |
87 */ | 85 */ |
88 | 86 |
89 #ifndef _SDL_haptic_h | 87 #ifndef _SDL_haptic_h |
90 #define _SDL_haptic_h | 88 #define _SDL_haptic_h |
100 extern "C" { | 98 extern "C" { |
101 /* *INDENT-ON* */ | 99 /* *INDENT-ON* */ |
102 #endif /* __cplusplus */ | 100 #endif /* __cplusplus */ |
103 | 101 |
104 /** | 102 /** |
105 * \typedef SDL_Haptic | 103 * \typedef SDL_Haptic |
106 * | 104 * |
107 * \brief The haptic structure used to identify an SDL haptic. | 105 * \brief The haptic structure used to identify an SDL haptic. |
108 * | 106 * |
109 * \sa SDL_HapticOpen | 107 * \sa SDL_HapticOpen |
110 * \sa SDL_HapticOpenFromJoystick | 108 * \sa SDL_HapticOpenFromJoystick |
111 * \sa SDL_HapticClose | 109 * \sa SDL_HapticClose |
112 */ | 110 */ |
113 struct _SDL_Haptic; | 111 struct _SDL_Haptic; |
114 typedef struct _SDL_Haptic SDL_Haptic; | 112 typedef struct _SDL_Haptic SDL_Haptic; |
115 | 113 |
116 | 114 |
117 /* | 115 /** |
118 * Different haptic features a device can have. | 116 * \name Haptic features |
119 */ | 117 * |
120 /** | 118 * Different haptic features a device can have. |
121 * \def SDL_HAPTIC_CONSTANT | 119 */ |
122 * | 120 /*@{*/ |
123 * \brief Constant haptic effect. | 121 |
124 * | 122 /** |
125 * \sa SDL_HapticCondition | 123 * \name Haptic effects |
126 */ | 124 */ |
127 #define SDL_HAPTIC_CONSTANT (1<<0) /* Constant effect supported */ | 125 /*@{*/ |
128 /** | 126 |
129 * \def SDL_HAPTIC_SINE | 127 /** |
130 * | 128 * \brief Constant effect supported. |
131 * \brief Periodic haptic effect that simulates sine waves. | 129 * |
132 * | 130 * Constant haptic effect. |
133 * \sa SDL_HapticPeriodic | 131 * |
134 */ | 132 * \sa SDL_HapticCondition |
135 #define SDL_HAPTIC_SINE (1<<1) /* Sine wave effect supported */ | 133 */ |
136 /** | 134 #define SDL_HAPTIC_CONSTANT (1<<0) |
137 * \def SDL_HAPTIC_SQUARE | 135 |
138 * | 136 /** |
139 * \brief Periodic haptic effect that simulates square waves. | 137 * \brief Sine wave effect supported. |
138 * | |
139 * Periodic haptic effect that simulates sine waves. | |
140 * | |
141 * \sa SDL_HapticPeriodic | |
142 */ | |
143 #define SDL_HAPTIC_SINE (1<<1) | |
144 | |
145 /** | |
146 * \brief Square wave effect supported. | |
147 * | |
148 * Periodic haptic effect that simulates square waves. | |
140 * | 149 * |
141 * \sa SDL_HapticPeriodic | 150 * \sa SDL_HapticPeriodic |
142 */ | 151 */ |
143 #define SDL_HAPTIC_SQUARE (1<<2) /* Square wave effect supported */ | 152 #define SDL_HAPTIC_SQUARE (1<<2) |
144 /** | 153 |
145 * \def SDL_HAPTIC_TRIANGLE | 154 /** |
146 * | 155 * \brief Triangle wave effect supported. |
147 * \brief Periodic haptic effect that simulates triangular waves. | 156 * |
148 * | 157 * Periodic haptic effect that simulates triangular waves. |
149 * \sa SDL_HapticPeriodic | 158 * |
150 */ | 159 * \sa SDL_HapticPeriodic |
151 #define SDL_HAPTIC_TRIANGLE (1<<3) /* Triangle wave effect supported */ | 160 */ |
152 /** | 161 #define SDL_HAPTIC_TRIANGLE (1<<3) |
153 * \def SDL_HAPTIC_SAWTOOTHUP | 162 |
154 * | 163 /** |
155 * \brief Periodic haptic effect that simulates saw tooth up waves. | 164 * \brief Sawtoothup wave effect supported. |
156 * | 165 * |
157 * \sa SDL_HapticPeriodic | 166 * Periodic haptic effect that simulates saw tooth up waves. |
158 */ | 167 * |
159 #define SDL_HAPTIC_SAWTOOTHUP (1<<4) /* Sawtoothup wave effect supported */ | 168 * \sa SDL_HapticPeriodic |
160 /** | 169 */ |
161 * \def SDL_HAPTIC_SAWTOOTHDOWN | 170 #define SDL_HAPTIC_SAWTOOTHUP (1<<4) |
162 * | 171 |
163 * \brief Periodic haptic effect that simulates saw tooth down waves. | 172 /** |
164 * | 173 * \brief Sawtoothdown wave effect supported. |
165 * \sa SDL_HapticPeriodic | 174 * |
166 */ | 175 * Periodic haptic effect that simulates saw tooth down waves. |
167 #define SDL_HAPTIC_SAWTOOTHDOWN (1<<5) /* Sawtoothdown wave effect supported */ | 176 * |
168 /** | 177 * \sa SDL_HapticPeriodic |
169 * \def SDL_HAPTIC_RAMP | 178 */ |
170 * | 179 #define SDL_HAPTIC_SAWTOOTHDOWN (1<<5) |
171 * \brief Ramp haptic effect. | 180 |
172 * | 181 /** |
173 * \sa SDL_HapticRamp | 182 * \brief Ramp effect supported. |
174 */ | 183 * |
175 #define SDL_HAPTIC_RAMP (1<<6) /* Ramp effect supported */ | 184 * Ramp haptic effect. |
176 /** | 185 * |
177 * \def SDL_HAPTIC_SPRING | 186 * \sa SDL_HapticRamp |
178 * | 187 */ |
179 * \brief Condition haptic effect that simulates a spring. Effect is based on the | 188 #define SDL_HAPTIC_RAMP (1<<6) |
180 * axes position. | 189 |
181 * | 190 /** |
182 * \sa SDL_HapticCondition | 191 * \brief Spring effect supported - uses axes position. |
183 */ | 192 * |
184 #define SDL_HAPTIC_SPRING (1<<7) /* Spring effect supported - uses axes position */ | 193 * Condition haptic effect that simulates a spring. Effect is based on the |
185 /** | 194 * axes position. |
186 * \def SDL_HAPTIC_DAMPER | 195 * |
187 * | 196 * \sa SDL_HapticCondition |
188 * \brief Condition haptic effect that simulates dampening. Effect is based on the | 197 */ |
189 * axes velocity. | 198 #define SDL_HAPTIC_SPRING (1<<7) |
190 * | 199 |
191 * \sa SDL_HapticCondition | 200 /** |
192 */ | 201 * \brief Damper effect supported - uses axes velocity. |
193 #define SDL_HAPTIC_DAMPER (1<<8) /* Damper effect supported - uses axes velocity */ | 202 * |
194 /** | 203 * Condition haptic effect that simulates dampening. Effect is based on the |
195 * \def SDL_HAPTIC_INERTIA | 204 * axes velocity. |
196 * | 205 * |
197 * \brief Condition haptic effect that simulates inertia. Effect is based on the axes | 206 * \sa SDL_HapticCondition |
198 * acceleration. | 207 */ |
199 * | 208 #define SDL_HAPTIC_DAMPER (1<<8) |
200 * \sa SDL_HapticCondition | 209 |
201 */ | 210 /** |
202 #define SDL_HAPTIC_INERTIA (1<<9) /* Inertia effect supported - uses axes acceleration */ | 211 * \brief Inertia effect supported - uses axes acceleration. |
203 /** | 212 * |
204 * \def SDL_HAPTIC_FRICTION | 213 * Condition haptic effect that simulates inertia. Effect is based on the axes |
205 * | 214 * acceleration. |
206 * \brief Condition haptic effect that simulates friction. Effect is based on the axes | 215 * |
207 * movement. | 216 * \sa SDL_HapticCondition |
208 * | 217 */ |
209 * \sa SDL_HapticCondition | 218 #define SDL_HAPTIC_INERTIA (1<<9) |
210 */ | 219 |
211 #define SDL_HAPTIC_FRICTION (1<<10) /* Friction effect supported - uses axes movement */ | 220 /** |
212 /** | 221 * \brief Friction effect supported - uses axes movement. |
213 * \def SDL_HAPTIC_CUSTOM | 222 * |
214 * | 223 * Condition haptic effect that simulates friction. Effect is based on the |
215 * \brief User defined custom haptic effect. | 224 * axes movement. |
216 */ | 225 * |
217 #define SDL_HAPTIC_CUSTOM (1<<11) /* Custom effect is supported */ | 226 * \sa SDL_HapticCondition |
218 /* These last two are features the device has, not effects */ | 227 */ |
219 /** | 228 #define SDL_HAPTIC_FRICTION (1<<10) |
220 * \def SDL_HAPTIC_GAIN | 229 |
221 * | 230 /** |
222 * \brief Device supports setting the global gain. | 231 * \brief Custom effect is supported. |
223 * | 232 * |
224 * \sa SDL_HapticSetGain | 233 * User defined custom haptic effect. |
225 */ | 234 */ |
226 #define SDL_HAPTIC_GAIN (1<<12) /* Device can set global gain */ | 235 #define SDL_HAPTIC_CUSTOM (1<<11) |
227 /** | 236 |
228 * \def SDL_HAPTIC_AUTOCENTER | 237 /*@}*//*Haptic effects*/ |
229 * | 238 |
230 * \brief Device supports setting autocenter. | 239 /* These last few are features the device has, not effects */ |
231 * | 240 |
232 * \sa SDL_HapticSetAutocenter | 241 /** |
233 */ | 242 * \brief Device can set global gain. |
234 #define SDL_HAPTIC_AUTOCENTER (1<<13) /* Device can set autocenter */ | 243 * |
235 /** | 244 * Device supports setting the global gain. |
236 * \def SDL_HAPTIC_STATUS | 245 * |
237 * | 246 * \sa SDL_HapticSetGain |
238 * \brief Device can be queried for effect status. | 247 */ |
239 * | 248 #define SDL_HAPTIC_GAIN (1<<12) |
240 * \sa SDL_HapticGetEffectStatus | 249 |
241 */ | 250 /** |
242 #define SDL_HAPTIC_STATUS (1<<14) /* Device can be queried for effect status */ | 251 * \brief Device can set autocenter. |
243 /** | 252 * |
244 * \def SDL_HAPTIC_PAUSE | 253 * Device supports setting autocenter. |
245 * | 254 * |
246 * \brief Device can be paused. | 255 * \sa SDL_HapticSetAutocenter |
247 * | 256 */ |
248 * \sa SDL_HapticPause | 257 #define SDL_HAPTIC_AUTOCENTER (1<<13) |
249 * \sa SDL_HapticUnpause | 258 |
250 */ | 259 /** |
251 #define SDL_HAPTIC_PAUSE (1<<15) /* Device can be paused. */ | 260 * \brief Device can be queried for effect status. |
252 | 261 * |
253 | 262 * Device can be queried for effect status. |
254 /* | 263 * |
255 * Direction encodings | 264 * \sa SDL_HapticGetEffectStatus |
256 */ | 265 */ |
257 /** | 266 #define SDL_HAPTIC_STATUS (1<<14) |
258 * \def SDL_HAPTIC_POLAR | 267 |
259 * | 268 /** |
260 * \brief Uses polar coordinates for the direction. | 269 * \brief Device can be paused. |
261 * | 270 * |
262 * \sa SDL_HapticDirection | 271 * \sa SDL_HapticPause |
272 * \sa SDL_HapticUnpause | |
273 */ | |
274 #define SDL_HAPTIC_PAUSE (1<<15) | |
275 | |
276 | |
277 /** | |
278 * \name Direction encodings | |
279 */ | |
280 /*@{*/ | |
281 | |
282 /** | |
283 * \brief Uses polar coordinates for the direction. | |
284 * | |
285 * \sa SDL_HapticDirection | |
263 */ | 286 */ |
264 #define SDL_HAPTIC_POLAR 0 | 287 #define SDL_HAPTIC_POLAR 0 |
265 /** | 288 |
266 * \def SDL_HAPTIC_CARTESIAN | 289 /** |
267 * | 290 * \brief Uses cartesian coordinates for the direction. |
268 * \brief Uses cartesian coordinates for the direction. | 291 * |
269 * | 292 * \sa SDL_HapticDirection |
270 * \sa SDL_HapticDirection | |
271 */ | 293 */ |
272 #define SDL_HAPTIC_CARTESIAN 1 | 294 #define SDL_HAPTIC_CARTESIAN 1 |
273 /** | 295 |
274 * \def SDL_HAPTIC_SPHERICAL | 296 /** |
275 * | 297 * \brief Uses spherical coordinates for the direction. |
276 * \brief Uses spherical coordinates for the direction. | 298 * |
277 * | 299 * \sa SDL_HapticDirection |
278 * \sa SDL_HapticDirection | |
279 */ | 300 */ |
280 #define SDL_HAPTIC_SPHERICAL 2 | 301 #define SDL_HAPTIC_SPHERICAL 2 |
281 | 302 |
303 /*@}*//*Direction encodings*/ | |
304 | |
305 /*@}*//*Haptic features*/ | |
282 | 306 |
283 /* | 307 /* |
284 * Misc defines. | 308 * Misc defines. |
285 */ | 309 */ |
286 /** | 310 |
287 * \def SDL_HAPTIC_INFINITY | 311 /** |
288 * | |
289 * \brief Used to play a device an infinite number of times. | 312 * \brief Used to play a device an infinite number of times. |
290 * | 313 * |
291 * \sa SDL_HapticRunEffect | 314 * \sa SDL_HapticRunEffect |
292 */ | 315 */ |
293 #define SDL_HAPTIC_INFINITY 4294967295U | 316 #define SDL_HAPTIC_INFINITY 4294967295U |
294 | 317 |
295 | 318 |
296 /** | 319 /** |
297 * \struct SDL_HapticDirection | 320 * \brief Structure that represents a haptic direction. |
298 * | 321 * |
299 * \brief Structure that represents a haptic direction. | 322 * Directions can be specified by: |
300 * | 323 * - ::SDL_HAPTIC_POLAR : Specified by polar coordinates. |
301 * Directions can be specified by: | 324 * - ::SDL_HAPTIC_CARTESIAN : Specified by cartesian coordinates. |
302 * - SDL_HAPTIC_POLAR : Specified by polar coordinates. | 325 * - ::SDL_HAPTIC_SPHERICAL : Specified by spherical coordinates. |
303 * - SDL_HAPTIC_CARTESIAN : Specified by cartesian coordinates. | 326 * |
304 * - SDL_HAPTIC_SPHERICAL : Specified by spherical coordinates. | 327 * Cardinal directions of the haptic device are relative to the positioning |
305 * | |
306 * Cardinal directions of the haptic device are relative to the positioning | |
307 * of the device. North is considered to be away from the user. | 328 * of the device. North is considered to be away from the user. |
308 * | 329 * |
309 * The following diagram represents the cardinal directions: | 330 * The following diagram represents the cardinal directions: |
310 * \code | 331 * \verbatim |
311 * .--. | 332 .--. |
312 * |__| .-------. | 333 |__| .-------. |
313 * |=.| |.-----.| | 334 |=.| |.-----.| |
314 * |--| || || | 335 |--| || || |
315 * | | |'-----'| | 336 | | |'-----'| |
316 * |__|~')_____(' | 337 |__|~')_____(' |
317 * [ COMPUTER ] | 338 [ COMPUTER ] |
318 * | 339 |
319 * | 340 |
320 * North (0,-1) | 341 North (0,-1) |
321 * ^ | 342 ^ |
322 * | | 343 | |
323 * | | 344 | |
324 * (1,0) West <----[ HAPTIC ]----> East (-1,0) | 345 (1,0) West <----[ HAPTIC ]----> East (-1,0) |
325 * | | 346 | |
326 * | | 347 | |
327 * v | 348 v |
328 * South (0,1) | 349 South (0,1) |
329 * | 350 |
330 * | 351 |
331 * [ USER ] | 352 [ USER ] |
332 * \|||/ | 353 \|||/ |
333 * (o o) | 354 (o o) |
334 * ---ooO-(_)-Ooo--- | 355 ---ooO-(_)-Ooo--- |
335 * \endcode | 356 \endverbatim |
336 * | 357 * |
337 * If type is SDL_HAPTIC_POLAR, direction is encoded by hundredths of a | 358 * If type is ::SDL_HAPTIC_POLAR, direction is encoded by hundredths of a |
338 * degree starting north and turning clockwise. SDL_HAPTIC_POLAR only uses | 359 * degree starting north and turning clockwise. ::SDL_HAPTIC_POLAR only uses |
339 * the first dir parameter. The cardinal directions would be: | 360 * the first \c dir parameter. The cardinal directions would be: |
340 * - North: 0 (0 degrees) | 361 * - North: 0 (0 degrees) |
341 * - East: 9000 (90 degrees) | 362 * - East: 9000 (90 degrees) |
342 * - South: 18000 (180 degrees) | 363 * - South: 18000 (180 degrees) |
343 * - West: 27000 (270 degrees) | 364 * - West: 27000 (270 degrees) |
344 * | 365 * |
345 * If type is SDL_HAPTIC_CARTESIAN, direction is encoded by three positions | 366 * If type is ::SDL_HAPTIC_CARTESIAN, direction is encoded by three positions |
346 * (X axis, Y axis and Z axis (with 3 axes)). SDL_HAPTIC_CARTESIAN uses | 367 * (X axis, Y axis and Z axis (with 3 axes)). ::SDL_HAPTIC_CARTESIAN uses |
347 * the first three dir parameters. The cardinal directions would be: | 368 * the first three \c dir parameters. The cardinal directions would be: |
348 * - North: 0,-1, 0 | 369 * - North: 0,-1, 0 |
349 * - East: -1, 0, 0 | 370 * - East: -1, 0, 0 |
350 * - South: 0, 1, 0 | 371 * - South: 0, 1, 0 |
351 * - West: 1, 0, 0 | 372 * - West: 1, 0, 0 |
373 * | |
352 * The Z axis represents the height of the effect if supported, otherwise | 374 * The Z axis represents the height of the effect if supported, otherwise |
353 * it's unused. In cartesian encoding (1,2) would be the same as (2,4), you | 375 * it's unused. In cartesian encoding (1, 2) would be the same as (2, 4), you |
354 * can use any multiple you want, only the direction matters. | 376 * can use any multiple you want, only the direction matters. |
355 * | 377 * |
356 * If type is SDL_HAPTIC_SPHERICAL, direction is encoded by two rotations. | 378 * If type is ::SDL_HAPTIC_SPHERICAL, direction is encoded by two rotations. |
357 * The first two dir parameters are used. The dir parameters are as follows | 379 * The first two \c dir parameters are used. The \c dir parameters are as |
358 * (all values are in hundredths of degrees): | 380 * follows (all values are in hundredths of degrees): |
359 * 1) Degrees from (1, 0) rotated towards (0, 1). | 381 * - Degrees from (1, 0) rotated towards (0, 1). |
360 * 2) Degrees towards (0, 0, 1) (device needs at least 3 axes). | 382 * - Degrees towards (0, 0, 1) (device needs at least 3 axes). |
361 * | 383 * |
362 * | 384 * |
363 * Example of force coming from the south with all encodings (force coming | 385 * Example of force coming from the south with all encodings (force coming |
364 * from the south means the user will have to pull the stick to counteract): | 386 * from the south means the user will have to pull the stick to counteract): |
365 * \code | 387 * \code |
366 * SDL_HapticDirection direction; | 388 * SDL_HapticDirection direction; |
367 * | 389 * |
368 * // Cartesian directions | 390 * // Cartesian directions |
369 * direction.type = SDL_HAPTIC_CARTESIAN; // Using cartesian direction encoding. | 391 * direction.type = SDL_HAPTIC_CARTESIAN; // Using cartesian direction encoding. |
370 * direction.dir[0] = 0; // X position | 392 * direction.dir[0] = 0; // X position |
371 * direction.dir[1] = 1; // Y position | 393 * direction.dir[1] = 1; // Y position |
372 * // Assuming the device has 2 axes, we don't need to specify third parameter. | 394 * // Assuming the device has 2 axes, we don't need to specify third parameter. |
373 * | 395 * |
374 * // Polar directions | 396 * // Polar directions |
375 * direction.type = SDL_HAPTIC_POLAR; // We'll be using polar direction encoding. | 397 * direction.type = SDL_HAPTIC_POLAR; // We'll be using polar direction encoding. |
376 * direction.dir[0] = 18000; // Polar only uses first parameter | 398 * direction.dir[0] = 18000; // Polar only uses first parameter |
377 * | 399 * |
378 * // Spherical coordinates | 400 * // Spherical coordinates |
379 * direction.type = SDL_HAPTIC_SPHERICAL; // Spherical encoding | 401 * direction.type = SDL_HAPTIC_SPHERICAL; // Spherical encoding |
380 * direction.dir[0] = 9000; // Since we only have two axes we don't need more parameters. | 402 * direction.dir[0] = 9000; // Since we only have two axes we don't need more parameters. |
381 * \endcode | 403 * \endcode |
382 * | 404 * |
383 * \sa SDL_HAPTIC_POLAR | 405 * \sa SDL_HAPTIC_POLAR |
384 * \sa SDL_HAPTIC_CARTESIAN | 406 * \sa SDL_HAPTIC_CARTESIAN |
385 * \sa SDL_HAPTIC_SPHERICAL | 407 * \sa SDL_HAPTIC_SPHERICAL |
386 * \sa SDL_HapticEffect | 408 * \sa SDL_HapticEffect |
387 * \sa SDL_HapticNumAxes | 409 * \sa SDL_HapticNumAxes |
388 */ | 410 */ |
389 typedef struct SDL_HapticDirection | 411 typedef struct SDL_HapticDirection |
390 { | 412 { |
391 Uint8 type; /**< The type of encoding. */ | 413 Uint8 type; /**< The type of encoding. */ |
392 Uint16 dir[3]; /**< The encoded direction. */ | 414 Uint16 dir[3]; /**< The encoded direction. */ |
393 } SDL_HapticDirection; | 415 } SDL_HapticDirection; |
394 | 416 |
395 | 417 |
396 /** | 418 /** |
397 * \struct SDL_HapticConstant | 419 * \brief A structure containing a template for a Constant effect. |
398 * | 420 * |
399 * \brief A structure containing a template for a Constant effect. | 421 * The struct is exclusive to the ::SDL_HAPTIC_CONSTANT effect. |
400 * | 422 * |
401 * The struct is exclusive to the SDL_HAPTIC_CONSTANT effect. | 423 * A constant effect applies a constant force in the specified direction |
402 * | |
403 * A constant effect applies a constant force in the specified direction | |
404 * to the joystick. | 424 * to the joystick. |
405 * | 425 * |
406 * \sa SDL_HAPTIC_CONSTANT | 426 * \sa SDL_HAPTIC_CONSTANT |
407 * \sa SDL_HapticEffect | 427 * \sa SDL_HapticEffect |
408 */ | 428 */ |
409 typedef struct SDL_HapticConstant | 429 typedef struct SDL_HapticConstant |
410 { | 430 { |
411 /* Header */ | 431 /* Header */ |
412 Uint16 type; /**< SDL_HAPTIC_CONSTANT */ | 432 Uint16 type; /**< ::SDL_HAPTIC_CONSTANT */ |
413 SDL_HapticDirection direction; /**< Direction of the effect. */ | 433 SDL_HapticDirection direction; /**< Direction of the effect. */ |
414 | 434 |
415 /* Replay */ | 435 /* Replay */ |
416 Uint32 length; /**< Duration of the effect. */ | 436 Uint32 length; /**< Duration of the effect. */ |
417 Uint16 delay; /**< Delay before starting the effect. */ | 437 Uint16 delay; /**< Delay before starting the effect. */ |
427 Uint16 attack_length; /**< Duration of the attack. */ | 447 Uint16 attack_length; /**< Duration of the attack. */ |
428 Uint16 attack_level; /**< Level at the start of the attack. */ | 448 Uint16 attack_level; /**< Level at the start of the attack. */ |
429 Uint16 fade_length; /**< Duration of the fade. */ | 449 Uint16 fade_length; /**< Duration of the fade. */ |
430 Uint16 fade_level; /**< Level at the end of the fade. */ | 450 Uint16 fade_level; /**< Level at the end of the fade. */ |
431 } SDL_HapticConstant; | 451 } SDL_HapticConstant; |
432 /** | 452 |
433 * \struct SDL_HapticPeriodic | 453 /** |
434 * | 454 * \brief A structure containing a template for a Periodic effect. |
435 * \brief A structure containing a template for a Periodic effect. | 455 * |
436 * | 456 * The struct handles the following effects: |
437 * The struct handles the following effects: | 457 * - ::SDL_HAPTIC_SINE |
438 * - SDL_HAPTIC_SINE | 458 * - ::SDL_HAPTIC_SQUARE |
439 * - SDL_HAPTIC_SQUARE | 459 * - ::SDL_HAPTIC_TRIANGLE |
440 * - SDL_HAPTIC_TRIANGLE | 460 * - ::SDL_HAPTIC_SAWTOOTHUP |
441 * - SDL_HAPTIC_SAWTOOTHUP | 461 * - ::SDL_HAPTIC_SAWTOOTHDOWN |
442 * - SDL_HAPTIC_SAWTOOTHDOWN | 462 * |
443 * | 463 * A periodic effect consists in a wave-shaped effect that repeats itself |
444 * A periodic effect consists in a wave-shaped effect that repeats itself | |
445 * over time. The type determines the shape of the wave and the parameters | 464 * over time. The type determines the shape of the wave and the parameters |
446 * determine the dimensions of the wave. | 465 * determine the dimensions of the wave. |
447 * | 466 * |
448 * Phase is given by hundredth of a cyle meaning that giving the phase a value | 467 * Phase is given by hundredth of a cyle meaning that giving the phase a value |
449 * of 9000 will displace it 25% of it's period. Here are sample values: | 468 * of 9000 will displace it 25% of it's period. Here are sample values: |
450 * - 0: No phase displacement. | 469 * - 0: No phase displacement. |
451 * - 9000: Displaced 25% of it's period. | 470 * - 9000: Displaced 25% of it's period. |
452 * - 18000: Displaced 50% of it's period. | 471 * - 18000: Displaced 50% of it's period. |
453 * - 27000: Displaced 75% of it's period. | 472 * - 27000: Displaced 75% of it's period. |
454 * - 36000: Displaced 100% of it's period, same as 0, but 0 is preffered. | 473 * - 36000: Displaced 100% of it's period, same as 0, but 0 is preffered. |
455 * | 474 * |
456 * Examples: | 475 * Examples: |
457 * \code | 476 * \verbatim |
458 * SDL_HAPTIC_SINE | 477 SDL_HAPTIC_SINE |
459 * __ __ __ __ | 478 __ __ __ __ |
460 * / \ / \ / \ / | 479 / \ / \ / \ / |
461 * / \__/ \__/ \__/ | 480 / \__/ \__/ \__/ |
462 * | 481 |
463 * SDL_HAPTIC_SQUARE | 482 SDL_HAPTIC_SQUARE |
464 * __ __ __ __ __ | 483 __ __ __ __ __ |
465 * | | | | | | | | | | | 484 | | | | | | | | | | |
466 * | |__| |__| |__| |__| | | 485 | |__| |__| |__| |__| | |
467 * | 486 |
468 * SDL_HAPTIC_TRIANGLE | 487 SDL_HAPTIC_TRIANGLE |
469 * /\ /\ /\ /\ /\ | 488 /\ /\ /\ /\ /\ |
470 * / \ / \ / \ / \ / | 489 / \ / \ / \ / \ / |
471 * / \/ \/ \/ \/ | 490 / \/ \/ \/ \/ |
472 * | 491 |
473 * SDL_HAPTIC_SAWTOOTHUP | 492 SDL_HAPTIC_SAWTOOTHUP |
474 * /| /| /| /| /| /| /| | 493 /| /| /| /| /| /| /| |
475 * / | / | / | / | / | / | / | | 494 / | / | / | / | / | / | / | |
476 * / |/ |/ |/ |/ |/ |/ | | 495 / |/ |/ |/ |/ |/ |/ | |
477 * | 496 |
478 * SDL_HAPTIC_SAWTOOTHDOWN | 497 SDL_HAPTIC_SAWTOOTHDOWN |
479 * \ |\ |\ |\ |\ |\ |\ | | 498 \ |\ |\ |\ |\ |\ |\ | |
480 * \ | \ | \ | \ | \ | \ | \ | | 499 \ | \ | \ | \ | \ | \ | \ | |
481 * \| \| \| \| \| \| \| | 500 \| \| \| \| \| \| \| |
482 * \endcode | 501 \endverbatim |
483 * | 502 * |
484 * \sa SDL_HAPTIC_SINE | 503 * \sa SDL_HAPTIC_SINE |
485 * \sa SDL_HAPTIC_SQUARE | 504 * \sa SDL_HAPTIC_SQUARE |
486 * \sa SDL_HAPTIC_TRIANGLE | 505 * \sa SDL_HAPTIC_TRIANGLE |
487 * \sa SDL_HAPTIC_SAWTOOTHUP | 506 * \sa SDL_HAPTIC_SAWTOOTHUP |
488 * \sa SDL_HAPTIC_SAWTOOTHDOWN | 507 * \sa SDL_HAPTIC_SAWTOOTHDOWN |
489 * \sa SDL_HapticEffect | 508 * \sa SDL_HapticEffect |
490 */ | 509 */ |
491 typedef struct SDL_HapticPeriodic | 510 typedef struct SDL_HapticPeriodic |
492 { | 511 { |
493 /* Header */ | 512 /* Header */ |
494 Uint16 type; /**< SDL_HAPTIC_SINE, SDL_HAPTIC_SQUARE, | 513 Uint16 type; /**< ::SDL_HAPTIC_SINE, ::SDL_HAPTIC_SQUARE, |
495 SDL_HAPTIC_TRIANGLE, SDL_HAPTIC_SAWTOOTHUP or | 514 ::SDL_HAPTIC_TRIANGLE, ::SDL_HAPTIC_SAWTOOTHUP or |
496 SDL_HAPTIC_SAWTOOTHDOWN */ | 515 ::SDL_HAPTIC_SAWTOOTHDOWN */ |
497 SDL_HapticDirection direction; /**< Direction of the effect. */ | 516 SDL_HapticDirection direction; /**< Direction of the effect. */ |
498 | 517 |
499 /* Replay */ | 518 /* Replay */ |
500 Uint32 length; /**< Duration of the effect. */ | 519 Uint32 length; /**< Duration of the effect. */ |
501 Uint16 delay; /**< Delay before starting the effect. */ | 520 Uint16 delay; /**< Delay before starting the effect. */ |
514 Uint16 attack_length; /**< Duration of the attack. */ | 533 Uint16 attack_length; /**< Duration of the attack. */ |
515 Uint16 attack_level; /**< Level at the start of the attack. */ | 534 Uint16 attack_level; /**< Level at the start of the attack. */ |
516 Uint16 fade_length; /**< Duration of the fade. */ | 535 Uint16 fade_length; /**< Duration of the fade. */ |
517 Uint16 fade_level; /**< Level at the end of the fade. */ | 536 Uint16 fade_level; /**< Level at the end of the fade. */ |
518 } SDL_HapticPeriodic; | 537 } SDL_HapticPeriodic; |
519 /** | 538 |
520 * \struct SDL_HapticCondition | 539 /** |
521 * | 540 * \brief A structure containing a template for a Condition effect. |
522 * \brief A structure containing a template for a Condition effect. | 541 * |
523 * | 542 * The struct handles the following effects: |
524 * The struct handles the following effects: | 543 * - ::SDL_HAPTIC_SPRING: Effect based on axes position. |
525 * - SDL_HAPTIC_SPRING: Effect based on axes position. | 544 * - ::SDL_HAPTIC_DAMPER: Effect based on axes velocity. |
526 * - SDL_HAPTIC_DAMPER: Effect based on axes velocity. | 545 * - ::SDL_HAPTIC_INERTIA: Effect based on axes acceleration. |
527 * - SDL_HAPTIC_INERTIA: Effect based on axes acceleration. | 546 * - ::SDL_HAPTIC_FRICTION: Effect based on axes movement. |
528 * - SDL_HAPTIC_FRICTION: Effect based on axes movement. | 547 * |
529 * | 548 * Direction is handled by condition internals instead of a direction member. |
530 * Direction is handled by condition internals instead of a direction member. | |
531 * The condition effect specific members have three parameters. The first | 549 * The condition effect specific members have three parameters. The first |
532 * refers to the X axis, the second refers to the Y axis and the third | 550 * refers to the X axis, the second refers to the Y axis and the third |
533 * refers to the Z axis. The right terms refer to the positive side of the | 551 * refers to the Z axis. The right terms refer to the positive side of the |
534 * axis and the left terms refer to the negative side of the axis. Please | 552 * axis and the left terms refer to the negative side of the axis. Please |
535 * refer to the SDL_HapticDirection diagram for which side is positive and | 553 * refer to the ::SDL_HapticDirection diagram for which side is positive and |
536 * which is negative. | 554 * which is negative. |
537 * | 555 * |
538 * \sa SDL_HapticDirection | 556 * \sa SDL_HapticDirection |
539 * \sa SDL_HAPTIC_SPRING | 557 * \sa SDL_HAPTIC_SPRING |
540 * \sa SDL_HAPTIC_DAMPER | 558 * \sa SDL_HAPTIC_DAMPER |
541 * \sa SDL_HAPTIC_INERTIA | 559 * \sa SDL_HAPTIC_INERTIA |
542 * \sa SDL_HAPTIC_FRICTION | 560 * \sa SDL_HAPTIC_FRICTION |
543 * \sa SDL_HapticEffect | 561 * \sa SDL_HapticEffect |
544 */ | 562 */ |
545 typedef struct SDL_HapticCondition | 563 typedef struct SDL_HapticCondition |
546 { | 564 { |
547 /* Header */ | 565 /* Header */ |
548 Uint16 type; /**< SDL_HAPTIC_SPRING, SDL_HAPTIC_DAMPER, | 566 Uint16 type; /**< ::SDL_HAPTIC_SPRING, ::SDL_HAPTIC_DAMPER, |
549 SDL_HAPTIC_INERTIA or SDL_HAPTIC_FRICTION */ | 567 ::SDL_HAPTIC_INERTIA or ::SDL_HAPTIC_FRICTION */ |
550 SDL_HapticDirection direction; /**< Direction of the effect - Not used ATM. */ | 568 SDL_HapticDirection direction; /**< Direction of the effect - Not used ATM. */ |
551 | 569 |
552 /* Replay */ | 570 /* Replay */ |
553 Uint32 length; /**< Duration of the effect. */ | 571 Uint32 length; /**< Duration of the effect. */ |
554 Uint16 delay; /**< Delay before starting the effect. */ | 572 Uint16 delay; /**< Delay before starting the effect. */ |
563 Sint16 right_coeff[3]; /**< How fast to increase the force towards the positive side. */ | 581 Sint16 right_coeff[3]; /**< How fast to increase the force towards the positive side. */ |
564 Sint16 left_coeff[3]; /**< How fast to increase the force towards the negative side. */ | 582 Sint16 left_coeff[3]; /**< How fast to increase the force towards the negative side. */ |
565 Uint16 deadband[3]; /**< Size of the dead zone. */ | 583 Uint16 deadband[3]; /**< Size of the dead zone. */ |
566 Sint16 center[3]; /**< Position of the dead zone. */ | 584 Sint16 center[3]; /**< Position of the dead zone. */ |
567 } SDL_HapticCondition; | 585 } SDL_HapticCondition; |
568 /** | 586 |
569 * \struct SDL_HapticRamp | 587 /** |
570 * | 588 * \brief A structure containing a template for a Ramp effect. |
571 * \brief A structure containing a template for a Ramp effect. | 589 * |
572 * | 590 * This struct is exclusively for the ::SDL_HAPTIC_RAMP effect. |
573 * This struct is exclusively for the SDL_HAPTIC_RAMP effect. | 591 * |
574 * | 592 * The ramp effect starts at start strength and ends at end strength. |
575 * The ramp effect starts at start strength and ends at end strength. | |
576 * It augments in linear fashion. If you use attack and fade with a ramp | 593 * It augments in linear fashion. If you use attack and fade with a ramp |
577 * they effects get added to the ramp effect making the effect become | 594 * they effects get added to the ramp effect making the effect become |
578 * quadratic instead of linear. | 595 * quadratic instead of linear. |
579 * | 596 * |
580 * \sa SDL_HAPTIC_RAMP | 597 * \sa SDL_HAPTIC_RAMP |
581 * \sa SDL_HapticEffect | 598 * \sa SDL_HapticEffect |
582 */ | 599 */ |
583 typedef struct SDL_HapticRamp | 600 typedef struct SDL_HapticRamp |
584 { | 601 { |
585 /* Header */ | 602 /* Header */ |
586 Uint16 type; /**< SDL_HAPTIC_RAMP */ | 603 Uint16 type; /**< ::SDL_HAPTIC_RAMP */ |
587 SDL_HapticDirection direction; /**< Direction of the effect. */ | 604 SDL_HapticDirection direction; /**< Direction of the effect. */ |
588 | 605 |
589 /* Replay */ | 606 /* Replay */ |
590 Uint32 length; /**< Duration of the effect. */ | 607 Uint32 length; /**< Duration of the effect. */ |
591 Uint16 delay; /**< Delay before starting the effect. */ | 608 Uint16 delay; /**< Delay before starting the effect. */ |
602 Uint16 attack_length; /**< Duration of the attack. */ | 619 Uint16 attack_length; /**< Duration of the attack. */ |
603 Uint16 attack_level; /**< Level at the start of the attack. */ | 620 Uint16 attack_level; /**< Level at the start of the attack. */ |
604 Uint16 fade_length; /**< Duration of the fade. */ | 621 Uint16 fade_length; /**< Duration of the fade. */ |
605 Uint16 fade_level; /**< Level at the end of the fade. */ | 622 Uint16 fade_level; /**< Level at the end of the fade. */ |
606 } SDL_HapticRamp; | 623 } SDL_HapticRamp; |
607 /** | 624 |
608 * \struct SDL_HapticCustom | 625 /** |
609 * | 626 * \brief A structure containing a template for the ::SDL_HAPTIC_CUSTOM effect. |
610 * \brief A structure containing a template for the SDL_HAPTIC_CUSTOM effect. | 627 * |
611 * | 628 * A custom force feedback effect is much like a periodic effect, where the |
612 * A custom force feedback effect is much like a periodic effect, where the | |
613 * application can define it's exact shape. You will have to allocate the | 629 * application can define it's exact shape. You will have to allocate the |
614 * data yourself. Data should consist of channels * samples Uint16 samples. | 630 * data yourself. Data should consist of channels * samples Uint16 samples. |
615 * | 631 * |
616 * If channels is one, the effect is rotated using the defined direction. | 632 * If channels is one, the effect is rotated using the defined direction. |
617 * Otherwise it uses the samples in data for the different axes. | 633 * Otherwise it uses the samples in data for the different axes. |
618 * | 634 * |
619 * \sa SDL_HAPTIC_CUSTOM | 635 * \sa SDL_HAPTIC_CUSTOM |
620 * \sa SDL_HapticEffect | 636 * \sa SDL_HapticEffect |
621 */ | 637 */ |
622 typedef struct SDL_HapticCustom | 638 typedef struct SDL_HapticCustom |
623 { | 639 { |
624 /* Header */ | 640 /* Header */ |
625 Uint16 type; /**< SDL_HAPTIC_CUSTOM */ | 641 Uint16 type; /**< ::SDL_HAPTIC_CUSTOM */ |
626 SDL_HapticDirection direction; /**< Direction of the effect. */ | 642 SDL_HapticDirection direction; /**< Direction of the effect. */ |
627 | 643 |
628 /* Replay */ | 644 /* Replay */ |
629 Uint32 length; /**< Duration of the effect. */ | 645 Uint32 length; /**< Duration of the effect. */ |
630 Uint16 delay; /**< Delay before starting the effect. */ | 646 Uint16 delay; /**< Delay before starting the effect. */ |
643 Uint16 attack_length; /**< Duration of the attack. */ | 659 Uint16 attack_length; /**< Duration of the attack. */ |
644 Uint16 attack_level; /**< Level at the start of the attack. */ | 660 Uint16 attack_level; /**< Level at the start of the attack. */ |
645 Uint16 fade_length; /**< Duration of the fade. */ | 661 Uint16 fade_length; /**< Duration of the fade. */ |
646 Uint16 fade_level; /**< Level at the end of the fade. */ | 662 Uint16 fade_level; /**< Level at the end of the fade. */ |
647 } SDL_HapticCustom; | 663 } SDL_HapticCustom; |
648 /** | 664 |
649 * \union SDL_HapticEffect | 665 /** |
650 * | 666 * \brief The generic template for any haptic effect. |
651 * \brief The generic template for any haptic effect. | 667 * |
652 * | 668 * All values max at 32767 (0x7FFF). Signed values also can be negative. |
653 * All values max at 32767 (0x7FFF). Signed values also can be negative. | |
654 * Time values unless specified otherwise are in milliseconds. | 669 * Time values unless specified otherwise are in milliseconds. |
655 * | 670 * |
656 * You can also pass SDL_HAPTIC_INFINITY to length instead of a 0-32767 value. | 671 * You can also pass ::SDL_HAPTIC_INFINITY to length instead of a 0-32767 |
657 * Neither delay, interval, attack_length nor fade_length support | 672 * value. Neither delay, interval, attack_length nor fade_length support |
658 * SDL_HAPTIC_INFINITY. Fade will also not be used since effect never ends. | 673 * ::SDL_HAPTIC_INFINITY. Fade will also not be used since effect never ends. |
659 * | 674 * |
660 * Additionally, the SDL_HAPTIC_RAMP effect does not support a duration of | 675 * Additionally, the ::SDL_HAPTIC_RAMP effect does not support a duration of |
661 * SDL_HAPTIC_INFINITY. | 676 * ::SDL_HAPTIC_INFINITY. |
662 * | 677 * |
663 * Button triggers may not be supported on all devices, it is advised to not | 678 * Button triggers may not be supported on all devices, it is advised to not |
664 * use them if possible. Buttons start at index 1 instead of index 0 like | 679 * use them if possible. Buttons start at index 1 instead of index 0 like |
665 * they joystick. | 680 * they joystick. |
666 * | 681 * |
667 * If both attack_length and fade_level are 0, the envelope is not used, | 682 * If both attack_length and fade_level are 0, the envelope is not used, |
668 * otherwise both values are used. | 683 * otherwise both values are used. |
669 * | 684 * |
670 * Common parts: | 685 * Common parts: |
671 * \code | 686 * \code |
672 * // Replay - All effects have this | 687 * // Replay - All effects have this |
673 * Uint32 length; // Duration of effect (ms). | 688 * Uint32 length; // Duration of effect (ms). |
674 * Uint16 delay; // Delay before starting effect. | 689 * Uint16 delay; // Delay before starting effect. |
675 * | 690 * |
676 * // Trigger - All effects have this | 691 * // Trigger - All effects have this |
677 * Uint16 button; // Button that triggers effect. | 692 * Uint16 button; // Button that triggers effect. |
678 * Uint16 interval; // How soon before effect can be triggered again. | 693 * Uint16 interval; // How soon before effect can be triggered again. |
679 * | 694 * |
680 * // Envelope - All effects except condition effects have this | 695 * // Envelope - All effects except condition effects have this |
681 * Uint16 attack_length; // Duration of the attack (ms). | 696 * Uint16 attack_length; // Duration of the attack (ms). |
682 * Uint16 attack_level; // Level at the start of the attack. | 697 * Uint16 attack_level; // Level at the start of the attack. |
683 * Uint16 fade_length; // Duration of the fade out (ms). | 698 * Uint16 fade_length; // Duration of the fade out (ms). |
684 * Uint16 fade_level; // Level at the end of the fade. | 699 * Uint16 fade_level; // Level at the end of the fade. |
685 * \endcode | 700 * \endcode |
686 * | 701 * |
687 * | 702 * |
688 * Here we have an example of a constant effect evolution in time: | 703 * Here we have an example of a constant effect evolution in time: |
689 * | 704 * \verbatim |
690 * \code | 705 Strength |
691 * Strength | 706 ^ |
692 * ^ | 707 | |
693 * | | 708 | effect level --> _________________ |
694 * | effect level --> _________________ | 709 | / \ |
695 * | / \ | 710 | / \ |
696 * | / \ | 711 | / \ |
697 * | / \ | 712 | / \ |
698 * | / \ | 713 | attack_level --> | \ |
699 * | attack_level --> | \ | 714 | | | <--- fade_level |
700 * | | | <--- fade_level | 715 | |
701 * | | 716 +--------------------------------------------------> Time |
702 * +--------------------------------------------------> Time | 717 [--] [---] |
703 * [--] [---] | 718 attack_length fade_length |
704 * attack_length fade_length | 719 |
705 * | 720 [------------------][-----------------------] |
706 * [------------------][-----------------------] | 721 delay length |
707 * delay length | 722 \endverbatim |
708 * \endcode | 723 * |
709 * | 724 * Note either the attack_level or the fade_level may be above the actual |
710 * Note either the attack_level or the fade_level may be above the actual | |
711 * effect level. | 725 * effect level. |
712 * | 726 * |
713 * \sa SDL_HapticConstant | 727 * \sa SDL_HapticConstant |
714 * \sa SDL_HapticPeriodic | 728 * \sa SDL_HapticPeriodic |
715 * \sa SDL_HapticCondition | 729 * \sa SDL_HapticCondition |
716 * \sa SDL_HapticRamp | 730 * \sa SDL_HapticRamp |
717 * \sa SDL_HapticCustom | 731 * \sa SDL_HapticCustom |
718 */ | 732 */ |
719 typedef union SDL_HapticEffect | 733 typedef union SDL_HapticEffect |
720 { | 734 { |
721 /* Common for all force feedback effects */ | 735 /* Common for all force feedback effects */ |
722 Uint16 type; /**< Effect type. */ | 736 Uint16 type; /**< Effect type. */ |
728 } SDL_HapticEffect; | 742 } SDL_HapticEffect; |
729 | 743 |
730 | 744 |
731 /* Function prototypes */ | 745 /* Function prototypes */ |
732 /** | 746 /** |
733 * \fn int SDL_NumHaptics(void) | 747 * \brief Count the number of joysticks attached to the system. |
734 * | 748 * |
735 * \brief Count the number of joysticks attached to the system. | 749 * \return Number of haptic devices detected on the system. |
736 * | |
737 * \return Number of haptic devices detected on the system. | |
738 */ | 750 */ |
739 extern DECLSPEC int SDLCALL SDL_NumHaptics(void); | 751 extern DECLSPEC int SDLCALL SDL_NumHaptics(void); |
740 | 752 |
741 /** | 753 /** |
742 * \fn const char * SDL_HapticName(int device_index) | 754 * \brief Get the implementation dependent name of a Haptic device. |
743 * | 755 * |
744 * \brief Get the implementation dependent name of a Haptic device. | 756 * This can be called before any joysticks are opened. |
745 * This can be called before any joysticks are opened. | 757 * If no name can be found, this function returns NULL. |
746 * If no name can be found, this function returns NULL. | 758 * |
747 * | 759 * \param device_index Index of the device to get it's name. |
748 * \param device_index Index of the device to get it's name. | 760 * \return Name of the device or NULL on error. |
749 * \return Name of the device or NULL on error. | 761 * |
750 * | 762 * \sa SDL_NumHaptics |
751 * \sa SDL_NumHaptics | |
752 */ | 763 */ |
753 extern DECLSPEC const char *SDLCALL SDL_HapticName(int device_index); | 764 extern DECLSPEC const char *SDLCALL SDL_HapticName(int device_index); |
754 | 765 |
755 /** | 766 /** |
756 * \fn SDL_Haptic * SDL_HapticOpen(int device_index) | 767 * \brief Opens a Haptic device for usage. |
757 * | 768 * |
758 * \brief Opens a Haptic device for usage - the index passed as an | 769 * The index passed as an argument refers to the N'th Haptic device on this |
759 * argument refers to the N'th Haptic device on this system. | 770 * system. |
760 * | 771 * |
761 * When opening a haptic device, it's gain will be set to maximum and | 772 * When opening a haptic device, it's gain will be set to maximum and |
762 * autocenter will be disabled. To modify these values use | 773 * autocenter will be disabled. To modify these values use |
763 * SDL_HapticSetGain and SDL_HapticSetAutocenter | 774 * SDL_HapticSetGain() and SDL_HapticSetAutocenter(). |
764 * | 775 * |
765 * \param device_index Index of the device to open. | 776 * \param device_index Index of the device to open. |
766 * \return Device identifier or NULL on error. | 777 * \return Device identifier or NULL on error. |
767 * | 778 * |
768 * \sa SDL_HapticIndex | 779 * \sa SDL_HapticIndex |
769 * \sa SDL_HapticOpenFromMouse | 780 * \sa SDL_HapticOpenFromMouse |
770 * \sa SDL_HapticOpenFromJoystick | 781 * \sa SDL_HapticOpenFromJoystick |
771 * \sa SDL_HapticClose | 782 * \sa SDL_HapticClose |
772 * \sa SDL_HapticSetGain | 783 * \sa SDL_HapticSetGain |
773 * \sa SDL_HapticSetAutocenter | 784 * \sa SDL_HapticSetAutocenter |
774 * \sa SDL_HapticPause | 785 * \sa SDL_HapticPause |
775 * \sa SDL_HapticStopAll | 786 * \sa SDL_HapticStopAll |
776 */ | 787 */ |
777 extern DECLSPEC SDL_Haptic *SDLCALL SDL_HapticOpen(int device_index); | 788 extern DECLSPEC SDL_Haptic *SDLCALL SDL_HapticOpen(int device_index); |
778 | 789 |
779 /** | 790 /** |
780 * \fn int SDL_HapticOpened(int device_index) | 791 * \brief Checks if the haptic device at index has been opened. |
781 * | 792 * |
782 * \brief Checks if the haptic device at index has been opened. | 793 * \param device_index Index to check to see if it has been opened. |
783 * | 794 * \return 1 if it has been opened or 0 if it hasn't. |
784 * \param device_index Index to check to see if it has been opened. | 795 * |
785 * \return 1 if it has been opened or 0 if it hasn't. | 796 * \sa SDL_HapticOpen |
786 * | 797 * \sa SDL_HapticIndex |
787 * \sa SDL_HapticOpen | |
788 * \sa SDL_HapticIndex | |
789 */ | 798 */ |
790 extern DECLSPEC int SDLCALL SDL_HapticOpened(int device_index); | 799 extern DECLSPEC int SDLCALL SDL_HapticOpened(int device_index); |
791 | 800 |
792 /** | 801 /** |
793 * \fn int SDL_HapticIndex(SDL_Haptic * haptic) | 802 * \brief Gets the index of a haptic device. |
794 * | 803 * |
795 * \brief Gets the index of a haptic device. | 804 * \param haptic Haptic device to get the index of. |
796 * | 805 * \return The index of the haptic device or -1 on error. |
797 * \param haptic Haptic device to get the index of. | 806 * |
798 * \return The index of the haptic device or -1 on error. | 807 * \sa SDL_HapticOpen |
799 * | 808 * \sa SDL_HapticOpened |
800 * \sa SDL_HapticOpen | |
801 * \sa SDL_HapticOpened | |
802 */ | 809 */ |
803 extern DECLSPEC int SDLCALL SDL_HapticIndex(SDL_Haptic * haptic); | 810 extern DECLSPEC int SDLCALL SDL_HapticIndex(SDL_Haptic * haptic); |
804 | 811 |
805 /** | 812 /** |
806 * \fn int SDL_MouseIsHaptic(void) | 813 * \brief Gets whether or not the current mouse has haptic capabilities. |
807 * | 814 * |
808 * \brief Gets whether or not the current mouse has haptic capabilities. | 815 * \return SDL_TRUE if the mouse is haptic, SDL_FALSE if it isn't. |
809 * | 816 * |
810 * \return SDL_TRUE if the mouse is haptic, SDL_FALSE if it isn't. | 817 * \sa SDL_HapticOpenFromMouse |
811 * | |
812 * \sa SDL_HapticOpenFromMouse | |
813 */ | 818 */ |
814 extern DECLSPEC int SDLCALL SDL_MouseIsHaptic(void); | 819 extern DECLSPEC int SDLCALL SDL_MouseIsHaptic(void); |
815 | 820 |
816 /** | 821 /** |
817 * \fn SDL_Haptic * SDL_HapticOpenFromMouse(void) | 822 * \brief Tries to open a haptic device from the current mouse. |
818 * | 823 * |
819 * \brief Tries to open a haptic device from the current mouse. | 824 * \return The haptic device identifier or NULL on error. |
820 * | 825 * |
821 * \return The haptic device identifier or NULL on error. | 826 * \sa SDL_MouseIsHaptic |
822 * | 827 * \sa SDL_HapticOpen |
823 * \sa SDL_MouseIsHaptic | |
824 * \sa SDL_HapticOpen | |
825 */ | 828 */ |
826 extern DECLSPEC SDL_Haptic *SDLCALL SDL_HapticOpenFromMouse(void); | 829 extern DECLSPEC SDL_Haptic *SDLCALL SDL_HapticOpenFromMouse(void); |
827 | 830 |
828 /** | 831 /** |
829 * \fn int SDL_JoystickIsHaptic(SDL_Joystick * joystick) | 832 * \brief Checks to see if a joystick has haptic features. |
830 * | 833 * |
831 * \brief Checks to see if a joystick has haptic features. | 834 * \param joystick Joystick to test for haptic capabilities. |
832 * | 835 * \return 1 if the joystick is haptic, 0 if it isn't |
833 * \param joystick Joystick to test for haptic capabilities. | 836 * or -1 if an error ocurred. |
834 * \return SDL_TRUE if the joystick is haptic, SDL_FALSE if it isn't | 837 * |
835 * or -1 if an error ocurred. | 838 * \sa SDL_HapticOpenFromJoystick |
836 * | |
837 * \sa SDL_HapticOpenFromJoystick | |
838 */ | 839 */ |
839 extern DECLSPEC int SDLCALL SDL_JoystickIsHaptic(SDL_Joystick * joystick); | 840 extern DECLSPEC int SDLCALL SDL_JoystickIsHaptic(SDL_Joystick * joystick); |
840 | 841 |
841 /** | 842 /** |
842 * \fn SDL_Haptic * SDL_HapticOpenFromJoystick(SDL_Joystick * joystick) | 843 * \brief Opens a Haptic device for usage from a Joystick device. |
843 * | 844 * |
844 * \brief Opens a Haptic device for usage from a Joystick device. Still has | 845 * You must still close the haptic device seperately. It will not be closed |
845 * to be closed seperately to the joystick. | 846 * with the joystick. |
846 * | 847 * |
847 * When opening from a joystick you should first close the haptic device before | 848 * When opening from a joystick you should first close the haptic device before |
848 * closing the joystick device. If not, on some implementations the haptic | 849 * closing the joystick device. If not, on some implementations the haptic |
849 * device will also get unallocated and you'll be unable to use force feedback | 850 * device will also get unallocated and you'll be unable to use force feedback |
850 * on that device. | 851 * on that device. |
851 * | 852 * |
852 * \param joystick Joystick to create a haptic device from. | 853 * \param joystick Joystick to create a haptic device from. |
853 * \return A valid haptic device identifier on success or NULL on error. | 854 * \return A valid haptic device identifier on success or NULL on error. |
854 * | 855 * |
855 * \sa SDL_HapticOpen | 856 * \sa SDL_HapticOpen |
856 * \sa SDL_HapticClose | 857 * \sa SDL_HapticClose |
857 */ | 858 */ |
858 extern DECLSPEC SDL_Haptic *SDLCALL SDL_HapticOpenFromJoystick(SDL_Joystick * | 859 extern DECLSPEC SDL_Haptic *SDLCALL SDL_HapticOpenFromJoystick(SDL_Joystick * |
859 joystick); | 860 joystick); |
860 | 861 |
861 /** | 862 /** |
862 * \fn void SDL_HapticClose(SDL_Haptic * haptic) | 863 * \brief Closes a Haptic device previously opened with SDL_HapticOpen(). |
863 * | 864 * |
864 * \brief Closes a Haptic device previously opened with SDL_HapticOpen. | 865 * \param haptic Haptic device to close. |
865 * | |
866 * \param haptic Haptic device to close. | |
867 */ | 866 */ |
868 extern DECLSPEC void SDLCALL SDL_HapticClose(SDL_Haptic * haptic); | 867 extern DECLSPEC void SDLCALL SDL_HapticClose(SDL_Haptic * haptic); |
869 | 868 |
870 /** | 869 /** |
871 * \fn int SDL_HapticNumEffects(SDL_Haptic * haptic) | 870 * \brief Returns the number of effects a haptic device can store. |
872 * | 871 * |
873 * \brief Returns the number of effects a haptic device can store. | 872 * On some platforms this isn't fully supported, and therefore is an |
874 * | |
875 * On some platforms this isn't fully supported, and therefore is an | |
876 * aproximation. Always check to see if your created effect was actually | 873 * aproximation. Always check to see if your created effect was actually |
877 * created and do not rely solely on HapticNumEffects. | 874 * created and do not rely solely on SDL_HapticNumEffects(). |
878 * | 875 * |
879 * \param haptic The haptic device to query effect max. | 876 * \param haptic The haptic device to query effect max. |
880 * \return The number of effects the haptic device can store or | 877 * \return The number of effects the haptic device can store or |
881 * -1 on error. | 878 * -1 on error. |
882 * | 879 * |
883 * \sa SDL_HapticNumEffectsPlaying | 880 * \sa SDL_HapticNumEffectsPlaying |
884 * \sa SDL_HapticQuery | 881 * \sa SDL_HapticQuery |
885 */ | 882 */ |
886 extern DECLSPEC int SDLCALL SDL_HapticNumEffects(SDL_Haptic * haptic); | 883 extern DECLSPEC int SDLCALL SDL_HapticNumEffects(SDL_Haptic * haptic); |
887 | 884 |
888 /** | 885 /** |
889 * \fn int SDL_HapticNumEffectsPlaying(SDL_Haptic * haptic) | 886 * \brief Returns the number of effects a haptic device can play at the same |
890 * | 887 * time. |
891 * \brief Returns the number of effects a haptic device can play at the same time. | 888 * |
892 * | 889 * This is not supported on all platforms, but will always return a value. |
893 * This is not supported on all platforms, but will always return a value. Added | 890 * Added here for the sake of completness. |
894 * here for the sake of completness. | 891 * |
895 * | 892 * \param haptic The haptic device to query maximum playing effects. |
896 * \param haptic The haptic device to query maximum playing effect.s | 893 * \return The number of effects the haptic device can play at the same time |
897 * \return The number of effects the haptic device can play at the same time | 894 * or -1 on error. |
898 * or -1 on error. | 895 * |
899 * | 896 * \sa SDL_HapticNumEffects |
900 * \sa SDL_HapticNumEffects | 897 * \sa SDL_HapticQuery |
901 * \sa SDL_HapticQuery | |
902 */ | 898 */ |
903 extern DECLSPEC int SDLCALL SDL_HapticNumEffectsPlaying(SDL_Haptic * haptic); | 899 extern DECLSPEC int SDLCALL SDL_HapticNumEffectsPlaying(SDL_Haptic * haptic); |
904 | 900 |
905 /** | 901 /** |
906 * \fn unsigned int SDL_HapticQuery(SDL_Haptic * haptic) | 902 * \brief Gets the haptic devices supported features in bitwise matter. |
907 * | 903 * |
908 * \brief Gets the haptic devices supported features in bitwise matter. | 904 * Example: |
909 * | 905 * \code |
910 * Example: | 906 * if (SDL_HapticQueryEffects(haptic) & SDL_HAPTIC_CONSTANT) { |
911 * \code | 907 * printf("We have constant haptic effect!"); |
912 * if (SDL_HapticQueryEffects(haptic) & SDL_HAPTIC_CONSTANT) { | 908 * } |
913 * printf("We have constant haptic effect!"); | 909 * \endcode |
914 * } | 910 * |
915 * \endcode | 911 * \param haptic The haptic device to query. |
916 * | 912 * \return Haptic features in bitwise manner (OR'd). |
917 * | 913 * |
918 * \param haptic The haptic device to query. | 914 * \sa SDL_HapticNumEffects |
919 * \return Haptic features in bitwise manner (OR'd). | 915 * \sa SDL_HapticEffectSupported |
920 * | |
921 * \sa SDL_HapticNumEffects | |
922 * \sa SDL_HapticEffectSupported | |
923 */ | 916 */ |
924 extern DECLSPEC unsigned int SDLCALL SDL_HapticQuery(SDL_Haptic * haptic); | 917 extern DECLSPEC unsigned int SDLCALL SDL_HapticQuery(SDL_Haptic * haptic); |
925 | 918 |
926 | 919 |
927 /** | 920 /** |
928 * \fn int SDL_HapticNumAxes(SDL_Haptic * haptic) | 921 * \brief Gets the number of haptic axes the device has. |
929 * | 922 * |
930 * \brief Gets the number of haptic axes the device has. | 923 * \sa SDL_HapticDirection |
931 * | |
932 * \sa SDL_HapticDirection | |
933 */ | 924 */ |
934 extern DECLSPEC int SDLCALL SDL_HapticNumAxes(SDL_Haptic * haptic); | 925 extern DECLSPEC int SDLCALL SDL_HapticNumAxes(SDL_Haptic * haptic); |
935 | 926 |
936 /** | 927 /** |
937 * \fn int SDL_HapticEffectSupported(SDL_Haptic * haptic, SDL_HapticEffect * effect) | 928 * \brief Checks to see if effect is supported by haptic. |
938 * | 929 * |
939 * \brief Checks to see if effect is supported by haptic. | 930 * \param haptic Haptic device to check on. |
940 * | 931 * \param effect Effect to check to see if it is supported. |
941 * \param haptic Haptic device to check on. | 932 * \return 1 if effect is supported, 0 if it isn't or -1 on error. |
942 * \param effect Effect to check to see if it is supported. | 933 * |
943 * \return SDL_TRUE if effect is supported, SDL_FALSE if it isn't or | 934 * \sa SDL_HapticQuery |
944 * -1 on error. | 935 * \sa SDL_HapticNewEffect |
945 * | |
946 * \sa SDL_HapticQuery | |
947 * \sa SDL_HapticNewEffect | |
948 */ | 936 */ |
949 extern DECLSPEC int SDLCALL SDL_HapticEffectSupported(SDL_Haptic * haptic, | 937 extern DECLSPEC int SDLCALL SDL_HapticEffectSupported(SDL_Haptic * haptic, |
950 SDL_HapticEffect * | 938 SDL_HapticEffect * |
951 effect); | 939 effect); |
952 | 940 |
953 /** | 941 /** |
954 * \fn int SDL_HapticNewEffect(SDL_Haptic * haptic, SDL_HapticEffect * effect) | 942 * \brief Creates a new haptic effect on the device. |
955 * | 943 * |
956 * \brief Creates a new haptic effect on the device. | 944 * \param haptic Haptic device to create the effect on. |
957 * | 945 * \param effect Properties of the effect to create. |
958 * \param haptic Haptic device to create the effect on. | 946 * \return The id of the effect on success or -1 on error. |
959 * \param effect Properties of the effect to create. | 947 * |
960 * \return The id of the effect on success or -1 on error. | 948 * \sa SDL_HapticUpdateEffect |
961 * | 949 * \sa SDL_HapticRunEffect |
962 * \sa SDL_HapticUpdateEffect | 950 * \sa SDL_HapticDestroyEffect |
963 * \sa SDL_HapticRunEffect | |
964 * \sa SDL_HapticDestroyEffect | |
965 */ | 951 */ |
966 extern DECLSPEC int SDLCALL SDL_HapticNewEffect(SDL_Haptic * haptic, | 952 extern DECLSPEC int SDLCALL SDL_HapticNewEffect(SDL_Haptic * haptic, |
967 SDL_HapticEffect * effect); | 953 SDL_HapticEffect * effect); |
968 | 954 |
969 /** | 955 /** |
970 * \fn int SDL_HapticUpdateEffect(SDL_Haptic * haptic, int effect, SDL_HapticEffect * data) | 956 * \brief Updates the properties of an effect. |
971 * | 957 * |
972 * \brief Updates the properties of an effect. | 958 * Can be used dynamically, although behaviour when dynamically changing |
973 * | 959 * direction may be strange. Specifically the effect may reupload itself |
974 * Can be used dynamically, although behaviour when dynamically changing | 960 * and start playing from the start. You cannot change the type either when |
975 * direction may be strange. Specifically the effect may reupload itself | 961 * running SDL_HapticUpdateEffect(). |
976 * and start playing from the start. You cannot change the type either when | 962 * |
977 * running UpdateEffect. | 963 * \param haptic Haptic device that has the effect. |
978 * | 964 * \param effect Effect to update. |
979 * \param haptic Haptic device that has the effect. | 965 * \param data New effect properties to use. |
980 * \param effect Effect to update. | 966 * \return The id of the effect on success or -1 on error. |
981 * \param data New effect properties to use. | 967 * |
982 * \return The id of the effect on success or -1 on error. | 968 * \sa SDL_HapticNewEffect |
983 * | 969 * \sa SDL_HapticRunEffect |
984 * \sa SDL_HapticNewEffect | 970 * \sa SDL_HapticDestroyEffect |
985 * \sa SDL_HapticRunEffect | |
986 * \sa SDL_HapticDestroyEffect | |
987 */ | 971 */ |
988 extern DECLSPEC int SDLCALL SDL_HapticUpdateEffect(SDL_Haptic * haptic, | 972 extern DECLSPEC int SDLCALL SDL_HapticUpdateEffect(SDL_Haptic * haptic, |
989 int effect, | 973 int effect, |
990 SDL_HapticEffect * data); | 974 SDL_HapticEffect * data); |
991 | 975 |
992 /** | 976 /** |
993 * \fn int SDL_HapticRunEffect(SDL_Haptic * haptic, int effect, Uint32 iterations) | 977 * \brief Runs the haptic effect on it's assosciated haptic device. |
994 * | 978 * |
995 * \brief Runs the haptic effect on it's assosciated haptic device. | 979 * If iterations are ::SDL_HAPTIC_INFINITY, it'll run the effect over and over |
996 * | |
997 * If iterations are SDL_HAPTIC_INFINITY, it'll run the effect over and over | |
998 * repeating the envelope (attack and fade) every time. If you only want the | 980 * repeating the envelope (attack and fade) every time. If you only want the |
999 * effect to last forever, set SDL_HAPTIC_INFINITY in the effect's length | 981 * effect to last forever, set ::SDL_HAPTIC_INFINITY in the effect's length |
1000 * parameter. | 982 * parameter. |
1001 * | 983 * |
1002 * \param haptic Haptic device to run the effect on. | 984 * \param haptic Haptic device to run the effect on. |
1003 * \param effect Identifier of the haptic effect to run. | 985 * \param effect Identifier of the haptic effect to run. |
1004 * \param iterations Number of iterations to run the effect. Use | 986 * \param iterations Number of iterations to run the effect. Use |
1005 * SDL_HAPTIC_INFINITY for infinity. | 987 * ::SDL_HAPTIC_INFINITY for infinity. |
1006 * \return 0 on success or -1 on error. | 988 * \return 0 on success or -1 on error. |
1007 * | 989 * |
1008 * \sa SDL_HapticStopEffect | 990 * \sa SDL_HapticStopEffect |
1009 * \sa SDL_HapticDestroyEffect | 991 * \sa SDL_HapticDestroyEffect |
1010 * \sa SDL_HapticGetEffectStatus | 992 * \sa SDL_HapticGetEffectStatus |
1011 */ | 993 */ |
1012 extern DECLSPEC int SDLCALL SDL_HapticRunEffect(SDL_Haptic * haptic, | 994 extern DECLSPEC int SDLCALL SDL_HapticRunEffect(SDL_Haptic * haptic, |
1013 int effect, | 995 int effect, |
1014 Uint32 iterations); | 996 Uint32 iterations); |
1015 | 997 |
1016 /** | 998 /** |
1017 * \fn int SDL_HapticStopEffect(SDL_Haptic * haptic, int effect) | 999 * \brief Stops the haptic effect on it's assosciated haptic device. |
1018 * | 1000 * |
1019 * \brief Stops the haptic effect on it's assosciated haptic device. | 1001 * \param haptic Haptic device to stop the effect on. |
1020 * | 1002 * \param effect Identifier of the effect to stop. |
1021 * \param haptic Haptic device to stop the effect on. | 1003 * \return 0 on success or -1 on error. |
1022 * \param effect Identifier of the effect to stop. | 1004 * |
1023 * \return 0 on success or -1 on error. | 1005 * \sa SDL_HapticRunEffect |
1024 * | 1006 * \sa SDL_HapticDestroyEffect |
1025 * \sa SDL_HapticRunEffect | |
1026 * \sa SDL_HapticDestroyEffect | |
1027 */ | 1007 */ |
1028 extern DECLSPEC int SDLCALL SDL_HapticStopEffect(SDL_Haptic * haptic, | 1008 extern DECLSPEC int SDLCALL SDL_HapticStopEffect(SDL_Haptic * haptic, |
1029 int effect); | 1009 int effect); |
1030 | 1010 |
1031 /** | 1011 /** |
1032 * \fn void SDL_HapticDestroyEffect(SDL_Haptic * haptic, int effect) | 1012 * \brief Destroys a haptic effect on the device. |
1033 * | 1013 * |
1034 * \brief Destroys a haptic effect on the device. This will stop the effect | 1014 * This will stop the effect if it's running. Effects are automatically |
1035 * if it's running. Effects are automatically destroyed when the device is | 1015 * destroyed when the device is closed. |
1036 * closed. | 1016 * |
1037 * | 1017 * \param haptic Device to destroy the effect on. |
1038 * \param haptic Device to destroy the effect on. | 1018 * \param effect Identifier of the effect to destroy. |
1039 * \param effect Identifier of the effect to destroy. | 1019 * |
1040 * | 1020 * \sa SDL_HapticNewEffect |
1041 * \sa SDL_HapticNewEffect | |
1042 */ | 1021 */ |
1043 extern DECLSPEC void SDLCALL SDL_HapticDestroyEffect(SDL_Haptic * haptic, | 1022 extern DECLSPEC void SDLCALL SDL_HapticDestroyEffect(SDL_Haptic * haptic, |
1044 int effect); | 1023 int effect); |
1045 | 1024 |
1046 /** | 1025 /** |
1047 * \fn int SDL_HapticGetEffectStatus(SDL_Haptic *haptic, int effect) | 1026 * \brief Gets the status of the current effect on the haptic device. |
1048 * | 1027 * |
1049 * \brief Gets the status of the current effect on the haptic device. | 1028 * Device must support the ::SDL_HAPTIC_STATUS feature. |
1050 * | 1029 * |
1051 * Device must support the SDL_HAPTIC_STATUS feature. | 1030 * \param haptic Haptic device to query the effect status on. |
1052 * | 1031 * \param effect Identifier of the effect to query it's status. |
1053 * \param haptic Haptic device to query the effect status on. | 1032 * \return 0 if it isn't playing, ::SDL_HAPTIC_PLAYING if it is playing |
1054 * \param effect Identifier of the effect to query it's status. | 1033 * or -1 on error. |
1055 * \return 0 if it isn't playing, SDL_HAPTIC_PLAYING if it is playing | 1034 * |
1056 * or -1 on error. | 1035 * \sa SDL_HapticRunEffect |
1057 * | 1036 * \sa SDL_HapticStopEffect |
1058 * \sa SDL_HapticRunEffect | |
1059 * \sa SDL_HapticStopEffect | |
1060 */ | 1037 */ |
1061 extern DECLSPEC int SDLCALL SDL_HapticGetEffectStatus(SDL_Haptic * haptic, | 1038 extern DECLSPEC int SDLCALL SDL_HapticGetEffectStatus(SDL_Haptic * haptic, |
1062 int effect); | 1039 int effect); |
1063 | 1040 |
1064 /** | 1041 /** |
1065 * \fn int SDL_HapticSetGain(SDL_Haptic * haptic, int gain) | 1042 * \brief Sets the global gain of the device. |
1066 * | 1043 * |
1067 * \brief Sets the global gain of the device. Gain should be between 0 and 100. | 1044 * Device must support the ::SDL_HAPTIC_GAIN feature. |
1068 * | 1045 * |
1069 * Device must support the SDL_HAPTIC_GAIN feature. | 1046 * The user may specify the maxmimum gain by setting the environment variable |
1070 * | 1047 * ::SDL_HAPTIC_GAIN_MAX which should be between 0 and 100. All calls to |
1071 * The user may specify the maxmimum gain by setting the environment variable | 1048 * SDL_HapticSetGain() will scale linearly using ::SDL_HAPTIC_GAIN_MAX as the |
1072 * SDL_HAPTIC_GAIN_MAX which should be between 0 and 100. All calls to | |
1073 * SDL_HapticSetGain will scale linearly using SDL_HAPTIC_GAIN_MAX as the | |
1074 * maximum. | 1049 * maximum. |
1075 * | 1050 * |
1076 * \param haptic Haptic device to set the gain on. | 1051 * \param haptic Haptic device to set the gain on. |
1077 * \param gain Value to set the gain to, should be between 0 and 100. | 1052 * \param gain Value to set the gain to, should be between 0 and 100. |
1078 * \return 0 on success or -1 on error. | 1053 * \return 0 on success or -1 on error. |
1079 * | 1054 * |
1080 * \sa SDL_HapticQuery | 1055 * \sa SDL_HapticQuery |
1081 */ | 1056 */ |
1082 extern DECLSPEC int SDLCALL SDL_HapticSetGain(SDL_Haptic * haptic, int gain); | 1057 extern DECLSPEC int SDLCALL SDL_HapticSetGain(SDL_Haptic * haptic, int gain); |
1083 | 1058 |
1084 /** | 1059 /** |
1085 * \fn int SDL_HapticSetAutocenter(SDL_Haptic * haptic, int autocenter) | 1060 * \brief Sets the global autocenter of the device. |
1086 * | 1061 * |
1087 * \brief Sets the global autocenter of the device. Autocenter should be between | 1062 * Autocenter should be between 0 and 100. Setting it to 0 will disable |
1088 * 0 and 100. Setting it to 0 will disable autocentering. | 1063 * autocentering. |
1089 * | 1064 * |
1090 * Device must support the SDL_HAPTIC_AUTOCENTER feature. | 1065 * Device must support the ::SDL_HAPTIC_AUTOCENTER feature. |
1091 * | 1066 * |
1092 * \param haptic Haptic device to set autocentering on. | 1067 * \param haptic Haptic device to set autocentering on. |
1093 * \param autocenter Value to set autocenter to, 0 disables autocentering. | 1068 * \param autocenter Value to set autocenter to, 0 disables autocentering. |
1094 * \return 0 on success or -1 on error. | 1069 * \return 0 on success or -1 on error. |
1095 * | 1070 * |
1096 * \sa SDL_HapticQuery | 1071 * \sa SDL_HapticQuery |
1097 */ | 1072 */ |
1098 extern DECLSPEC int SDLCALL SDL_HapticSetAutocenter(SDL_Haptic * haptic, | 1073 extern DECLSPEC int SDLCALL SDL_HapticSetAutocenter(SDL_Haptic * haptic, |
1099 int autocenter); | 1074 int autocenter); |
1100 | 1075 |
1101 /** | 1076 /** |
1102 * \fn extern DECLSPEC int SDLCALL SDL_HapticPause(SDL_Haptic * haptic) | 1077 * \brief Pauses a haptic device. |
1103 * | 1078 * |
1104 * \brief Pauses a haptic device. | 1079 * Device must support the ::SDL_HAPTIC_PAUSE feature. Call |
1105 * | 1080 * SDL_HapticUnpause() to resume playback. |
1106 * Device must support the SDL_HAPTIC_PAUSE feature. Call SDL_HapticUnpause | 1081 * |
1107 * to resume playback. | 1082 * Do not modify the effects nor add new ones while the device is paused. |
1108 * | |
1109 * Do not modify the effects nor add new ones while the device is paused. | |
1110 * That can cause all sorts of weird errors. | 1083 * That can cause all sorts of weird errors. |
1111 * | 1084 * |
1112 * \param haptic Haptic device to pause. | 1085 * \param haptic Haptic device to pause. |
1113 * \return 0 on success or -1 on error. | 1086 * \return 0 on success or -1 on error. |
1114 * | 1087 * |
1115 * \sa SDL_HapticUnpause | 1088 * \sa SDL_HapticUnpause |
1116 */ | 1089 */ |
1117 extern DECLSPEC int SDLCALL SDL_HapticPause(SDL_Haptic * haptic); | 1090 extern DECLSPEC int SDLCALL SDL_HapticPause(SDL_Haptic * haptic); |
1118 | 1091 |
1119 /** | 1092 /** |
1120 * \fn extern DECLSPEC int SDLCALL SDL_HapticUnpause(SDL_Haptic * haptic) | 1093 * \brief Unpauses a haptic device. |
1121 * | 1094 * |
1122 * \brief Unpauses a haptic device. | 1095 * Call to unpause after SDL_HapticPause(). |
1123 * | 1096 * |
1124 * Call to unpause after SDL_HapticPause. | 1097 * \param haptic Haptic device to pause. |
1125 * | 1098 * \return 0 on success or -1 on error. |
1126 * \param haptic Haptic device to pause. | 1099 * |
1127 * \return 0 on success or -1 on error. | 1100 * \sa SDL_HapticPause |
1128 * | |
1129 * \sa SDL_HapticPause | |
1130 */ | 1101 */ |
1131 extern DECLSPEC int SDLCALL SDL_HapticUnpause(SDL_Haptic * haptic); | 1102 extern DECLSPEC int SDLCALL SDL_HapticUnpause(SDL_Haptic * haptic); |
1132 | 1103 |
1133 /** | 1104 /** |
1134 * \fn extern DECSLPEC int SDLCALL SDL_HapticStopAll(SDL_Haptic * haptic) | 1105 * \brief Stops all the currently playing effects on a haptic device. |
1135 * | 1106 * |
1136 * \brief Stops all the currently playing effects on a haptic device. | 1107 * \param haptic Haptic device to stop. |
1137 * | 1108 * \return 0 on success or -1 on error. |
1138 * \param haptic Haptic device to stop. | |
1139 * \return 0 on success or -1 on error. | |
1140 */ | 1109 */ |
1141 extern DECLSPEC int SDLCALL SDL_HapticStopAll(SDL_Haptic * haptic); | 1110 extern DECLSPEC int SDLCALL SDL_HapticStopAll(SDL_Haptic * haptic); |
1142 | 1111 |
1143 | 1112 |
1144 /* Ends C function definitions when using C++ */ | 1113 /* Ends C function definitions when using C++ */ |