src/haptic/SDL_syshaptic.h
branchgsoc2008_force_feedback
changeset 2491 10bc7aaf5114
parent 2488 8e2bdbccf7ff
child 2495 66c02abeef0e
equal deleted inserted replaced
2490:be9b206d44af 2491:10bc7aaf5114
    45 
    45 
    46    struct haptic_hwdata *hwdata; /* Driver dependent */
    46    struct haptic_hwdata *hwdata; /* Driver dependent */
    47    int ref_count; /* Count for multiple opens */
    47    int ref_count; /* Count for multiple opens */
    48 };
    48 };
    49 
    49 
       
    50 /* 
       
    51  * Scans the system for haptic devices.
       
    52  *
       
    53  * Returns 0 on success, -1 on error.
       
    54  */
    50 extern int SDL_SYS_HapticInit(void);
    55 extern int SDL_SYS_HapticInit(void);
       
    56 
       
    57 /*
       
    58  * Gets the device dependent name of the haptic device
       
    59  */
    51 extern const char * SDL_SYS_HapticName(int index);
    60 extern const char * SDL_SYS_HapticName(int index);
       
    61 
       
    62 /*
       
    63  * Opens the haptic device for usage.  The haptic device should have
       
    64  * the index value set previously.
       
    65  *
       
    66  * Returns 0 on success, -1 on error.
       
    67  */
    52 extern int SDL_SYS_HapticOpen(SDL_Haptic * haptic);
    68 extern int SDL_SYS_HapticOpen(SDL_Haptic * haptic);
       
    69 
       
    70 /*
       
    71  * Checks to see if the joystick has haptic capabilities.
       
    72  *
       
    73  * Returns >0 if haptic capabilities are detected, 0 if haptic
       
    74  * capabilities aren't detected and -1 on error.
       
    75  */
       
    76 extern int SDL_JoystickIsHaptic(SDL_Joystick * joystick);
       
    77 
       
    78 /*
       
    79  * Opens the haptic device for usage using the same device as
       
    80  * the joystick.
       
    81  *
       
    82  * Returns 0 on success, -1 on error.
       
    83  */
       
    84 extern int SDL_SYS_HapticOpenFromJoystick(SDL_Haptic * haptic,
       
    85                                           SDL_Joystick * joystick);
       
    86 
       
    87 /*
       
    88  * Checks to see if haptic device and joystick device are the same.
       
    89  *
       
    90  * Returns 1 if they are the same, 0 if they aren't.
       
    91  */
       
    92 extern int SDL_SYS_JoystickSameHaptic(SDL_Haptic * haptic,
       
    93                                       SDL_Joystick * joystick);
       
    94 
       
    95 /*
       
    96  * Closes a haptic device after usage.
       
    97  */
    53 extern void SDL_SYS_HapticClose(SDL_Haptic * haptic);
    98 extern void SDL_SYS_HapticClose(SDL_Haptic * haptic);
       
    99 
       
   100 /*
       
   101  * Performs a cleanup on the haptic subsystem.
       
   102  */
    54 extern void SDL_SYS_HapticQuit(void);
   103 extern void SDL_SYS_HapticQuit(void);
       
   104 
       
   105 /*
       
   106  * Creates a new haptic effect on the haptic device using base
       
   107  * as a template for the effect.
       
   108  *
       
   109  * Returns 0 on success, -1 on error.
       
   110  */
    55 extern int SDL_SYS_HapticNewEffect(SDL_Haptic * haptic,
   111 extern int SDL_SYS_HapticNewEffect(SDL_Haptic * haptic,
    56       struct haptic_effect * effect, SDL_HapticEffect * base);
   112                                  struct haptic_effect * effect,
       
   113                                  SDL_HapticEffect * base);
       
   114 
       
   115 /*
       
   116  * Updates the haptic effect on the haptic device using data
       
   117  * as a template.
       
   118  *
       
   119  * Returns 0 on success, -1 on error.
       
   120  */
    57 extern int SDL_SYS_HapticUpdateEffect(SDL_Haptic * haptic,
   121 extern int SDL_SYS_HapticUpdateEffect(SDL_Haptic * haptic,
    58       struct haptic_effect * effect, SDL_HapticEffect * data);
   122                                       struct haptic_effect * effect,
       
   123                                       SDL_HapticEffect * data);
       
   124 
       
   125 /*
       
   126  * Runs the effect on the haptic device.
       
   127  *
       
   128  * Returns 0 on success, -1 on error.
       
   129  */
    59 extern int SDL_SYS_HapticRunEffect(SDL_Haptic * haptic,
   130 extern int SDL_SYS_HapticRunEffect(SDL_Haptic * haptic,
    60       struct haptic_effect * effect);
   131                                    struct haptic_effect * effect);
       
   132 
       
   133 /*
       
   134  * Stops the effect on the haptic device.
       
   135  *
       
   136  * Returns 0 on success, -1 on error.
       
   137  */
    61 extern int SDL_SYS_HapticStopEffect(SDL_Haptic * haptic,
   138 extern int SDL_SYS_HapticStopEffect(SDL_Haptic * haptic,
    62       struct haptic_effect * effect);
   139                                     struct haptic_effect * effect);
       
   140 
       
   141 /*
       
   142  * Cleanups up the effect on the haptic device.
       
   143  */
    63 extern void SDL_SYS_HapticDestroyEffect(SDL_Haptic * haptic,
   144 extern void SDL_SYS_HapticDestroyEffect(SDL_Haptic * haptic,
    64       struct haptic_effect * effect);
   145                                         struct haptic_effect * effect);
       
   146 
       
   147 /*
       
   148  * Sets the global gain of the haptic device.
       
   149  *
       
   150  * Returns 0 on success, -1 on error.
       
   151  */
    65 extern int SDL_SYS_HapticSetGain(SDL_Haptic * haptic, int gain);
   152 extern int SDL_SYS_HapticSetGain(SDL_Haptic * haptic, int gain);
    66 extern int SDL_SYS_HapticSetAutocenter(SDL_Haptic * haptic, int autocenter);
   153 
       
   154 /*
       
   155  * Sets the autocenter feature of the haptic device.
       
   156  *
       
   157  * Returns 0 on success, -1 on error.
       
   158  */
       
   159 extern int SDL_SYS_HapticSetAutocenter(SDL_Haptic * haptic,
       
   160                                        int autocenter);
    67 
   161 
    68 
   162