include/SDL_haptic.h
branchgsoc2008_force_feedback
changeset 2486 24dd8b8669fa
parent 2485 67978eea6d10
child 2487 4c8e25ef2d97
equal deleted inserted replaced
2485:67978eea6d10 2486:24dd8b8669fa
    51 #define SDL_HAPTIC_RAMP       (1<<2)
    51 #define SDL_HAPTIC_RAMP       (1<<2)
    52 #define SDL_HAPTIC_SPRING     (1<<3)
    52 #define SDL_HAPTIC_SPRING     (1<<3)
    53 #define SDL_HAPTIC_FRICTION   (1<<4)
    53 #define SDL_HAPTIC_FRICTION   (1<<4)
    54 #define SDL_HAPTIC_DAMPER     (1<<5)
    54 #define SDL_HAPTIC_DAMPER     (1<<5)
    55 #define SDL_HAPTIC_INERTIA    (1<<6)
    55 #define SDL_HAPTIC_INERTIA    (1<<6)
    56 #define SDL_HAPTIC_GAIN       (1<<7)
    56 #define SDL_HAPTIC_CUSTOM     (1<<7)
    57 #define SDL_HAPTIC_AUTOCENTER (1<<8)
    57 #define SDL_HAPTIC_GAIN       (1<<8)
    58 
    58 #define SDL_HAPTIC_AUTOCENTER (1<<9)
       
    59 
       
    60 
       
    61 /*
       
    62  * Different waveforms a SDL_HAPTIC_PERIODIC effect can have.
       
    63  */
    59 typedef enum SDL_waveform {
    64 typedef enum SDL_waveform {
    60    SDL_WAVEFORM_SINE,
    65    SDL_WAVEFORM_SINE,
    61    SDL_WAVEFORM_SQUARE,
    66    SDL_WAVEFORM_SQUARE,
    62    SDL_WAVEFORM_TRIANGLE,
    67    SDL_WAVEFORM_TRIANGLE,
    63    SDL_WAVEFORM_SAWTOOTHUP,
    68    SDL_WAVEFORM_SAWTOOTHUP,
    64    SDL_WAVEFORM_SAWTOOTHDOWN
    69    SDL_WAVEFORM_SAWTOOTHDOWN,
       
    70    SDL_WAVEFORM_CUSTOM
    65 } SDL_waveform;
    71 } SDL_waveform;
    66 
    72 
    67 
    73 
    68 /*
    74 /*
    69  * All values max at 32767 (0x7fff).  Signed values also can be negative.
    75  * All values max at 32767 (0x7fff).  Signed values also can be negative.
   151    Uint16 left_sat; /* Level when joystick is to the left */
   157    Uint16 left_sat; /* Level when joystick is to the left */
   152    Sint16 right_coeff; /* How fast to increase the force towards the right */
   158    Sint16 right_coeff; /* How fast to increase the force towards the right */
   153    Sint16 left_coeff; /* How fast to increase the force towards the left */
   159    Sint16 left_coeff; /* How fast to increase the force towards the left */
   154    Uint16 deadband; /* Size of the dead zone */
   160    Uint16 deadband; /* Size of the dead zone */
   155    Sint16 center; /* Position of the dead zone */
   161    Sint16 center; /* Position of the dead zone */
   156 
       
   157 } SDL_HapticCondition;
   162 } SDL_HapticCondition;
   158 typedef struct SDL_HapticRamp {
   163 typedef struct SDL_HapticRamp {
   159    /* Header */
   164    /* Header */
   160    Uint16 type; /* SDL_HAPTIC_RAMP */
   165    Uint16 type; /* SDL_HAPTIC_RAMP */
   161    Uint16 direction;
   166    Uint16 direction;
   175    /* Envelope */
   180    /* Envelope */
   176    Uint16 attack_length;
   181    Uint16 attack_length;
   177    Uint16 attack_level;
   182    Uint16 attack_level;
   178    Uint16 fade_length;
   183    Uint16 fade_length;
   179    Uint16 fade_level;
   184    Uint16 fade_level;
   180 
       
   181 } SDL_HapticRamp;
   185 } SDL_HapticRamp;
   182 
   186 
   183 typedef union SDL_HapticEffect {
   187 typedef union SDL_HapticEffect {
   184    /* Common for all force feedback effects */
   188    /* Common for all force feedback effects */
   185    Uint16 type; /* Effect type */
   189    Uint16 type; /* Effect type */
   229  * Example:  (SDL_HapticQueryEffects(haptic) & SDL_HAPTIC_CONSTANT)
   233  * Example:  (SDL_HapticQueryEffects(haptic) & SDL_HAPTIC_CONSTANT)
   230  */
   234  */
   231 extern DECLSPEC unsigned int SDL_HapticQueryEffects(SDL_Haptic * haptic);
   235 extern DECLSPEC unsigned int SDL_HapticQueryEffects(SDL_Haptic * haptic);
   232 
   236 
   233 /*
   237 /*
       
   238  * Checks to see if effect is supported by haptic.
       
   239  *
       
   240  * Returns SDL_TRUE if effect is supported, SDL_FALSE if it isn't and -1
       
   241  * on error.
       
   242  */
       
   243 extern DECLSPEC int SDL_HapticEffectSupported(SDL_Haptic * haptic, SDL_HapticEffect * effect);
       
   244 
       
   245 /*
   234  * Creates a new haptic effect on the device.
   246  * Creates a new haptic effect on the device.
   235  *
   247  *
   236  * Returns the id of the effect on success, -1 on failure.
   248  * Returns the id of the effect on success, -1 on failure.
   237  */
   249  */
   238 extern DECLSPEC int SDL_HapticNewEffect(SDL_Haptic * haptic, SDL_HapticEffect * effect);
   250 extern DECLSPEC int SDL_HapticNewEffect(SDL_Haptic * haptic, SDL_HapticEffect * effect);