include/SDL_haptic.h
branchgsoc2008_force_feedback
changeset 2487 4c8e25ef2d97
parent 2486 24dd8b8669fa
child 2488 8e2bdbccf7ff
equal deleted inserted replaced
2486:24dd8b8669fa 2487:4c8e25ef2d97
    45 typedef struct _SDL_Haptic SDL_Haptic;
    45 typedef struct _SDL_Haptic SDL_Haptic;
    46 
    46 
    47 
    47 
    48 /* Different effects that can be generated */
    48 /* Different effects that can be generated */
    49 #define SDL_HAPTIC_CONSTANT   (1<<0)
    49 #define SDL_HAPTIC_CONSTANT   (1<<0)
    50 #define SDL_HAPTIC_PERIODIC   (1<<1)
    50 #define SDL_HAPTIC_SINE       (1<<1)
    51 #define SDL_HAPTIC_RAMP       (1<<2)
    51 #define SDL_HAPTIC_SQUARE     (1<<2)
    52 #define SDL_HAPTIC_SPRING     (1<<3)
    52 #define SDL_HAPTIC_TRIANGLE   (1<<3)
    53 #define SDL_HAPTIC_FRICTION   (1<<4)
    53 #define SDL_HAPTIC_SAWTOOTHUP (1<<4)
    54 #define SDL_HAPTIC_DAMPER     (1<<5)
    54 #define SDL_HAPTIC_SAWTOOTHDOWN (1<<5)
    55 #define SDL_HAPTIC_INERTIA    (1<<6)
    55 #define SDL_HAPTIC_RAMP       (1<<6)
    56 #define SDL_HAPTIC_CUSTOM     (1<<7)
    56 #define SDL_HAPTIC_SPRING     (1<<7)
    57 #define SDL_HAPTIC_GAIN       (1<<8)
    57 #define SDL_HAPTIC_FRICTION   (1<<8)
    58 #define SDL_HAPTIC_AUTOCENTER (1<<9)
    58 #define SDL_HAPTIC_DAMPER     (1<<9)
    59 
    59 #define SDL_HAPTIC_INERTIA    (1<<10)
    60 
    60 #define SDL_HAPTIC_CUSTOM     (1<<11)
    61 /*
    61 /* These last two are features the device has, not effects */
    62  * Different waveforms a SDL_HAPTIC_PERIODIC effect can have.
    62 #define SDL_HAPTIC_GAIN       (1<<12)
    63  */
    63 #define SDL_HAPTIC_AUTOCENTER (1<<13)
    64 typedef enum SDL_waveform {
       
    65    SDL_WAVEFORM_SINE,
       
    66    SDL_WAVEFORM_SQUARE,
       
    67    SDL_WAVEFORM_TRIANGLE,
       
    68    SDL_WAVEFORM_SAWTOOTHUP,
       
    69    SDL_WAVEFORM_SAWTOOTHDOWN,
       
    70    SDL_WAVEFORM_CUSTOM
       
    71 } SDL_waveform;
       
    72 
    64 
    73 
    65 
    74 /*
    66 /*
    75  * All values max at 32767 (0x7fff).  Signed values also can be negative.
    67  * All values max at 32767 (0x7fff).  Signed values also can be negative.
    76  * Time values unless specified otherwise are in milliseconds.
    68  * Time values unless specified otherwise are in milliseconds.
   113    Uint16 fade_length;
   105    Uint16 fade_length;
   114    Uint16 fade_level;
   106    Uint16 fade_level;
   115 } SDL_HapticConstant;
   107 } SDL_HapticConstant;
   116 typedef struct SDL_HapticPeriodic {
   108 typedef struct SDL_HapticPeriodic {
   117    /* Header */
   109    /* Header */
   118    Uint16 type; /* SDL_HAPTIC_PERIODIC */
   110    Uint16 type; /* SDL_HAPTIC_{SINE,SQUARE,TRIANGLE,SAWTOOTHUP,SAWTOOTHDOWN} */
   119    Uint16 direction;
   111    Uint16 direction;
   120 
   112 
   121    /* Replay */
   113    /* Replay */
   122    Uint16 length;
   114    Uint16 length;
   123    Uint16 delay;
   115    Uint16 delay;
   125    /* Trigger */
   117    /* Trigger */
   126    Uint16 button;
   118    Uint16 button;
   127    Uint16 interval;
   119    Uint16 interval;
   128 
   120 
   129    /* Periodic */
   121    /* Periodic */
   130    SDL_waveform waveform; /* Type of effect */
       
   131    Uint16 period; /* Period of the wave */
   122    Uint16 period; /* Period of the wave */
   132    Sint16 magnitude; /* Peak value */
   123    Sint16 magnitude; /* Peak value */
   133    Sint16 offset; /* Mean value of the wave */
   124    Sint16 offset; /* Mean value of the wave */
   134    Uint16 phase; /* Horizontal shift */
   125    Uint16 phase; /* Horizontal shift */
   135 
   126