00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00089 #ifndef _SDL_haptic_h
00090 #define _SDL_haptic_h
00091
00092 #include "SDL_stdinc.h"
00093 #include "SDL_error.h"
00094 #include "SDL_joystick.h"
00095
00096 #include "begin_code.h"
00097
00098 #ifdef __cplusplus
00099
00100 extern "C" {
00101
00102 #endif
00103
00113 struct _SDL_Haptic;
00114 typedef struct _SDL_Haptic SDL_Haptic;
00115
00116
00117
00118
00119
00127 #define SDL_HAPTIC_CONSTANT (1<<0)
00128
00135 #define SDL_HAPTIC_SINE (1<<1)
00136
00143 #define SDL_HAPTIC_SQUARE (1<<2)
00144
00151 #define SDL_HAPTIC_TRIANGLE (1<<3)
00152
00159 #define SDL_HAPTIC_SAWTOOTHUP (1<<4)
00160
00167 #define SDL_HAPTIC_SAWTOOTHDOWN (1<<5)
00168
00175 #define SDL_HAPTIC_RAMP (1<<6)
00176
00184 #define SDL_HAPTIC_SPRING (1<<7)
00185
00193 #define SDL_HAPTIC_DAMPER (1<<8)
00194
00202 #define SDL_HAPTIC_INERTIA (1<<9)
00203
00211 #define SDL_HAPTIC_FRICTION (1<<10)
00212
00217 #define SDL_HAPTIC_CUSTOM (1<<11)
00218
00226 #define SDL_HAPTIC_GAIN (1<<12)
00227
00234 #define SDL_HAPTIC_AUTOCENTER (1<<13)
00235
00242 #define SDL_HAPTIC_STATUS (1<<14)
00243
00251 #define SDL_HAPTIC_PAUSE (1<<15)
00252
00253
00254
00255
00256
00264 #define SDL_HAPTIC_POLAR 0
00265
00272 #define SDL_HAPTIC_CARTESIAN 1
00273
00280 #define SDL_HAPTIC_SPHERICAL 2
00281
00282
00283
00284
00285
00293 #define SDL_HAPTIC_INFINITY 4294967295U
00294
00295
00389 typedef struct SDL_HapticDirection
00390 {
00391 Uint8 type;
00392 Uint16 dir[3];
00393 } SDL_HapticDirection;
00394
00395
00409 typedef struct SDL_HapticConstant
00410 {
00411
00412 Uint16 type;
00413 SDL_HapticDirection direction;
00415
00416 Uint32 length;
00417 Uint16 delay;
00419
00420 Uint16 button;
00421 Uint16 interval;
00423
00424 Sint16 level;
00426
00427 Uint16 attack_length;
00428 Uint16 attack_level;
00429 Uint16 fade_length;
00430 Uint16 fade_level;
00431 } SDL_HapticConstant;
00491 typedef struct SDL_HapticPeriodic
00492 {
00493
00494 Uint16 type;
00497 SDL_HapticDirection direction;
00499
00500 Uint32 length;
00501 Uint16 delay;
00503
00504 Uint16 button;
00505 Uint16 interval;
00507
00508 Uint16 period;
00509 Sint16 magnitude;
00510 Sint16 offset;
00511 Uint16 phase;
00513
00514 Uint16 attack_length;
00515 Uint16 attack_level;
00516 Uint16 fade_length;
00517 Uint16 fade_level;
00518 } SDL_HapticPeriodic;
00545 typedef struct SDL_HapticCondition
00546 {
00547
00548 Uint16 type;
00550 SDL_HapticDirection direction;
00552
00553 Uint32 length;
00554 Uint16 delay;
00556
00557 Uint16 button;
00558 Uint16 interval;
00560
00561 Uint16 right_sat[3];
00562 Uint16 left_sat[3];
00563 Sint16 right_coeff[3];
00564 Sint16 left_coeff[3];
00565 Uint16 deadband[3];
00566 Sint16 center[3];
00567 } SDL_HapticCondition;
00583 typedef struct SDL_HapticRamp
00584 {
00585
00586 Uint16 type;
00587 SDL_HapticDirection direction;
00589
00590 Uint32 length;
00591 Uint16 delay;
00593
00594 Uint16 button;
00595 Uint16 interval;
00597
00598 Sint16 start;
00599 Sint16 end;
00601
00602 Uint16 attack_length;
00603 Uint16 attack_level;
00604 Uint16 fade_length;
00605 Uint16 fade_level;
00606 } SDL_HapticRamp;
00622 typedef struct SDL_HapticCustom
00623 {
00624
00625 Uint16 type;
00626 SDL_HapticDirection direction;
00628
00629 Uint32 length;
00630 Uint16 delay;
00632
00633 Uint16 button;
00634 Uint16 interval;
00636
00637 Uint8 channels;
00638 Uint16 period;
00639 Uint16 samples;
00640 Uint16 *data;
00642
00643 Uint16 attack_length;
00644 Uint16 attack_level;
00645 Uint16 fade_length;
00646 Uint16 fade_level;
00647 } SDL_HapticCustom;
00719 typedef union SDL_HapticEffect
00720 {
00721
00722 Uint16 type;
00723 SDL_HapticConstant constant;
00724 SDL_HapticPeriodic periodic;
00725 SDL_HapticCondition condition;
00726 SDL_HapticRamp ramp;
00727 SDL_HapticCustom custom;
00728 } SDL_HapticEffect;
00729
00730
00731
00739 extern DECLSPEC int SDLCALL SDL_NumHaptics(void);
00740
00753 extern DECLSPEC const char *SDLCALL SDL_HapticName(int device_index);
00754
00777 extern DECLSPEC SDL_Haptic *SDLCALL SDL_HapticOpen(int device_index);
00778
00790 extern DECLSPEC int SDLCALL SDL_HapticOpened(int device_index);
00791
00803 extern DECLSPEC int SDLCALL SDL_HapticIndex(SDL_Haptic * haptic);
00804
00814 extern DECLSPEC int SDLCALL SDL_MouseIsHaptic(void);
00815
00826 extern DECLSPEC SDL_Haptic *SDLCALL SDL_HapticOpenFromMouse(void);
00827
00839 extern DECLSPEC int SDLCALL SDL_JoystickIsHaptic(SDL_Joystick * joystick);
00840
00858 extern DECLSPEC SDL_Haptic *SDLCALL SDL_HapticOpenFromJoystick(SDL_Joystick *
00859 joystick);
00860
00868 extern DECLSPEC void SDLCALL SDL_HapticClose(SDL_Haptic * haptic);
00869
00886 extern DECLSPEC int SDLCALL SDL_HapticNumEffects(SDL_Haptic * haptic);
00887
00903 extern DECLSPEC int SDLCALL SDL_HapticNumEffectsPlaying(SDL_Haptic * haptic);
00904
00924 extern DECLSPEC unsigned int SDLCALL SDL_HapticQuery(SDL_Haptic * haptic);
00925
00926
00934 extern DECLSPEC int SDLCALL SDL_HapticNumAxes(SDL_Haptic * haptic);
00935
00949 extern DECLSPEC int SDLCALL SDL_HapticEffectSupported(SDL_Haptic * haptic,
00950 SDL_HapticEffect *
00951 effect);
00952
00966 extern DECLSPEC int SDLCALL SDL_HapticNewEffect(SDL_Haptic * haptic,
00967 SDL_HapticEffect * effect);
00968
00988 extern DECLSPEC int SDLCALL SDL_HapticUpdateEffect(SDL_Haptic * haptic,
00989 int effect,
00990 SDL_HapticEffect * data);
00991
01012 extern DECLSPEC int SDLCALL SDL_HapticRunEffect(SDL_Haptic * haptic,
01013 int effect,
01014 Uint32 iterations);
01015
01028 extern DECLSPEC int SDLCALL SDL_HapticStopEffect(SDL_Haptic * haptic,
01029 int effect);
01030
01043 extern DECLSPEC void SDLCALL SDL_HapticDestroyEffect(SDL_Haptic * haptic,
01044 int effect);
01045
01061 extern DECLSPEC int SDLCALL SDL_HapticGetEffectStatus(SDL_Haptic * haptic,
01062 int effect);
01063
01082 extern DECLSPEC int SDLCALL SDL_HapticSetGain(SDL_Haptic * haptic, int gain);
01083
01098 extern DECLSPEC int SDLCALL SDL_HapticSetAutocenter(SDL_Haptic * haptic,
01099 int autocenter);
01100
01117 extern DECLSPEC int SDLCALL SDL_HapticPause(SDL_Haptic * haptic);
01118
01131 extern DECLSPEC int SDLCALL SDL_HapticUnpause(SDL_Haptic * haptic);
01132
01141 extern DECLSPEC int SDLCALL SDL_HapticStopAll(SDL_Haptic * haptic);
01142
01143
01144
01145 #ifdef __cplusplus
01146
01147 }
01148
01149 #endif
01150 #include "close_code.h"
01151
01152 #endif
01153
01154