SDL_haptic.h 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303
  1. #ifndef _SDL_haptic_h
  2. #define _SDL_haptic_h
  3. #include "SDL_stdinc.h"
  4. #include "SDL_error.h"
  5. #include "SDL_joystick.h"
  6. #include "begin_code.h"
  7. #ifdef __cplusplus
  8. extern "C" {
  9. #endif
  10. struct _SDL_Haptic;
  11. typedef struct _SDL_Haptic SDL_Haptic;
  12. #define SDL_HAPTIC_CONSTANT (1<<0)
  13. #define SDL_HAPTIC_SINE (1<<1)
  14. #define SDL_HAPTIC_LEFTRIGHT (1<<2)
  15. #define SDL_HAPTIC_TRIANGLE (1<<3)
  16. #define SDL_HAPTIC_SAWTOOTHUP (1<<4)
  17. #define SDL_HAPTIC_SAWTOOTHDOWN (1<<5)
  18. #define SDL_HAPTIC_RAMP (1<<6)
  19. #define SDL_HAPTIC_SPRING (1<<7)
  20. #define SDL_HAPTIC_DAMPER (1<<8)
  21. #define SDL_HAPTIC_INERTIA (1<<9)
  22. #define SDL_HAPTIC_FRICTION (1<<10)
  23. #define SDL_HAPTIC_CUSTOM (1<<11)
  24. #define SDL_HAPTIC_GAIN (1<<12)
  25. #define SDL_HAPTIC_AUTOCENTER (1<<13)
  26. #define SDL_HAPTIC_STATUS (1<<14)
  27. #define SDL_HAPTIC_PAUSE (1<<15)
  28. #define SDL_HAPTIC_POLAR 0
  29. #define SDL_HAPTIC_CARTESIAN 1
  30. #define SDL_HAPTIC_SPHERICAL 2
  31. #define SDL_HAPTIC_INFINITY 4294967295U
  32. typedef struct SDL_HapticDirection
  33. {
  34. Uint8 type;
  35. Sint32 dir[3];
  36. } SDL_HapticDirection;
  37. typedef struct SDL_HapticConstant
  38. {
  39. Uint16 type;
  40. SDL_HapticDirection direction;
  41. Uint32 length;
  42. Uint16 delay;
  43. Uint16 button;
  44. Uint16 interval;
  45. Sint16 level;
  46. Uint16 attack_length;
  47. Uint16 attack_level;
  48. Uint16 fade_length;
  49. Uint16 fade_level;
  50. } SDL_HapticConstant;
  51. typedef struct SDL_HapticPeriodic
  52. {
  53. Uint16 type;
  54. SDL_HapticDirection direction;
  55. Uint32 length;
  56. Uint16 delay;
  57. Uint16 button;
  58. Uint16 interval;
  59. Uint16 period;
  60. Sint16 magnitude;
  61. Sint16 offset;
  62. Uint16 phase;
  63. Uint16 attack_length;
  64. Uint16 attack_level;
  65. Uint16 fade_length;
  66. Uint16 fade_level;
  67. } SDL_HapticPeriodic;
  68. typedef struct SDL_HapticCondition
  69. {
  70. Uint16 type;
  71. SDL_HapticDirection direction;
  72. Uint32 length;
  73. Uint16 delay;
  74. Uint16 button;
  75. Uint16 interval;
  76. Uint16 right_sat[3];
  77. Uint16 left_sat[3];
  78. Sint16 right_coeff[3];
  79. Sint16 left_coeff[3];
  80. Uint16 deadband[3];
  81. Sint16 center[3];
  82. } SDL_HapticCondition;
  83. typedef struct SDL_HapticRamp
  84. {
  85. Uint16 type;
  86. SDL_HapticDirection direction;
  87. Uint32 length;
  88. Uint16 delay;
  89. Uint16 button;
  90. Uint16 interval;
  91. Sint16 start;
  92. Sint16 end;
  93. Uint16 attack_length;
  94. Uint16 attack_level;
  95. Uint16 fade_length;
  96. Uint16 fade_level;
  97. } SDL_HapticRamp;
  98. typedef struct SDL_HapticLeftRight
  99. {
  100. Uint16 type;
  101. Uint32 length;
  102. Uint16 large_magnitude;
  103. Uint16 small_magnitude;
  104. } SDL_HapticLeftRight;
  105. typedef struct SDL_HapticCustom
  106. {
  107. Uint16 type;
  108. SDL_HapticDirection direction;
  109. Uint32 length;
  110. Uint16 delay;
  111. Uint16 button;
  112. Uint16 interval;
  113. Uint8 channels;
  114. Uint16 period;
  115. Uint16 samples;
  116. Uint16 *data;
  117. Uint16 attack_length;
  118. Uint16 attack_level;
  119. Uint16 fade_length;
  120. Uint16 fade_level;
  121. } SDL_HapticCustom;
  122. typedef union SDL_HapticEffect
  123. {
  124. Uint16 type;
  125. SDL_HapticConstant constant;
  126. SDL_HapticPeriodic periodic;
  127. SDL_HapticCondition condition;
  128. SDL_HapticRamp ramp;
  129. SDL_HapticLeftRight leftright;
  130. SDL_HapticCustom custom;
  131. } SDL_HapticEffect;
  132. typedef int SDLCALL tSDL_NumHaptics(void);
  133. typedef const char * SDLCALL tSDL_HapticName(int device_index);
  134. typedef SDL_Haptic * SDLCALL tSDL_HapticOpen(int device_index);
  135. typedef int SDLCALL tSDL_HapticOpened(int device_index);
  136. typedef int SDLCALL tSDL_HapticIndex(SDL_Haptic * haptic);
  137. typedef int SDLCALL tSDL_MouseIsHaptic(void);
  138. typedef SDL_Haptic * SDLCALL tSDL_HapticOpenFromMouse(void);
  139. typedef int SDLCALL tSDL_JoystickIsHaptic(SDL_Joystick * joystick);
  140. typedef SDL_Haptic * SDLCALL tSDL_HapticOpenFromJoystick(SDL_Joystick *
  141. joystick);
  142. typedef void SDLCALL tSDL_HapticClose(SDL_Haptic * haptic);
  143. typedef int SDLCALL tSDL_HapticNumEffects(SDL_Haptic * haptic);
  144. typedef int SDLCALL tSDL_HapticNumEffectsPlaying(SDL_Haptic * haptic);
  145. extern DECLSPEC unsigned int SDLCALL SDL_HapticQuery(SDL_Haptic * haptic);
  146. typedef int SDLCALL tSDL_HapticNumAxes(SDL_Haptic * haptic);
  147. typedef int SDLCALL tSDL_HapticEffectSupported(SDL_Haptic * haptic,
  148. SDL_HapticEffect *
  149. effect);
  150. typedef int SDLCALL tSDL_HapticNewEffect(SDL_Haptic * haptic,
  151. SDL_HapticEffect * effect);
  152. typedef int SDLCALL tSDL_HapticUpdateEffect(SDL_Haptic * haptic,
  153. int effect,
  154. SDL_HapticEffect * data);
  155. typedef int SDLCALL tSDL_HapticRunEffect(SDL_Haptic * haptic,
  156. int effect,
  157. Uint32 iterations);
  158. typedef int SDLCALL tSDL_HapticStopEffect(SDL_Haptic * haptic,
  159. int effect);
  160. typedef void SDLCALL tSDL_HapticDestroyEffect(SDL_Haptic * haptic,
  161. int effect);
  162. typedef int SDLCALL tSDL_HapticGetEffectStatus(SDL_Haptic * haptic,
  163. int effect);
  164. typedef int SDLCALL tSDL_HapticSetGain(SDL_Haptic * haptic, int gain);
  165. typedef int SDLCALL tSDL_HapticSetAutocenter(SDL_Haptic * haptic,
  166. int autocenter);
  167. typedef int SDLCALL tSDL_HapticPause(SDL_Haptic * haptic);
  168. typedef int SDLCALL tSDL_HapticUnpause(SDL_Haptic * haptic);
  169. typedef int SDLCALL tSDL_HapticStopAll(SDL_Haptic * haptic);
  170. typedef int SDLCALL tSDL_HapticRumbleSupported(SDL_Haptic * haptic);
  171. typedef int SDLCALL tSDL_HapticRumbleInit(SDL_Haptic * haptic);
  172. typedef int SDLCALL tSDL_HapticRumblePlay(SDL_Haptic * haptic, float strength, Uint32 length );
  173. typedef int SDLCALL tSDL_HapticRumbleStop(SDL_Haptic * haptic);
  174. extern tSDL_NumHaptics *SDL_NumHaptics;
  175. extern tSDL_HapticName *SDL_HapticName;
  176. extern tSDL_HapticOpen *SDL_HapticOpen;
  177. extern tSDL_HapticOpened *SDL_HapticOpened;
  178. extern tSDL_HapticIndex *SDL_HapticIndex;
  179. extern tSDL_MouseIsHaptic *SDL_MouseIsHaptic;
  180. extern tSDL_HapticOpenFromMouse *SDL_HapticOpenFromMouse;
  181. extern tSDL_JoystickIsHaptic *SDL_JoystickIsHaptic;
  182. extern tSDL_HapticOpenFromJoystick *SDL_HapticOpenFromJoystick;
  183. extern tSDL_HapticClose *SDL_HapticClose;
  184. extern tSDL_HapticNumEffects *SDL_HapticNumEffects;
  185. extern tSDL_HapticNumEffectsPlaying *SDL_HapticNumEffectsPlaying;
  186. extern tSDL_HapticNumAxes *SDL_HapticNumAxes;
  187. extern tSDL_HapticEffectSupported *SDL_HapticEffectSupported;
  188. extern tSDL_HapticNewEffect *SDL_HapticNewEffect;
  189. extern tSDL_HapticUpdateEffect *SDL_HapticUpdateEffect;
  190. extern tSDL_HapticRunEffect *SDL_HapticRunEffect;
  191. extern tSDL_HapticStopEffect *SDL_HapticStopEffect;
  192. extern tSDL_HapticDestroyEffect *SDL_HapticDestroyEffect;
  193. extern tSDL_HapticGetEffectStatus *SDL_HapticGetEffectStatus;
  194. extern tSDL_HapticSetGain *SDL_HapticSetGain;
  195. extern tSDL_HapticSetAutocenter *SDL_HapticSetAutocenter;
  196. extern tSDL_HapticPause *SDL_HapticPause;
  197. extern tSDL_HapticUnpause *SDL_HapticUnpause;
  198. extern tSDL_HapticStopAll *SDL_HapticStopAll;
  199. extern tSDL_HapticRumbleSupported *SDL_HapticRumbleSupported;
  200. extern tSDL_HapticRumbleInit *SDL_HapticRumbleInit;
  201. extern tSDL_HapticRumblePlay *SDL_HapticRumblePlay;
  202. extern tSDL_HapticRumbleStop *SDL_HapticRumbleStop;
  203. #ifdef __cplusplus
  204. }
  205. #endif
  206. #include "close_code.h"
  207. #endif