include/SDL_haptic.h
branchgsoc2008_force_feedback
changeset 2535 f0ed8471497d
parent 2532 688cad3f6090
child 2536 fe3ee345a5d2
     1.1 --- a/include/SDL_haptic.h	Fri Jul 18 19:22:56 2008 +0000
     1.2 +++ b/include/SDL_haptic.h	Sat Jul 19 15:57:07 2008 +0000
     1.3 @@ -591,6 +591,46 @@
     1.4     Uint16 fade_level; /**< Level at the end of the fade. */
     1.5  } SDL_HapticRamp;
     1.6  /**
     1.7 + * \struct SDL_HapticCustom
     1.8 + *
     1.9 + * \brief A structure containing a template for the SDL_HAPTIC_CUSTOM effect.
    1.10 + *
    1.11 + * A custom force feedback effect is much like a periodic effect, where the
    1.12 + *  application can define it's exact shape.  You will have to allocate the
    1.13 + *  data yourself.  Data should consist of channels * samples Uint16 samples.
    1.14 + *
    1.15 + * If channels is one, the effect is rotated using the defined direction.
    1.16 + *  Otherwise it uses the samples in data for the different axes.
    1.17 + *
    1.18 + * \sa SDL_HAPTIC_CUSTOM
    1.19 + * \sa SDL_HapticEffect
    1.20 + */
    1.21 +typedef struct SDL_HapticCustom {
    1.22 +   /* Header */
    1.23 +   Uint16 type; /**< SDL_HAPTIC_CUSTOM */
    1.24 +   SDL_HapticDirection direction; /**< Direction of the effect. */
    1.25 +
    1.26 +   /* Replay */
    1.27 +   Uint32 length; /**< Duration of the effect. */
    1.28 +   Uint16 delay; /**< Delay before starting the effect. */
    1.29 +
    1.30 +   /* Trigger */
    1.31 +   Uint16 button; /**< Button that triggers the effect. */
    1.32 +   Uint16 interval; /**< How soon it can be triggered again after button. */
    1.33 +
    1.34 +   /* Custom */
    1.35 +   Uint8 channels; /**< Axes to use, minimum of one. */
    1.36 +   Uint16 period; /**< Sample periods. */
    1.37 +   Uint16 samples; /**< Amount of samples. */
    1.38 +   Uint16 *data; /**< Should contain channels*samples items. */
    1.39 +
    1.40 +   /* Envelope */                                                         
    1.41 +   Uint16 attack_length; /**< Duration of the attack. */
    1.42 +   Uint16 attack_level; /**< Level at the start of the attack. */
    1.43 +   Uint16 fade_length; /**< Duration of the fade. */
    1.44 +   Uint16 fade_level; /**< Level at the end of the fade. */
    1.45 +} SDL_HapticCustom;
    1.46 +/**
    1.47   * \union SDL_HapticEffect
    1.48   *
    1.49   * \brief The generic template for any haptic effect.
    1.50 @@ -652,6 +692,7 @@
    1.51   * \sa SDL_HapticPeriodic
    1.52   * \sa SDL_HapticCondition
    1.53   * \sa SDL_HapticRamp
    1.54 + * \sa SDL_HapticCustom
    1.55   */
    1.56  typedef union SDL_HapticEffect {
    1.57     /* Common for all force feedback effects */
    1.58 @@ -660,6 +701,7 @@
    1.59     SDL_HapticPeriodic periodic; /**< Periodic effect. */
    1.60     SDL_HapticCondition condition; /**< Condition effect. */
    1.61     SDL_HapticRamp ramp; /**< Ramp effect. */
    1.62 +   SDL_HapticCustom custom; /**< Custom effect. */
    1.63  } SDL_HapticEffect;
    1.64  
    1.65