include/SDL_haptic.h
author David Ludwig <dludwig@pobox.com>
Mon, 01 Apr 2013 21:33:06 -0400
changeset 8453 499aa167ea79
parent 6885 700f1b25f77f
child 7120 bc4424a5a38f
permissions -rw-r--r--
WinRT: made WinRT path retrieval be available in both UCS-2 and UTF-8 flavors
     1 /*
     2   Simple DirectMedia Layer
     3   Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
     4 
     5   This software is provided 'as-is', without any express or implied
     6   warranty.  In no event will the authors be held liable for any damages
     7   arising from the use of this software.
     8 
     9   Permission is granted to anyone to use this software for any purpose,
    10   including commercial applications, and to alter it and redistribute it
    11   freely, subject to the following restrictions:
    12 
    13   1. The origin of this software must not be misrepresented; you must not
    14      claim that you wrote the original software. If you use this software
    15      in a product, an acknowledgment in the product documentation would be
    16      appreciated but is not required.
    17   2. Altered source versions must be plainly marked as such, and must not be
    18      misrepresented as being the original software.
    19   3. This notice may not be removed or altered from any source distribution.
    20 */
    21 
    22 /**
    23  *  \file SDL_haptic.h
    24  *  
    25  *  \brief The SDL Haptic subsystem allows you to control haptic (force feedback)
    26  *         devices.
    27  * 
    28  *  The basic usage is as follows:
    29  *   - Initialize the Subsystem (::SDL_INIT_HAPTIC).
    30  *   - Open a Haptic Device.
    31  *    - SDL_HapticOpen() to open from index.
    32  *    - SDL_HapticOpenFromJoystick() to open from an existing joystick.
    33  *   - Create an effect (::SDL_HapticEffect).
    34  *   - Upload the effect with SDL_HapticNewEffect().
    35  *   - Run the effect with SDL_HapticRunEffect().
    36  *   - (optional) Free the effect with SDL_HapticDestroyEffect().
    37  *   - Close the haptic device with SDL_HapticClose().
    38  *
    39  * \par Simple rumble example:
    40  * \code
    41  *    SDL_Haptic *haptic;
    42  *
    43  *    // Open the device
    44  *    haptic = SDL_HapticOpen( 0 );
    45  *    if (haptic == NULL)
    46  *       return -1;
    47  *
    48  *    // Initialize simple rumble
    49  *    if (SDL_HapticRumbleInit( haptic ) != 0)
    50  *       return -1;
    51  *
    52  *    // Play effect at 50% strength for 2 seconds
    53  *    if (SDL_HapticRumblePlay( haptic, 0.5, 2000 ) != 0)
    54  *       return -1;
    55  *    SDL_Delay( 2000 );
    56  *
    57  *    // Clean up
    58  *    SDL_HapticClose( haptic );
    59  * \endcode
    60  *
    61  * \par Complete example:
    62  * \code
    63  * int test_haptic( SDL_Joystick * joystick ) {
    64  *    SDL_Haptic *haptic;
    65  *    SDL_HapticEffect effect;
    66  *    int effect_id;
    67  *
    68  *    // Open the device
    69  *    haptic = SDL_HapticOpenFromJoystick( joystick );
    70  *    if (haptic == NULL) return -1; // Most likely joystick isn't haptic
    71  *
    72  *    // See if it can do sine waves
    73  *    if ((SDL_HapticQuery(haptic) & SDL_HAPTIC_SINE)==0) {
    74  *       SDL_HapticClose(haptic); // No sine effect
    75  *       return -1;
    76  *    }
    77  *
    78  *    // Create the effect
    79  *    memset( &effect, 0, sizeof(SDL_HapticEffect) ); // 0 is safe default
    80  *    effect.type = SDL_HAPTIC_SINE;
    81  *    effect.periodic.direction.type = SDL_HAPTIC_POLAR; // Polar coordinates
    82  *    effect.periodic.direction.dir[0] = 18000; // Force comes from south
    83  *    effect.periodic.period = 1000; // 1000 ms
    84  *    effect.periodic.magnitude = 20000; // 20000/32767 strength
    85  *    effect.periodic.length = 5000; // 5 seconds long
    86  *    effect.periodic.attack_length = 1000; // Takes 1 second to get max strength
    87  *    effect.periodic.fade_length = 1000; // Takes 1 second to fade away
    88  *
    89  *    // Upload the effect
    90  *    effect_id = SDL_HapticNewEffect( haptic, &effect );
    91  *
    92  *    // Test the effect
    93  *    SDL_HapticRunEffect( haptic, effect_id, 1 );
    94  *    SDL_Delay( 5000); // Wait for the effect to finish
    95  *
    96  *    // We destroy the effect, although closing the device also does this
    97  *    SDL_HapticDestroyEffect( haptic, effect_id );
    98  *
    99  *    // Close the device
   100  *    SDL_HapticClose(haptic);
   101  *
   102  *    return 0; // Success
   103  * }
   104  * \endcode
   105  *
   106  * You can also find out more information on my blog:
   107  * http://bobbens.dyndns.org/journal/2010/sdl_haptic/
   108  *
   109  * \author Edgar Simo Serra
   110  */
   111 
   112 #ifndef _SDL_haptic_h
   113 #define _SDL_haptic_h
   114 
   115 #include "SDL_stdinc.h"
   116 #include "SDL_error.h"
   117 #include "SDL_joystick.h"
   118 
   119 #include "begin_code.h"
   120 /* Set up for C function definitions, even when using C++ */
   121 #ifdef __cplusplus
   122 /* *INDENT-OFF* */
   123 extern "C" {
   124    /* *INDENT-ON* */                                                         
   125 #endif /* __cplusplus */
   126 
   127 /**
   128  *  \typedef SDL_Haptic
   129  *  
   130  *  \brief The haptic structure used to identify an SDL haptic.
   131  *  
   132  *  \sa SDL_HapticOpen
   133  *  \sa SDL_HapticOpenFromJoystick
   134  *  \sa SDL_HapticClose
   135  */
   136 struct _SDL_Haptic;
   137 typedef struct _SDL_Haptic SDL_Haptic;
   138 
   139 
   140 /**
   141  *  \name Haptic features
   142  *  
   143  *  Different haptic features a device can have.
   144  */
   145 /*@{*/
   146 
   147 /**
   148  *  \name Haptic effects
   149  */
   150 /*@{*/
   151 
   152 /**
   153  *  \brief Constant effect supported.
   154  *
   155  *  Constant haptic effect.
   156  *  
   157  *  \sa SDL_HapticCondition
   158  */
   159 #define SDL_HAPTIC_CONSTANT   (1<<0)
   160 
   161 /**
   162  *  \brief Sine wave effect supported.
   163  *  
   164  *  Periodic haptic effect that simulates sine waves.
   165  *  
   166  *  \sa SDL_HapticPeriodic
   167  */
   168 #define SDL_HAPTIC_SINE       (1<<1)
   169 
   170 /**
   171  *  \brief Square wave effect supported.
   172  *  
   173  *  Periodic haptic effect that simulates square waves.
   174  * 
   175  *  \sa SDL_HapticPeriodic
   176  */
   177 #define SDL_HAPTIC_SQUARE     (1<<2)
   178 
   179 /**
   180  *  \brief Triangle wave effect supported.
   181  *  
   182  *  Periodic haptic effect that simulates triangular waves.
   183  *  
   184  *  \sa SDL_HapticPeriodic
   185  */
   186 #define SDL_HAPTIC_TRIANGLE   (1<<3)
   187 
   188 /**
   189  *  \brief Sawtoothup wave effect supported.
   190  *  
   191  *  Periodic haptic effect that simulates saw tooth up waves.
   192  *  
   193  *  \sa SDL_HapticPeriodic
   194  */
   195 #define SDL_HAPTIC_SAWTOOTHUP (1<<4)
   196 
   197 /**
   198  *  \brief Sawtoothdown wave effect supported.
   199  *  
   200  *  Periodic haptic effect that simulates saw tooth down waves.
   201  *  
   202  *  \sa SDL_HapticPeriodic
   203  */
   204 #define SDL_HAPTIC_SAWTOOTHDOWN (1<<5)
   205 
   206 /**
   207  *  \brief Ramp effect supported.
   208  *  
   209  *  Ramp haptic effect.
   210  *  
   211  *  \sa SDL_HapticRamp
   212  */
   213 #define SDL_HAPTIC_RAMP       (1<<6)
   214 
   215 /**
   216  *  \brief Spring effect supported - uses axes position.
   217  *  
   218  *  Condition haptic effect that simulates a spring.  Effect is based on the
   219  *  axes position.
   220  *
   221  *  \sa SDL_HapticCondition
   222  */
   223 #define SDL_HAPTIC_SPRING     (1<<7)
   224 
   225 /**
   226  *  \brief Damper effect supported - uses axes velocity.
   227  *  
   228  *  Condition haptic effect that simulates dampening.  Effect is based on the
   229  *  axes velocity.
   230  *  
   231  *  \sa SDL_HapticCondition
   232  */
   233 #define SDL_HAPTIC_DAMPER     (1<<8)
   234 
   235 /**
   236  *  \brief Inertia effect supported - uses axes acceleration.
   237  *  
   238  *  Condition haptic effect that simulates inertia.  Effect is based on the axes
   239  *  acceleration.
   240  *
   241  *  \sa SDL_HapticCondition
   242  */
   243 #define SDL_HAPTIC_INERTIA    (1<<9)
   244 
   245 /**
   246  *  \brief Friction effect supported - uses axes movement.
   247  *  
   248  *  Condition haptic effect that simulates friction.  Effect is based on the 
   249  *  axes movement.
   250  *  
   251  *  \sa SDL_HapticCondition
   252  */
   253 #define SDL_HAPTIC_FRICTION   (1<<10)
   254 
   255 /**
   256  *  \brief Custom effect is supported.
   257  *  
   258  *  User defined custom haptic effect.
   259  */
   260 #define SDL_HAPTIC_CUSTOM     (1<<11)
   261 
   262 /*@}*//*Haptic effects*/
   263 
   264 /* These last few are features the device has, not effects */
   265 
   266 /**
   267  *  \brief Device can set global gain.
   268  *  
   269  *  Device supports setting the global gain.
   270  *  
   271  *  \sa SDL_HapticSetGain
   272  */
   273 #define SDL_HAPTIC_GAIN       (1<<12)
   274 
   275 /**
   276  *  \brief Device can set autocenter.
   277  *  
   278  *  Device supports setting autocenter.
   279  *  
   280  *  \sa SDL_HapticSetAutocenter
   281  */
   282 #define SDL_HAPTIC_AUTOCENTER (1<<13)
   283 
   284 /**
   285  *  \brief Device can be queried for effect status.
   286  *  
   287  *  Device can be queried for effect status.
   288  *  
   289  *  \sa SDL_HapticGetEffectStatus
   290  */
   291 #define SDL_HAPTIC_STATUS     (1<<14)
   292 
   293 /**
   294  *  \brief Device can be paused.
   295  *  
   296  *  \sa SDL_HapticPause
   297  *  \sa SDL_HapticUnpause
   298  */
   299 #define SDL_HAPTIC_PAUSE      (1<<15)
   300 
   301 
   302 /**
   303  * \name Direction encodings
   304  */
   305 /*@{*/
   306 
   307 /**
   308  *  \brief Uses polar coordinates for the direction.
   309  *  
   310  *  \sa SDL_HapticDirection
   311  */
   312 #define SDL_HAPTIC_POLAR      0
   313 
   314 /**
   315  *  \brief Uses cartesian coordinates for the direction.
   316  *  
   317  *  \sa SDL_HapticDirection
   318  */
   319 #define SDL_HAPTIC_CARTESIAN  1
   320 
   321 /**
   322  *  \brief Uses spherical coordinates for the direction.
   323  *  
   324  *  \sa SDL_HapticDirection
   325  */
   326 #define SDL_HAPTIC_SPHERICAL  2
   327 
   328 /*@}*//*Direction encodings*/
   329 
   330 /*@}*//*Haptic features*/
   331 
   332 /*
   333  * Misc defines.
   334  */
   335 
   336 /**
   337  * \brief Used to play a device an infinite number of times.
   338  *
   339  * \sa SDL_HapticRunEffect
   340  */
   341 #define SDL_HAPTIC_INFINITY   4294967295U
   342 
   343 
   344 /**
   345  *  \brief Structure that represents a haptic direction.
   346  *  
   347  *  Directions can be specified by:
   348  *   - ::SDL_HAPTIC_POLAR : Specified by polar coordinates.
   349  *   - ::SDL_HAPTIC_CARTESIAN : Specified by cartesian coordinates.
   350  *   - ::SDL_HAPTIC_SPHERICAL : Specified by spherical coordinates.
   351  *
   352  *  Cardinal directions of the haptic device are relative to the positioning
   353  *  of the device.  North is considered to be away from the user.
   354  *
   355  *  The following diagram represents the cardinal directions:
   356  *  \verbatim
   357                  .--.
   358                  |__| .-------.
   359                  |=.| |.-----.|
   360                  |--| ||     ||
   361                  |  | |'-----'|
   362                  |__|~')_____('
   363                    [ COMPUTER ]
   364     
   365     
   366                      North (0,-1)
   367                          ^
   368                          |
   369                          |
   370     (1,0)  West <----[ HAPTIC ]----> East (-1,0)
   371                          |
   372                          |
   373                          v
   374                       South (0,1)
   375     
   376     
   377                       [ USER ]
   378                         \|||/
   379                         (o o)
   380                   ---ooO-(_)-Ooo---
   381     \endverbatim
   382  *  
   383  *  If type is ::SDL_HAPTIC_POLAR, direction is encoded by hundredths of a 
   384  *  degree starting north and turning clockwise.  ::SDL_HAPTIC_POLAR only uses
   385  *  the first \c dir parameter.  The cardinal directions would be:
   386  *   - North: 0 (0 degrees)
   387  *   - East: 9000 (90 degrees)
   388  *   - South: 18000 (180 degrees)
   389  *   - West: 27000 (270 degrees)
   390  *  
   391  *  If type is ::SDL_HAPTIC_CARTESIAN, direction is encoded by three positions
   392  *  (X axis, Y axis and Z axis (with 3 axes)).  ::SDL_HAPTIC_CARTESIAN uses
   393  *  the first three \c dir parameters.  The cardinal directions would be:
   394  *   - North:  0,-1, 0
   395  *   - East:  -1, 0, 0
   396  *   - South:  0, 1, 0
   397  *   - West:   1, 0, 0
   398  *  
   399  *  The Z axis represents the height of the effect if supported, otherwise
   400  *  it's unused.  In cartesian encoding (1, 2) would be the same as (2, 4), you
   401  *  can use any multiple you want, only the direction matters.
   402  *  
   403  *  If type is ::SDL_HAPTIC_SPHERICAL, direction is encoded by two rotations.
   404  *  The first two \c dir parameters are used.  The \c dir parameters are as 
   405  *  follows (all values are in hundredths of degrees):
   406  *   - Degrees from (1, 0) rotated towards (0, 1).
   407  *   - Degrees towards (0, 0, 1) (device needs at least 3 axes).
   408  *
   409  *
   410  *  Example of force coming from the south with all encodings (force coming
   411  *  from the south means the user will have to pull the stick to counteract):
   412  *  \code
   413  *  SDL_HapticDirection direction;
   414  *  
   415  *  // Cartesian directions
   416  *  direction.type = SDL_HAPTIC_CARTESIAN; // Using cartesian direction encoding.
   417  *  direction.dir[0] = 0; // X position
   418  *  direction.dir[1] = 1; // Y position
   419  *  // Assuming the device has 2 axes, we don't need to specify third parameter.
   420  *  
   421  *  // Polar directions
   422  *  direction.type = SDL_HAPTIC_POLAR; // We'll be using polar direction encoding.
   423  *  direction.dir[0] = 18000; // Polar only uses first parameter
   424  *  
   425  *  // Spherical coordinates
   426  *  direction.type = SDL_HAPTIC_SPHERICAL; // Spherical encoding
   427  *  direction.dir[0] = 9000; // Since we only have two axes we don't need more parameters.
   428  *  \endcode
   429  *
   430  *  \sa SDL_HAPTIC_POLAR
   431  *  \sa SDL_HAPTIC_CARTESIAN
   432  *  \sa SDL_HAPTIC_SPHERICAL
   433  *  \sa SDL_HapticEffect
   434  *  \sa SDL_HapticNumAxes
   435  */
   436 typedef struct SDL_HapticDirection
   437 {
   438     Uint8 type;         /**< The type of encoding. */
   439     Sint32 dir[3];      /**< The encoded direction. */
   440 } SDL_HapticDirection;
   441 
   442 
   443 /**
   444  *  \brief A structure containing a template for a Constant effect.
   445  *  
   446  *  The struct is exclusive to the ::SDL_HAPTIC_CONSTANT effect.
   447  *  
   448  *  A constant effect applies a constant force in the specified direction
   449  *  to the joystick.
   450  *  
   451  *  \sa SDL_HAPTIC_CONSTANT
   452  *  \sa SDL_HapticEffect
   453  */
   454 typedef struct SDL_HapticConstant
   455 {
   456     /* Header */
   457     Uint16 type;            /**< ::SDL_HAPTIC_CONSTANT */
   458     SDL_HapticDirection direction;  /**< Direction of the effect. */
   459 
   460     /* Replay */
   461     Uint32 length;          /**< Duration of the effect. */
   462     Uint16 delay;           /**< Delay before starting the effect. */
   463 
   464     /* Trigger */
   465     Uint16 button;          /**< Button that triggers the effect. */
   466     Uint16 interval;        /**< How soon it can be triggered again after button. */
   467 
   468     /* Constant */
   469     Sint16 level;           /**< Strength of the constant effect. */
   470 
   471     /* Envelope */
   472     Uint16 attack_length;   /**< Duration of the attack. */
   473     Uint16 attack_level;    /**< Level at the start of the attack. */
   474     Uint16 fade_length;     /**< Duration of the fade. */
   475     Uint16 fade_level;      /**< Level at the end of the fade. */
   476 } SDL_HapticConstant;
   477 
   478 /**
   479  *  \brief A structure containing a template for a Periodic effect.
   480  *  
   481  *  The struct handles the following effects:
   482  *   - ::SDL_HAPTIC_SINE
   483  *   - ::SDL_HAPTIC_SQUARE
   484  *   - ::SDL_HAPTIC_TRIANGLE
   485  *   - ::SDL_HAPTIC_SAWTOOTHUP
   486  *   - ::SDL_HAPTIC_SAWTOOTHDOWN
   487  *  
   488  *  A periodic effect consists in a wave-shaped effect that repeats itself
   489  *  over time.  The type determines the shape of the wave and the parameters
   490  *  determine the dimensions of the wave.
   491  *  
   492  *  Phase is given by hundredth of a cyle meaning that giving the phase a value
   493  *  of 9000 will displace it 25% of it's period.  Here are sample values:
   494  *   -     0: No phase displacement.
   495  *   -  9000: Displaced 25% of it's period.
   496  *   - 18000: Displaced 50% of it's period.
   497  *   - 27000: Displaced 75% of it's period.
   498  *   - 36000: Displaced 100% of it's period, same as 0, but 0 is preffered.
   499  *
   500  *  Examples:
   501  *  \verbatim
   502     SDL_HAPTIC_SINE
   503       __      __      __      __
   504      /  \    /  \    /  \    /
   505     /    \__/    \__/    \__/
   506     
   507     SDL_HAPTIC_SQUARE
   508      __    __    __    __    __
   509     |  |  |  |  |  |  |  |  |  |
   510     |  |__|  |__|  |__|  |__|  |
   511     
   512     SDL_HAPTIC_TRIANGLE
   513       /\    /\    /\    /\    /\
   514      /  \  /  \  /  \  /  \  /
   515     /    \/    \/    \/    \/
   516     
   517     SDL_HAPTIC_SAWTOOTHUP
   518       /|  /|  /|  /|  /|  /|  /|
   519      / | / | / | / | / | / | / |
   520     /  |/  |/  |/  |/  |/  |/  |
   521     
   522     SDL_HAPTIC_SAWTOOTHDOWN
   523     \  |\  |\  |\  |\  |\  |\  |
   524      \ | \ | \ | \ | \ | \ | \ |
   525       \|  \|  \|  \|  \|  \|  \|
   526     \endverbatim
   527  *  
   528  *  \sa SDL_HAPTIC_SINE
   529  *  \sa SDL_HAPTIC_SQUARE
   530  *  \sa SDL_HAPTIC_TRIANGLE
   531  *  \sa SDL_HAPTIC_SAWTOOTHUP
   532  *  \sa SDL_HAPTIC_SAWTOOTHDOWN
   533  *  \sa SDL_HapticEffect
   534  */
   535 typedef struct SDL_HapticPeriodic
   536 {
   537     /* Header */
   538     Uint16 type;        /**< ::SDL_HAPTIC_SINE, ::SDL_HAPTIC_SQUARE,
   539                              ::SDL_HAPTIC_TRIANGLE, ::SDL_HAPTIC_SAWTOOTHUP or
   540                              ::SDL_HAPTIC_SAWTOOTHDOWN */
   541     SDL_HapticDirection direction;  /**< Direction of the effect. */
   542 
   543     /* Replay */
   544     Uint32 length;      /**< Duration of the effect. */
   545     Uint16 delay;       /**< Delay before starting the effect. */
   546 
   547     /* Trigger */
   548     Uint16 button;      /**< Button that triggers the effect. */
   549     Uint16 interval;    /**< How soon it can be triggered again after button. */
   550 
   551     /* Periodic */
   552     Uint16 period;      /**< Period of the wave. */
   553     Sint16 magnitude;   /**< Peak value. */
   554     Sint16 offset;      /**< Mean value of the wave. */
   555     Uint16 phase;       /**< Horizontal shift given by hundredth of a cycle. */
   556 
   557     /* Envelope */
   558     Uint16 attack_length;   /**< Duration of the attack. */
   559     Uint16 attack_level;    /**< Level at the start of the attack. */
   560     Uint16 fade_length; /**< Duration of the fade. */
   561     Uint16 fade_level;  /**< Level at the end of the fade. */
   562 } SDL_HapticPeriodic;
   563 
   564 /**
   565  *  \brief A structure containing a template for a Condition effect.
   566  *  
   567  *  The struct handles the following effects:
   568  *   - ::SDL_HAPTIC_SPRING: Effect based on axes position.
   569  *   - ::SDL_HAPTIC_DAMPER: Effect based on axes velocity.
   570  *   - ::SDL_HAPTIC_INERTIA: Effect based on axes acceleration.
   571  *   - ::SDL_HAPTIC_FRICTION: Effect based on axes movement.
   572  *  
   573  *  Direction is handled by condition internals instead of a direction member.
   574  *  The condition effect specific members have three parameters.  The first
   575  *  refers to the X axis, the second refers to the Y axis and the third
   576  *  refers to the Z axis.  The right terms refer to the positive side of the
   577  *  axis and the left terms refer to the negative side of the axis.  Please 
   578  *  refer to the ::SDL_HapticDirection diagram for which side is positive and
   579  *  which is negative.
   580  *  
   581  *  \sa SDL_HapticDirection
   582  *  \sa SDL_HAPTIC_SPRING
   583  *  \sa SDL_HAPTIC_DAMPER
   584  *  \sa SDL_HAPTIC_INERTIA
   585  *  \sa SDL_HAPTIC_FRICTION
   586  *  \sa SDL_HapticEffect
   587  */
   588 typedef struct SDL_HapticCondition
   589 {
   590     /* Header */
   591     Uint16 type;            /**< ::SDL_HAPTIC_SPRING, ::SDL_HAPTIC_DAMPER,
   592                                  ::SDL_HAPTIC_INERTIA or ::SDL_HAPTIC_FRICTION */
   593     SDL_HapticDirection direction;  /**< Direction of the effect - Not used ATM. */
   594 
   595     /* Replay */
   596     Uint32 length;          /**< Duration of the effect. */
   597     Uint16 delay;           /**< Delay before starting the effect. */
   598 
   599     /* Trigger */
   600     Uint16 button;          /**< Button that triggers the effect. */
   601     Uint16 interval;        /**< How soon it can be triggered again after button. */
   602 
   603     /* Condition */
   604     Uint16 right_sat[3];    /**< Level when joystick is to the positive side. */
   605     Uint16 left_sat[3];     /**< Level when joystick is to the negative side. */
   606     Sint16 right_coeff[3];  /**< How fast to increase the force towards the positive side. */
   607     Sint16 left_coeff[3];   /**< How fast to increase the force towards the negative side. */
   608     Uint16 deadband[3];     /**< Size of the dead zone. */
   609     Sint16 center[3];       /**< Position of the dead zone. */
   610 } SDL_HapticCondition;
   611 
   612 /**
   613  *  \brief A structure containing a template for a Ramp effect.
   614  *  
   615  *  This struct is exclusively for the ::SDL_HAPTIC_RAMP effect.
   616  *  
   617  *  The ramp effect starts at start strength and ends at end strength.
   618  *  It augments in linear fashion.  If you use attack and fade with a ramp
   619  *  they effects get added to the ramp effect making the effect become
   620  *  quadratic instead of linear.
   621  *  
   622  *  \sa SDL_HAPTIC_RAMP
   623  *  \sa SDL_HapticEffect
   624  */
   625 typedef struct SDL_HapticRamp
   626 {
   627     /* Header */
   628     Uint16 type;            /**< ::SDL_HAPTIC_RAMP */
   629     SDL_HapticDirection direction;  /**< Direction of the effect. */
   630 
   631     /* Replay */
   632     Uint32 length;          /**< Duration of the effect. */
   633     Uint16 delay;           /**< Delay before starting the effect. */
   634 
   635     /* Trigger */
   636     Uint16 button;          /**< Button that triggers the effect. */
   637     Uint16 interval;        /**< How soon it can be triggered again after button. */
   638 
   639     /* Ramp */
   640     Sint16 start;           /**< Beginning strength level. */
   641     Sint16 end;             /**< Ending strength level. */
   642 
   643     /* Envelope */
   644     Uint16 attack_length;   /**< Duration of the attack. */
   645     Uint16 attack_level;    /**< Level at the start of the attack. */
   646     Uint16 fade_length;     /**< Duration of the fade. */
   647     Uint16 fade_level;      /**< Level at the end of the fade. */
   648 } SDL_HapticRamp;
   649 
   650 /**
   651  *  \brief A structure containing a template for the ::SDL_HAPTIC_CUSTOM effect.
   652  *  
   653  *  A custom force feedback effect is much like a periodic effect, where the
   654  *  application can define it's exact shape.  You will have to allocate the
   655  *  data yourself.  Data should consist of channels * samples Uint16 samples.
   656  *  
   657  *  If channels is one, the effect is rotated using the defined direction.
   658  *  Otherwise it uses the samples in data for the different axes.
   659  *  
   660  *  \sa SDL_HAPTIC_CUSTOM
   661  *  \sa SDL_HapticEffect
   662  */
   663 typedef struct SDL_HapticCustom
   664 {
   665     /* Header */
   666     Uint16 type;            /**< ::SDL_HAPTIC_CUSTOM */
   667     SDL_HapticDirection direction;  /**< Direction of the effect. */
   668 
   669     /* Replay */
   670     Uint32 length;          /**< Duration of the effect. */
   671     Uint16 delay;           /**< Delay before starting the effect. */
   672 
   673     /* Trigger */
   674     Uint16 button;          /**< Button that triggers the effect. */
   675     Uint16 interval;        /**< How soon it can be triggered again after button. */
   676 
   677     /* Custom */
   678     Uint8 channels;         /**< Axes to use, minimum of one. */
   679     Uint16 period;          /**< Sample periods. */
   680     Uint16 samples;         /**< Amount of samples. */
   681     Uint16 *data;           /**< Should contain channels*samples items. */
   682 
   683     /* Envelope */
   684     Uint16 attack_length;   /**< Duration of the attack. */
   685     Uint16 attack_level;    /**< Level at the start of the attack. */
   686     Uint16 fade_length;     /**< Duration of the fade. */
   687     Uint16 fade_level;      /**< Level at the end of the fade. */
   688 } SDL_HapticCustom;
   689 
   690 /**
   691  *  \brief The generic template for any haptic effect.
   692  *  
   693  *  All values max at 32767 (0x7FFF).  Signed values also can be negative.
   694  *  Time values unless specified otherwise are in milliseconds.
   695  *  
   696  *  You can also pass ::SDL_HAPTIC_INFINITY to length instead of a 0-32767 
   697  *  value.  Neither delay, interval, attack_length nor fade_length support 
   698  *  ::SDL_HAPTIC_INFINITY.  Fade will also not be used since effect never ends.
   699  *  
   700  *  Additionally, the ::SDL_HAPTIC_RAMP effect does not support a duration of
   701  *  ::SDL_HAPTIC_INFINITY.
   702  *  
   703  *  Button triggers may not be supported on all devices, it is advised to not
   704  *  use them if possible.  Buttons start at index 1 instead of index 0 like
   705  *  they joystick.
   706  *  
   707  *  If both attack_length and fade_level are 0, the envelope is not used,
   708  *  otherwise both values are used.
   709  *  
   710  *  Common parts:
   711  *  \code
   712  *  // Replay - All effects have this
   713  *  Uint32 length;        // Duration of effect (ms).
   714  *  Uint16 delay;         // Delay before starting effect.
   715  *  
   716  *  // Trigger - All effects have this
   717  *  Uint16 button;        // Button that triggers effect.
   718  *  Uint16 interval;      // How soon before effect can be triggered again.
   719  *  
   720  *  // Envelope - All effects except condition effects have this
   721  *  Uint16 attack_length; // Duration of the attack (ms).
   722  *  Uint16 attack_level;  // Level at the start of the attack.
   723  *  Uint16 fade_length;   // Duration of the fade out (ms).
   724  *  Uint16 fade_level;    // Level at the end of the fade.
   725  *  \endcode
   726  *
   727  *
   728  *  Here we have an example of a constant effect evolution in time:
   729  *  \verbatim
   730     Strength
   731     ^
   732     |
   733     |    effect level -->  _________________
   734     |                     /                 \
   735     |                    /                   \
   736     |                   /                     \
   737     |                  /                       \ 
   738     | attack_level --> |                        \
   739     |                  |                        |  <---  fade_level
   740     |
   741     +--------------------------------------------------> Time
   742                        [--]                 [---]
   743                        attack_length        fade_length
   744     
   745     [------------------][-----------------------]
   746     delay               length
   747     \endverbatim
   748  *  
   749  *  Note either the attack_level or the fade_level may be above the actual
   750  *  effect level.
   751  *
   752  *  \sa SDL_HapticConstant
   753  *  \sa SDL_HapticPeriodic
   754  *  \sa SDL_HapticCondition
   755  *  \sa SDL_HapticRamp
   756  *  \sa SDL_HapticCustom
   757  */
   758 typedef union SDL_HapticEffect
   759 {
   760     /* Common for all force feedback effects */
   761     Uint16 type;                    /**< Effect type. */
   762     SDL_HapticConstant constant;    /**< Constant effect. */
   763     SDL_HapticPeriodic periodic;    /**< Periodic effect. */
   764     SDL_HapticCondition condition;  /**< Condition effect. */
   765     SDL_HapticRamp ramp;            /**< Ramp effect. */
   766     SDL_HapticCustom custom;        /**< Custom effect. */
   767 } SDL_HapticEffect;
   768 
   769 
   770 /* Function prototypes */
   771 /**
   772  *  \brief Count the number of joysticks attached to the system.
   773  *  
   774  *  \return Number of haptic devices detected on the system.
   775  */
   776 extern DECLSPEC int SDLCALL SDL_NumHaptics(void);
   777 
   778 /**
   779  *  \brief Get the implementation dependent name of a Haptic device.
   780  *  
   781  *  This can be called before any joysticks are opened.
   782  *  If no name can be found, this function returns NULL.
   783  *  
   784  *  \param device_index Index of the device to get it's name.
   785  *  \return Name of the device or NULL on error.
   786  *
   787  *  \sa SDL_NumHaptics
   788  */
   789 extern DECLSPEC const char *SDLCALL SDL_HapticName(int device_index);
   790 
   791 /**
   792  *  \brief Opens a Haptic device for usage.
   793  *  
   794  *  The index passed as an argument refers to the N'th Haptic device on this 
   795  *  system.
   796  *
   797  *  When opening a haptic device, it's gain will be set to maximum and
   798  *  autocenter will be disabled.  To modify these values use
   799  *  SDL_HapticSetGain() and SDL_HapticSetAutocenter().
   800  *
   801  *  \param device_index Index of the device to open.
   802  *  \return Device identifier or NULL on error.
   803  *
   804  *  \sa SDL_HapticIndex
   805  *  \sa SDL_HapticOpenFromMouse
   806  *  \sa SDL_HapticOpenFromJoystick
   807  *  \sa SDL_HapticClose
   808  *  \sa SDL_HapticSetGain
   809  *  \sa SDL_HapticSetAutocenter
   810  *  \sa SDL_HapticPause
   811  *  \sa SDL_HapticStopAll
   812  */
   813 extern DECLSPEC SDL_Haptic *SDLCALL SDL_HapticOpen(int device_index);
   814 
   815 /**
   816  *  \brief Checks if the haptic device at index has been opened.
   817  *  
   818  *  \param device_index Index to check to see if it has been opened.
   819  *  \return 1 if it has been opened or 0 if it hasn't.
   820  *  
   821  *  \sa SDL_HapticOpen
   822  *  \sa SDL_HapticIndex
   823  */
   824 extern DECLSPEC int SDLCALL SDL_HapticOpened(int device_index);
   825 
   826 /**
   827  *  \brief Gets the index of a haptic device.
   828  *  
   829  *  \param haptic Haptic device to get the index of.
   830  *  \return The index of the haptic device or -1 on error.
   831  *  
   832  *  \sa SDL_HapticOpen
   833  *  \sa SDL_HapticOpened
   834  */
   835 extern DECLSPEC int SDLCALL SDL_HapticIndex(SDL_Haptic * haptic);
   836 
   837 /**
   838  *  \brief Gets whether or not the current mouse has haptic capabilities.
   839  *  
   840  *  \return SDL_TRUE if the mouse is haptic, SDL_FALSE if it isn't.
   841  *  
   842  *  \sa SDL_HapticOpenFromMouse
   843  */
   844 extern DECLSPEC int SDLCALL SDL_MouseIsHaptic(void);
   845 
   846 /**
   847  *  \brief Tries to open a haptic device from the current mouse.
   848  *  
   849  *  \return The haptic device identifier or NULL on error.
   850  *  
   851  *  \sa SDL_MouseIsHaptic
   852  *  \sa SDL_HapticOpen
   853  */
   854 extern DECLSPEC SDL_Haptic *SDLCALL SDL_HapticOpenFromMouse(void);
   855 
   856 /**
   857  *  \brief Checks to see if a joystick has haptic features.
   858  *  
   859  *  \param joystick Joystick to test for haptic capabilities.
   860  *  \return 1 if the joystick is haptic, 0 if it isn't
   861  *          or -1 if an error ocurred.
   862  *  
   863  *  \sa SDL_HapticOpenFromJoystick
   864  */
   865 extern DECLSPEC int SDLCALL SDL_JoystickIsHaptic(SDL_Joystick * joystick);
   866 
   867 /**
   868  *  \brief Opens a Haptic device for usage from a Joystick device.
   869  *  
   870  *  You must still close the haptic device seperately.  It will not be closed 
   871  *  with the joystick.
   872  *  
   873  *  When opening from a joystick you should first close the haptic device before
   874  *  closing the joystick device.  If not, on some implementations the haptic
   875  *  device will also get unallocated and you'll be unable to use force feedback
   876  *  on that device.
   877  *  
   878  *  \param joystick Joystick to create a haptic device from.
   879  *  \return A valid haptic device identifier on success or NULL on error.
   880  *  
   881  *  \sa SDL_HapticOpen
   882  *  \sa SDL_HapticClose
   883  */
   884 extern DECLSPEC SDL_Haptic *SDLCALL SDL_HapticOpenFromJoystick(SDL_Joystick *
   885                                                                joystick);
   886 
   887 /**
   888  *  \brief Closes a Haptic device previously opened with SDL_HapticOpen().
   889  *  
   890  *  \param haptic Haptic device to close.
   891  */
   892 extern DECLSPEC void SDLCALL SDL_HapticClose(SDL_Haptic * haptic);
   893 
   894 /**
   895  *  \brief Returns the number of effects a haptic device can store.
   896  *  
   897  *  On some platforms this isn't fully supported, and therefore is an
   898  *  aproximation.  Always check to see if your created effect was actually
   899  *  created and do not rely solely on SDL_HapticNumEffects().
   900  *  
   901  *  \param haptic The haptic device to query effect max.
   902  *  \return The number of effects the haptic device can store or
   903  *          -1 on error.
   904  *  
   905  *  \sa SDL_HapticNumEffectsPlaying
   906  *  \sa SDL_HapticQuery
   907  */
   908 extern DECLSPEC int SDLCALL SDL_HapticNumEffects(SDL_Haptic * haptic);
   909 
   910 /**
   911  *  \brief Returns the number of effects a haptic device can play at the same 
   912  *         time.
   913  *  
   914  *  This is not supported on all platforms, but will always return a value.  
   915  *  Added here for the sake of completness.
   916  *  
   917  *  \param haptic The haptic device to query maximum playing effects.
   918  *  \return The number of effects the haptic device can play at the same time
   919  *          or -1 on error.
   920  *
   921  *  \sa SDL_HapticNumEffects
   922  *  \sa SDL_HapticQuery
   923  */
   924 extern DECLSPEC int SDLCALL SDL_HapticNumEffectsPlaying(SDL_Haptic * haptic);
   925 
   926 /**
   927  *  \brief Gets the haptic devices supported features in bitwise matter.
   928  *  
   929  *  Example: 
   930  *  \code
   931  *  if (SDL_HapticQueryEffects(haptic) & SDL_HAPTIC_CONSTANT) {
   932  *      printf("We have constant haptic effect!");
   933  *  }
   934  *  \endcode
   935  *  
   936  *  \param haptic The haptic device to query.
   937  *  \return Haptic features in bitwise manner (OR'd).
   938  *  
   939  *  \sa SDL_HapticNumEffects
   940  *  \sa SDL_HapticEffectSupported
   941  */
   942 extern DECLSPEC unsigned int SDLCALL SDL_HapticQuery(SDL_Haptic * haptic);
   943 
   944 
   945 /**
   946  *  \brief Gets the number of haptic axes the device has.
   947  *  
   948  *  \sa SDL_HapticDirection
   949  */
   950 extern DECLSPEC int SDLCALL SDL_HapticNumAxes(SDL_Haptic * haptic);
   951 
   952 /**
   953  *  \brief Checks to see if effect is supported by haptic.
   954  *  
   955  *  \param haptic Haptic device to check on.
   956  *  \param effect Effect to check to see if it is supported.
   957  *  \return SDL_TRUE if effect is supported, SDL_FALSE if it isn't or -1 on error.
   958  *  
   959  *  \sa SDL_HapticQuery
   960  *  \sa SDL_HapticNewEffect
   961  */
   962 extern DECLSPEC int SDLCALL SDL_HapticEffectSupported(SDL_Haptic * haptic,
   963                                                       SDL_HapticEffect *
   964                                                       effect);
   965 
   966 /**
   967  *  \brief Creates a new haptic effect on the device.
   968  *  
   969  *  \param haptic Haptic device to create the effect on.
   970  *  \param effect Properties of the effect to create.
   971  *  \return The id of the effect on success or -1 on error.
   972  *  
   973  *  \sa SDL_HapticUpdateEffect
   974  *  \sa SDL_HapticRunEffect
   975  *  \sa SDL_HapticDestroyEffect
   976  */
   977 extern DECLSPEC int SDLCALL SDL_HapticNewEffect(SDL_Haptic * haptic,
   978                                                 SDL_HapticEffect * effect);
   979 
   980 /**
   981  *  \brief Updates the properties of an effect.
   982  *  
   983  *  Can be used dynamically, although behaviour when dynamically changing
   984  *  direction may be strange.  Specifically the effect may reupload itself
   985  *  and start playing from the start.  You cannot change the type either when
   986  *  running SDL_HapticUpdateEffect().
   987  *  
   988  *  \param haptic Haptic device that has the effect.
   989  *  \param effect Effect to update.
   990  *  \param data New effect properties to use.
   991  *  \return The id of the effect on success or -1 on error.
   992  *  
   993  *  \sa SDL_HapticNewEffect
   994  *  \sa SDL_HapticRunEffect
   995  *  \sa SDL_HapticDestroyEffect
   996  */
   997 extern DECLSPEC int SDLCALL SDL_HapticUpdateEffect(SDL_Haptic * haptic,
   998                                                    int effect,
   999                                                    SDL_HapticEffect * data);
  1000 
  1001 /**
  1002  *  \brief Runs the haptic effect on it's assosciated haptic device.
  1003  *  
  1004  *  If iterations are ::SDL_HAPTIC_INFINITY, it'll run the effect over and over
  1005  *  repeating the envelope (attack and fade) every time.  If you only want the
  1006  *  effect to last forever, set ::SDL_HAPTIC_INFINITY in the effect's length
  1007  *  parameter.
  1008  *  
  1009  *  \param haptic Haptic device to run the effect on.
  1010  *  \param effect Identifier of the haptic effect to run.
  1011  *  \param iterations Number of iterations to run the effect. Use
  1012  *         ::SDL_HAPTIC_INFINITY for infinity.
  1013  *  \return 0 on success or -1 on error.
  1014  *  
  1015  *  \sa SDL_HapticStopEffect
  1016  *  \sa SDL_HapticDestroyEffect
  1017  *  \sa SDL_HapticGetEffectStatus
  1018  */
  1019 extern DECLSPEC int SDLCALL SDL_HapticRunEffect(SDL_Haptic * haptic,
  1020                                                 int effect,
  1021                                                 Uint32 iterations);
  1022 
  1023 /**
  1024  *  \brief Stops the haptic effect on it's assosciated haptic device.
  1025  *  
  1026  *  \param haptic Haptic device to stop the effect on.
  1027  *  \param effect Identifier of the effect to stop.
  1028  *  \return 0 on success or -1 on error.
  1029  *  
  1030  *  \sa SDL_HapticRunEffect
  1031  *  \sa SDL_HapticDestroyEffect
  1032  */
  1033 extern DECLSPEC int SDLCALL SDL_HapticStopEffect(SDL_Haptic * haptic,
  1034                                                  int effect);
  1035 
  1036 /**
  1037  *  \brief Destroys a haptic effect on the device.
  1038  *  
  1039  *  This will stop the effect if it's running.  Effects are automatically 
  1040  *  destroyed when the device is closed.
  1041  *  
  1042  *  \param haptic Device to destroy the effect on.
  1043  *  \param effect Identifier of the effect to destroy.
  1044  *  
  1045  *  \sa SDL_HapticNewEffect
  1046  */
  1047 extern DECLSPEC void SDLCALL SDL_HapticDestroyEffect(SDL_Haptic * haptic,
  1048                                                      int effect);
  1049 
  1050 /**
  1051  *  \brief Gets the status of the current effect on the haptic device.
  1052  *  
  1053  *  Device must support the ::SDL_HAPTIC_STATUS feature.
  1054  *  
  1055  *  \param haptic Haptic device to query the effect status on.
  1056  *  \param effect Identifier of the effect to query it's status.
  1057  *  \return 0 if it isn't playing, ::SDL_HAPTIC_PLAYING if it is playing
  1058  *          or -1 on error.
  1059  *  
  1060  *  \sa SDL_HapticRunEffect
  1061  *  \sa SDL_HapticStopEffect
  1062  */
  1063 extern DECLSPEC int SDLCALL SDL_HapticGetEffectStatus(SDL_Haptic * haptic,
  1064                                                       int effect);
  1065 
  1066 /**
  1067  *  \brief Sets the global gain of the device.
  1068  *  
  1069  *  Device must support the ::SDL_HAPTIC_GAIN feature.
  1070  *  
  1071  *  The user may specify the maxmimum gain by setting the environment variable
  1072  *  ::SDL_HAPTIC_GAIN_MAX which should be between 0 and 100.  All calls to
  1073  *  SDL_HapticSetGain() will scale linearly using ::SDL_HAPTIC_GAIN_MAX as the
  1074  *  maximum.
  1075  *  
  1076  *  \param haptic Haptic device to set the gain on.
  1077  *  \param gain Value to set the gain to, should be between 0 and 100.
  1078  *  \return 0 on success or -1 on error.
  1079  *  
  1080  *  \sa SDL_HapticQuery
  1081  */
  1082 extern DECLSPEC int SDLCALL SDL_HapticSetGain(SDL_Haptic * haptic, int gain);
  1083 
  1084 /**
  1085  *  \brief Sets the global autocenter of the device.
  1086  *  
  1087  *  Autocenter should be between 0 and 100.  Setting it to 0 will disable 
  1088  *  autocentering.
  1089  *
  1090  *  Device must support the ::SDL_HAPTIC_AUTOCENTER feature.
  1091  *
  1092  *  \param haptic Haptic device to set autocentering on.
  1093  *  \param autocenter Value to set autocenter to, 0 disables autocentering.
  1094  *  \return 0 on success or -1 on error.
  1095  *  
  1096  *  \sa SDL_HapticQuery
  1097  */
  1098 extern DECLSPEC int SDLCALL SDL_HapticSetAutocenter(SDL_Haptic * haptic,
  1099                                                     int autocenter);
  1100 
  1101 /**
  1102  *  \brief Pauses a haptic device.
  1103  *  
  1104  *  Device must support the ::SDL_HAPTIC_PAUSE feature.  Call 
  1105  *  SDL_HapticUnpause() to resume playback.
  1106  *  
  1107  *  Do not modify the effects nor add new ones while the device is paused.
  1108  *  That can cause all sorts of weird errors.
  1109  *  
  1110  *  \param haptic Haptic device to pause.
  1111  *  \return 0 on success or -1 on error.
  1112  *  
  1113  *  \sa SDL_HapticUnpause
  1114  */
  1115 extern DECLSPEC int SDLCALL SDL_HapticPause(SDL_Haptic * haptic);
  1116 
  1117 /**
  1118  *  \brief Unpauses a haptic device.
  1119  *  
  1120  *  Call to unpause after SDL_HapticPause().
  1121  *  
  1122  *  \param haptic Haptic device to pause.
  1123  *  \return 0 on success or -1 on error.
  1124  *  
  1125  *  \sa SDL_HapticPause
  1126  */
  1127 extern DECLSPEC int SDLCALL SDL_HapticUnpause(SDL_Haptic * haptic);
  1128 
  1129 /**
  1130  *  \brief Stops all the currently playing effects on a haptic device.
  1131  *  
  1132  *  \param haptic Haptic device to stop.
  1133  *  \return 0 on success or -1 on error.
  1134  */
  1135 extern DECLSPEC int SDLCALL SDL_HapticStopAll(SDL_Haptic * haptic);
  1136 
  1137 /**
  1138  *  \brief Checks to see if rumble is supported on a haptic device..
  1139  *
  1140  *  \param haptic Haptic device to check to see if it supports rumble.
  1141  *  \return SDL_TRUE if effect is supported, SDL_FALSE if it isn't or -1 on error.
  1142  *
  1143  *  \sa SDL_HapticRumbleInit
  1144  *  \sa SDL_HapticRumblePlay
  1145  *  \sa SDL_HapticRumbleStop
  1146  */
  1147 extern DECLSPEC int SDLCALL SDL_HapticRumbleSupported(SDL_Haptic * haptic);
  1148 
  1149 /**
  1150  *  \brief Initializes the haptic device for simple rumble playback.
  1151  *
  1152  *  \param haptic Haptic device to initialize for simple rumble playback.
  1153  *  \return 0 on success or -1 on error.
  1154  *
  1155  *  \sa SDL_HapticOpen
  1156  *  \sa SDL_HapticRumbleSupported
  1157  *  \sa SDL_HapticRumblePlay
  1158  *  \sa SDL_HapticRumbleStop
  1159  */
  1160 extern DECLSPEC int SDLCALL SDL_HapticRumbleInit(SDL_Haptic * haptic);
  1161 
  1162 /**
  1163  *  \brief Runs simple rumble on a haptic device
  1164  *
  1165  *  \param haptic Haptic device to play rumble effect on.
  1166  *  \param strength Strength of the rumble to play as a 0-1 float value.
  1167  *  \param length Length of the rumble to play in miliseconds.
  1168  *  \return 0 on success or -1 on error.
  1169  *
  1170  *  \sa SDL_HapticRumbleSupported
  1171  *  \sa SDL_HapticRumbleInit
  1172  *  \sa SDL_HapticRumbleStop
  1173  */
  1174 extern DECLSPEC int SDLCALL SDL_HapticRumblePlay(SDL_Haptic * haptic, float strength, Uint32 length );
  1175 
  1176 /**
  1177  *  \brief Stops the simple rumble on a haptic device.
  1178  *
  1179  *  \param haptic Haptic to stop the rumble on.
  1180  *  \return 0 on success or -1 on error.
  1181  *
  1182  *  \sa SDL_HapticRumbleSupported
  1183  *  \sa SDL_HapticRumbleInit
  1184  *  \sa SDL_HapticRumblePlay
  1185  */
  1186 extern DECLSPEC int SDLCALL SDL_HapticRumbleStop(SDL_Haptic * haptic);
  1187 
  1188 
  1189 
  1190 /* Ends C function definitions when using C++ */
  1191 #ifdef __cplusplus
  1192 /* *INDENT-OFF* */
  1193 }
  1194 /* *INDENT-ON* */
  1195 #endif
  1196 #include "close_code.h"
  1197 
  1198 #endif /* _SDL_haptic_h */
  1199 
  1200 /* vi: set ts=4 sw=4 expandtab: */