include/SDL_haptic.h
changeset 7621 5caa5fb3deb6
parent 7620 c99a31e02b7a
child 7630 c711a2f14814
equal deleted inserted replaced
7620:c99a31e02b7a 7621:5caa5fb3deb6
   164  *  \sa SDL_HapticPeriodic
   164  *  \sa SDL_HapticPeriodic
   165  */
   165  */
   166 #define SDL_HAPTIC_SINE       (1<<1)
   166 #define SDL_HAPTIC_SINE       (1<<1)
   167 
   167 
   168 /**
   168 /**
   169  *  \brief Square wave effect supported.
   169  *  \brief Left/Right effect supported.
   170  *
   170  *
   171  *  Periodic haptic effect that simulates square waves.
   171  *  Haptic effect for direct control over high/low frequency motors.
   172  *
   172  *
   173  *  \sa SDL_HapticPeriodic
   173  *  \sa SDL_HapticLeftRight
   174  */
   174  * \warning this value was SDL_HAPTIC_SQUARE right before 2.0.0 shipped. Sorry,
   175 #define SDL_HAPTIC_SQUARE     (1<<2)
   175  *          we ran out of bits, and this is important for XInput devices.
       
   176  */
       
   177 #define SDL_HAPTIC_LEFTRIGHT     (1<<2)
       
   178 
       
   179 /* !!! FIXME: put this back when we have more bits in 2.1 */
       
   180 /*#define SDL_HAPTIC_SQUARE     (1<<2)*/
   176 
   181 
   177 /**
   182 /**
   178  *  \brief Triangle wave effect supported.
   183  *  \brief Triangle wave effect supported.
   179  *
   184  *
   180  *  Periodic haptic effect that simulates triangular waves.
   185  *  Periodic haptic effect that simulates triangular waves.
   642     Uint16 attack_length;   /**< Duration of the attack. */
   647     Uint16 attack_length;   /**< Duration of the attack. */
   643     Uint16 attack_level;    /**< Level at the start of the attack. */
   648     Uint16 attack_level;    /**< Level at the start of the attack. */
   644     Uint16 fade_length;     /**< Duration of the fade. */
   649     Uint16 fade_length;     /**< Duration of the fade. */
   645     Uint16 fade_level;      /**< Level at the end of the fade. */
   650     Uint16 fade_level;      /**< Level at the end of the fade. */
   646 } SDL_HapticRamp;
   651 } SDL_HapticRamp;
       
   652 
       
   653 /**
       
   654  * \brief A structure containing a template for a Left/Right effect.
       
   655  *
       
   656  * This struct is exclusively for the ::SDL_HAPTIC_LEFTRIGHT effect.
       
   657  *
       
   658  * The Left/Right effect is used to explicitly control the large and small
       
   659  * motors, commonly found in modern game controllers. One motor is high
       
   660  * frequency, the other is low frequency.
       
   661  *
       
   662  * \sa SDL_HAPTIC_LEFTRIGHT
       
   663  * \sa SDL_HapticEffect
       
   664  */
       
   665 typedef struct SDL_HapticLeftRight
       
   666 {
       
   667     /* Header */
       
   668     Uint16 type;            /**< ::SDL_HAPTIC_LEFTRIGHT */
       
   669 
       
   670     /* Replay */
       
   671     Uint32 length;          /**< Duration of the effect. */
       
   672 
       
   673     /* Rumble */
       
   674     Uint16 large_magnitude; /**< Control of the large controller motor. */
       
   675     Uint16 small_magnitude; /**< Control of the small controller motor. */
       
   676 } SDL_HapticLeftRight;
   647 
   677 
   648 /**
   678 /**
   649  *  \brief A structure containing a template for the ::SDL_HAPTIC_CUSTOM effect.
   679  *  \brief A structure containing a template for the ::SDL_HAPTIC_CUSTOM effect.
   650  *
   680  *
   651  *  A custom force feedback effect is much like a periodic effect, where the
   681  *  A custom force feedback effect is much like a periodic effect, where the
   749  *
   779  *
   750  *  \sa SDL_HapticConstant
   780  *  \sa SDL_HapticConstant
   751  *  \sa SDL_HapticPeriodic
   781  *  \sa SDL_HapticPeriodic
   752  *  \sa SDL_HapticCondition
   782  *  \sa SDL_HapticCondition
   753  *  \sa SDL_HapticRamp
   783  *  \sa SDL_HapticRamp
       
   784  *  \sa SDL_HapticLeftRight
   754  *  \sa SDL_HapticCustom
   785  *  \sa SDL_HapticCustom
   755  */
   786  */
   756 typedef union SDL_HapticEffect
   787 typedef union SDL_HapticEffect
   757 {
   788 {
   758     /* Common for all force feedback effects */
   789     /* Common for all force feedback effects */
   759     Uint16 type;                    /**< Effect type. */
   790     Uint16 type;                    /**< Effect type. */
   760     SDL_HapticConstant constant;    /**< Constant effect. */
   791     SDL_HapticConstant constant;    /**< Constant effect. */
   761     SDL_HapticPeriodic periodic;    /**< Periodic effect. */
   792     SDL_HapticPeriodic periodic;    /**< Periodic effect. */
   762     SDL_HapticCondition condition;  /**< Condition effect. */
   793     SDL_HapticCondition condition;  /**< Condition effect. */
   763     SDL_HapticRamp ramp;            /**< Ramp effect. */
   794     SDL_HapticRamp ramp;            /**< Ramp effect. */
       
   795     SDL_HapticLeftRight leftright;  /**< Left/Right effect. */
   764     SDL_HapticCustom custom;        /**< Custom effect. */
   796     SDL_HapticCustom custom;        /**< Custom effect. */
   765 } SDL_HapticEffect;
   797 } SDL_HapticEffect;
   766 
   798 
   767 
   799 
   768 /* Function prototypes */
   800 /* Function prototypes */
  1180  *  \sa SDL_HapticRumbleInit
  1212  *  \sa SDL_HapticRumbleInit
  1181  *  \sa SDL_HapticRumblePlay
  1213  *  \sa SDL_HapticRumblePlay
  1182  */
  1214  */
  1183 extern DECLSPEC int SDLCALL SDL_HapticRumbleStop(SDL_Haptic * haptic);
  1215 extern DECLSPEC int SDLCALL SDL_HapticRumbleStop(SDL_Haptic * haptic);
  1184 
  1216 
  1185 
       
  1186 
       
  1187 /* Ends C function definitions when using C++ */
  1217 /* Ends C function definitions when using C++ */
  1188 #ifdef __cplusplus
  1218 #ifdef __cplusplus
  1189 }
  1219 }
  1190 #endif
  1220 #endif
  1191 #include "close_code.h"
  1221 #include "close_code.h"