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