SDL_haptic.h 38 KB

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