include/SDL_haptic.h
branchgsoc2008_force_feedback
changeset 2495 66c02abeef0e
parent 2489 96adc8025331
child 2497 0893fbf73b3d
equal deleted inserted replaced
2494:a72a5f62d6b7 2495:66c02abeef0e
    44 /* The haptic structure used to identify an SDL haptic */
    44 /* The haptic structure used to identify an SDL haptic */
    45 struct _SDL_Haptic;                                                     
    45 struct _SDL_Haptic;                                                     
    46 typedef struct _SDL_Haptic SDL_Haptic;
    46 typedef struct _SDL_Haptic SDL_Haptic;
    47 
    47 
    48 
    48 
    49 /* Different effects that can be generated */
    49 /*
    50 #define SDL_HAPTIC_CONSTANT   (1<<0)
    50  * Different haptic features a device can have.
    51 #define SDL_HAPTIC_SINE       (1<<1)
    51  */
    52 #define SDL_HAPTIC_SQUARE     (1<<2)
    52 #define SDL_HAPTIC_CONSTANT   (1<<0) /* Constant effect supported */
    53 #define SDL_HAPTIC_TRIANGLE   (1<<3)
    53 #define SDL_HAPTIC_SINE       (1<<1) /* Sine wave effect supported */
    54 #define SDL_HAPTIC_SAWTOOTHUP (1<<4)
    54 #define SDL_HAPTIC_SQUARE     (1<<2) /* Square wave effect supported */
    55 #define SDL_HAPTIC_SAWTOOTHDOWN (1<<5)
    55 #define SDL_HAPTIC_TRIANGLE   (1<<3) /* Triangle wave effect supported */
    56 #define SDL_HAPTIC_RAMP       (1<<6)
    56 #define SDL_HAPTIC_SAWTOOTHUP (1<<4) /* Sawtoothup wave effect supported */
    57 #define SDL_HAPTIC_SPRING     (1<<7)
    57 #define SDL_HAPTIC_SAWTOOTHDOWN (1<<5) /* Sawtoothdown wave effect supported */
    58 #define SDL_HAPTIC_FRICTION   (1<<8)
    58 #define SDL_HAPTIC_RAMP       (1<<6) /* Ramp effect supported */
    59 #define SDL_HAPTIC_DAMPER     (1<<9)
    59 #define SDL_HAPTIC_SPRING     (1<<7) /* Spring effect supported - uses axes position */
    60 #define SDL_HAPTIC_INERTIA    (1<<10)
    60 #define SDL_HAPTIC_DAMPER     (1<<8) /* Damper effect supported - uses axes velocity */
    61 #define SDL_HAPTIC_CUSTOM     (1<<11)
    61 #define SDL_HAPTIC_INERTIA    (1<<9) /* Inertia effect supported - uses axes acceleration */
       
    62 #define SDL_HAPTIC_FRICTION   (1<<10) /* Friction effect supported - uses axes movement */
       
    63 #define SDL_HAPTIC_CUSTOM     (1<<11) /* Custom effect is supported */
    62 /* These last two are features the device has, not effects */
    64 /* These last two are features the device has, not effects */
    63 #define SDL_HAPTIC_GAIN       (1<<12)
    65 #define SDL_HAPTIC_GAIN       (1<<12) /* Device can set global gain */
    64 #define SDL_HAPTIC_AUTOCENTER (1<<13)
    66 #define SDL_HAPTIC_AUTOCENTER (1<<13) /* Device can set autocenter */
       
    67 #define SDL_HAPTIC_STATUS     (1<<14) /* Device can be queried for effect status */
    65 
    68 
    66 
    69 
    67 /*
    70 /*
    68  * All values max at 32767 (0x7fff).  Signed values also can be negative.
    71  * All values max at 32767 (0x7fff).  Signed values also can be negative.
    69  * Time values unless specified otherwise are in milliseconds.
    72  * Time values unless specified otherwise are in milliseconds.
   164    /* Trigger */
   167    /* Trigger */
   165    Uint16 button;
   168    Uint16 button;
   166    Uint16 interval;
   169    Uint16 interval;
   167 
   170 
   168    /* Ramp */
   171    /* Ramp */
   169    Sint16 start;
   172    Sint16 start; /* Beginning strength level. */
   170    Sint16 end;
   173    Sint16 end; /* Ending strength level. */
   171 
   174 
   172    /* Envelope */
   175    /* Envelope */
   173    Uint16 attack_length;
   176    Uint16 attack_length;
   174    Uint16 attack_level;
   177    Uint16 attack_level;
   175    Uint16 fade_length;
   178    Uint16 fade_length;
   286  * running.
   289  * running.
   287  */
   290  */
   288 extern DECLSPEC void SDL_HapticDestroyEffect(SDL_Haptic * haptic, int effect);
   291 extern DECLSPEC void SDL_HapticDestroyEffect(SDL_Haptic * haptic, int effect);
   289 
   292 
   290 /*
   293 /*
       
   294  * Gets the status of the current effect on the haptic device.
       
   295  *
       
   296  * Returns 0 if it isn't playing, SDL_HAPTIC_PLAYING if it is playing
       
   297  * or -1 on failure.
       
   298  */
       
   299 extern DECLSPEC int SDL_HapticGetEffectStatus(SDL_Haptic *haptic, int effect);
       
   300 
       
   301 /*
   291  * Sets the global gain of the device.  Gain should be between 0 and 100.
   302  * Sets the global gain of the device.  Gain should be between 0 and 100.
   292  *
   303  *
   293  * Returns 0 on success or -1 on failure.
   304  * Returns 0 on success or -1 on failure.
   294  */
   305  */
   295 extern DECLSPEC int SDL_HapticSetGain(SDL_Haptic * haptic, int gain);
   306 extern DECLSPEC int SDL_HapticSetGain(SDL_Haptic * haptic, int gain);