include/SDL_haptic.h
author Edgar Simo <bobbens@gmail.com>
Thu, 03 Jul 2008 09:58:27 +0000
branchgsoc2008_force_feedback
changeset 2495 66c02abeef0e
parent 2489 96adc8025331
child 2497 0893fbf73b3d
permissions -rw-r--r--
Added SDL_HapticGetEffectStatus(). More comments.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2472
3f73c88c9abb First commit of the SDL_haptic subsystem.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
     1
/*
3f73c88c9abb First commit of the SDL_haptic subsystem.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
     2
    SDL - Simple DirectMedia Layer
3f73c88c9abb First commit of the SDL_haptic subsystem.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
     3
    Copyright (C) 2008 Edgar Simo
3f73c88c9abb First commit of the SDL_haptic subsystem.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
     4
3f73c88c9abb First commit of the SDL_haptic subsystem.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
     5
    This library is free software; you can redistribute it and/or
3f73c88c9abb First commit of the SDL_haptic subsystem.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
     6
    modify it under the terms of the GNU Lesser General Public
3f73c88c9abb First commit of the SDL_haptic subsystem.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
     7
    License as published by the Free Software Foundation; either
3f73c88c9abb First commit of the SDL_haptic subsystem.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
     8
    version 2.1 of the License, or (at your option) any later version.
3f73c88c9abb First commit of the SDL_haptic subsystem.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
     9
3f73c88c9abb First commit of the SDL_haptic subsystem.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
    10
    This library is distributed in the hope that it will be useful,
3f73c88c9abb First commit of the SDL_haptic subsystem.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
    11
    but WITHOUT ANY WARRANTY; without even the implied warranty of
3f73c88c9abb First commit of the SDL_haptic subsystem.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
    12
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
3f73c88c9abb First commit of the SDL_haptic subsystem.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
    13
    Lesser General Public License for more details.
3f73c88c9abb First commit of the SDL_haptic subsystem.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
    14
3f73c88c9abb First commit of the SDL_haptic subsystem.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
    15
    You should have received a copy of the GNU Lesser General Public
3f73c88c9abb First commit of the SDL_haptic subsystem.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
    16
    License along with this library; if not, write to the Free Software
3f73c88c9abb First commit of the SDL_haptic subsystem.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
    17
    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
3f73c88c9abb First commit of the SDL_haptic subsystem.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
    18
3f73c88c9abb First commit of the SDL_haptic subsystem.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
    19
    Sam Lantinga
3f73c88c9abb First commit of the SDL_haptic subsystem.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
    20
    slouken@libsdl.org
3f73c88c9abb First commit of the SDL_haptic subsystem.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
    21
*/
3f73c88c9abb First commit of the SDL_haptic subsystem.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
    22
3f73c88c9abb First commit of the SDL_haptic subsystem.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
    23
/**
3f73c88c9abb First commit of the SDL_haptic subsystem.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
    24
 * \file SDL_haptic.h
3f73c88c9abb First commit of the SDL_haptic subsystem.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
    25
 *
3f73c88c9abb First commit of the SDL_haptic subsystem.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
    26
 * Include file for SDL haptic subsystem
3f73c88c9abb First commit of the SDL_haptic subsystem.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
    27
 */
3f73c88c9abb First commit of the SDL_haptic subsystem.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
    28
3f73c88c9abb First commit of the SDL_haptic subsystem.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
    29
#ifndef _SDL_haptic_h
3f73c88c9abb First commit of the SDL_haptic subsystem.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
    30
#define _SDL_haptic_h
3f73c88c9abb First commit of the SDL_haptic subsystem.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
    31
3f73c88c9abb First commit of the SDL_haptic subsystem.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
    32
#include "SDL_stdinc.h"
3f73c88c9abb First commit of the SDL_haptic subsystem.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
    33
#include "SDL_error.h"
2489
96adc8025331 Exposed some of the joystick stuff to the haptic subsystem.
Edgar Simo <bobbens@gmail.com>
parents: 2488
diff changeset
    34
#include "SDL_joystick.h"
2472
3f73c88c9abb First commit of the SDL_haptic subsystem.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
    35
3f73c88c9abb First commit of the SDL_haptic subsystem.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
    36
#include "begin_code.h"
3f73c88c9abb First commit of the SDL_haptic subsystem.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
    37
/* Set up for C function definitions, even when using C++ */
3f73c88c9abb First commit of the SDL_haptic subsystem.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
    38
#ifdef __cplusplus
3f73c88c9abb First commit of the SDL_haptic subsystem.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
    39
/* *INDENT-OFF* */
3f73c88c9abb First commit of the SDL_haptic subsystem.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
    40
extern "C" {
3f73c88c9abb First commit of the SDL_haptic subsystem.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
    41
   /* *INDENT-ON* */                                                         
3f73c88c9abb First commit of the SDL_haptic subsystem.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
    42
#endif
3f73c88c9abb First commit of the SDL_haptic subsystem.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
    43
3f73c88c9abb First commit of the SDL_haptic subsystem.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
    44
/* The haptic structure used to identify an SDL haptic */
3f73c88c9abb First commit of the SDL_haptic subsystem.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
    45
struct _SDL_Haptic;                                                     
3f73c88c9abb First commit of the SDL_haptic subsystem.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
    46
typedef struct _SDL_Haptic SDL_Haptic;
3f73c88c9abb First commit of the SDL_haptic subsystem.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
    47
3f73c88c9abb First commit of the SDL_haptic subsystem.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
    48
2495
66c02abeef0e Added SDL_HapticGetEffectStatus().
Edgar Simo <bobbens@gmail.com>
parents: 2489
diff changeset
    49
/*
66c02abeef0e Added SDL_HapticGetEffectStatus().
Edgar Simo <bobbens@gmail.com>
parents: 2489
diff changeset
    50
 * Different haptic features a device can have.
66c02abeef0e Added SDL_HapticGetEffectStatus().
Edgar Simo <bobbens@gmail.com>
parents: 2489
diff changeset
    51
 */
66c02abeef0e Added SDL_HapticGetEffectStatus().
Edgar Simo <bobbens@gmail.com>
parents: 2489
diff changeset
    52
#define SDL_HAPTIC_CONSTANT   (1<<0) /* Constant effect supported */
66c02abeef0e Added SDL_HapticGetEffectStatus().
Edgar Simo <bobbens@gmail.com>
parents: 2489
diff changeset
    53
#define SDL_HAPTIC_SINE       (1<<1) /* Sine wave effect supported */
66c02abeef0e Added SDL_HapticGetEffectStatus().
Edgar Simo <bobbens@gmail.com>
parents: 2489
diff changeset
    54
#define SDL_HAPTIC_SQUARE     (1<<2) /* Square wave effect supported */
66c02abeef0e Added SDL_HapticGetEffectStatus().
Edgar Simo <bobbens@gmail.com>
parents: 2489
diff changeset
    55
#define SDL_HAPTIC_TRIANGLE   (1<<3) /* Triangle wave effect supported */
66c02abeef0e Added SDL_HapticGetEffectStatus().
Edgar Simo <bobbens@gmail.com>
parents: 2489
diff changeset
    56
#define SDL_HAPTIC_SAWTOOTHUP (1<<4) /* Sawtoothup wave effect supported */
66c02abeef0e Added SDL_HapticGetEffectStatus().
Edgar Simo <bobbens@gmail.com>
parents: 2489
diff changeset
    57
#define SDL_HAPTIC_SAWTOOTHDOWN (1<<5) /* Sawtoothdown wave effect supported */
66c02abeef0e Added SDL_HapticGetEffectStatus().
Edgar Simo <bobbens@gmail.com>
parents: 2489
diff changeset
    58
#define SDL_HAPTIC_RAMP       (1<<6) /* Ramp effect supported */
66c02abeef0e Added SDL_HapticGetEffectStatus().
Edgar Simo <bobbens@gmail.com>
parents: 2489
diff changeset
    59
#define SDL_HAPTIC_SPRING     (1<<7) /* Spring effect supported - uses axes position */
66c02abeef0e Added SDL_HapticGetEffectStatus().
Edgar Simo <bobbens@gmail.com>
parents: 2489
diff changeset
    60
#define SDL_HAPTIC_DAMPER     (1<<8) /* Damper effect supported - uses axes velocity */
66c02abeef0e Added SDL_HapticGetEffectStatus().
Edgar Simo <bobbens@gmail.com>
parents: 2489
diff changeset
    61
#define SDL_HAPTIC_INERTIA    (1<<9) /* Inertia effect supported - uses axes acceleration */
66c02abeef0e Added SDL_HapticGetEffectStatus().
Edgar Simo <bobbens@gmail.com>
parents: 2489
diff changeset
    62
#define SDL_HAPTIC_FRICTION   (1<<10) /* Friction effect supported - uses axes movement */
66c02abeef0e Added SDL_HapticGetEffectStatus().
Edgar Simo <bobbens@gmail.com>
parents: 2489
diff changeset
    63
#define SDL_HAPTIC_CUSTOM     (1<<11) /* Custom effect is supported */
2487
4c8e25ef2d97 Merged seperate waveforms into types to be more compatible.
Edgar Simo <bobbens@gmail.com>
parents: 2486
diff changeset
    64
/* These last two are features the device has, not effects */
2495
66c02abeef0e Added SDL_HapticGetEffectStatus().
Edgar Simo <bobbens@gmail.com>
parents: 2489
diff changeset
    65
#define SDL_HAPTIC_GAIN       (1<<12) /* Device can set global gain */
66c02abeef0e Added SDL_HapticGetEffectStatus().
Edgar Simo <bobbens@gmail.com>
parents: 2489
diff changeset
    66
#define SDL_HAPTIC_AUTOCENTER (1<<13) /* Device can set autocenter */
66c02abeef0e Added SDL_HapticGetEffectStatus().
Edgar Simo <bobbens@gmail.com>
parents: 2489
diff changeset
    67
#define SDL_HAPTIC_STATUS     (1<<14) /* Device can be queried for effect status */
2481
5d0ea4576f20 More comments.
Edgar Simo <bobbens@gmail.com>
parents: 2480
diff changeset
    68
5d0ea4576f20 More comments.
Edgar Simo <bobbens@gmail.com>
parents: 2480
diff changeset
    69
5d0ea4576f20 More comments.
Edgar Simo <bobbens@gmail.com>
parents: 2480
diff changeset
    70
/*
5d0ea4576f20 More comments.
Edgar Simo <bobbens@gmail.com>
parents: 2480
diff changeset
    71
 * All values max at 32767 (0x7fff).  Signed values also can be negative.
5d0ea4576f20 More comments.
Edgar Simo <bobbens@gmail.com>
parents: 2480
diff changeset
    72
 * Time values unless specified otherwise are in milliseconds.
5d0ea4576f20 More comments.
Edgar Simo <bobbens@gmail.com>
parents: 2480
diff changeset
    73
 *
5d0ea4576f20 More comments.
Edgar Simo <bobbens@gmail.com>
parents: 2480
diff changeset
    74
 * Common parts:
5d0ea4576f20 More comments.
Edgar Simo <bobbens@gmail.com>
parents: 2480
diff changeset
    75
 * 
5d0ea4576f20 More comments.
Edgar Simo <bobbens@gmail.com>
parents: 2480
diff changeset
    76
 * Replay:
5d0ea4576f20 More comments.
Edgar Simo <bobbens@gmail.com>
parents: 2480
diff changeset
    77
 *    Uint16 length;    Duration of effect.
5d0ea4576f20 More comments.
Edgar Simo <bobbens@gmail.com>
parents: 2480
diff changeset
    78
 *    Uint16 delay;     Delay before starting effect.
5d0ea4576f20 More comments.
Edgar Simo <bobbens@gmail.com>
parents: 2480
diff changeset
    79
 *
5d0ea4576f20 More comments.
Edgar Simo <bobbens@gmail.com>
parents: 2480
diff changeset
    80
 * Trigger:
5d0ea4576f20 More comments.
Edgar Simo <bobbens@gmail.com>
parents: 2480
diff changeset
    81
 *    Uint16 button;    Button that triggers effect.
5d0ea4576f20 More comments.
Edgar Simo <bobbens@gmail.com>
parents: 2480
diff changeset
    82
 *    Uint16 interval;  How soon before effect can be triggered again.
5d0ea4576f20 More comments.
Edgar Simo <bobbens@gmail.com>
parents: 2480
diff changeset
    83
 *
5d0ea4576f20 More comments.
Edgar Simo <bobbens@gmail.com>
parents: 2480
diff changeset
    84
 * Envelope:
5d0ea4576f20 More comments.
Edgar Simo <bobbens@gmail.com>
parents: 2480
diff changeset
    85
 *    Uint16 attack_length;   Duration of the attack.
5d0ea4576f20 More comments.
Edgar Simo <bobbens@gmail.com>
parents: 2480
diff changeset
    86
 *    Uint16 attack_level;    Level at the start of the attack.
5d0ea4576f20 More comments.
Edgar Simo <bobbens@gmail.com>
parents: 2480
diff changeset
    87
 *    Uint16 fade_length;     Duration of the fade out.
5d0ea4576f20 More comments.
Edgar Simo <bobbens@gmail.com>
parents: 2480
diff changeset
    88
 *    Uint16 fade_level;      Level at the end of the fade.
5d0ea4576f20 More comments.
Edgar Simo <bobbens@gmail.com>
parents: 2480
diff changeset
    89
 */
2477
97f75ea43a93 Starting to add infrastructure to handle haptic effects.
Edgar Simo <bobbens@gmail.com>
parents: 2476
diff changeset
    90
typedef struct SDL_HapticConstant {
97f75ea43a93 Starting to add infrastructure to handle haptic effects.
Edgar Simo <bobbens@gmail.com>
parents: 2476
diff changeset
    91
   /* Header */
2481
5d0ea4576f20 More comments.
Edgar Simo <bobbens@gmail.com>
parents: 2480
diff changeset
    92
   Uint16 type; /* SDL_HAPTIC_CONSTANT */
2480
b883974445fc Some more error reporting.
Edgar Simo <bobbens@gmail.com>
parents: 2478
diff changeset
    93
   Uint16 direction;
b883974445fc Some more error reporting.
Edgar Simo <bobbens@gmail.com>
parents: 2478
diff changeset
    94
b883974445fc Some more error reporting.
Edgar Simo <bobbens@gmail.com>
parents: 2478
diff changeset
    95
   /* Replay */
2477
97f75ea43a93 Starting to add infrastructure to handle haptic effects.
Edgar Simo <bobbens@gmail.com>
parents: 2476
diff changeset
    96
   Uint16 length;
97f75ea43a93 Starting to add infrastructure to handle haptic effects.
Edgar Simo <bobbens@gmail.com>
parents: 2476
diff changeset
    97
   Uint16 delay;
2480
b883974445fc Some more error reporting.
Edgar Simo <bobbens@gmail.com>
parents: 2478
diff changeset
    98
b883974445fc Some more error reporting.
Edgar Simo <bobbens@gmail.com>
parents: 2478
diff changeset
    99
   /* Trigger */
b883974445fc Some more error reporting.
Edgar Simo <bobbens@gmail.com>
parents: 2478
diff changeset
   100
   Uint16 button;
b883974445fc Some more error reporting.
Edgar Simo <bobbens@gmail.com>
parents: 2478
diff changeset
   101
   Uint16 interval;
b883974445fc Some more error reporting.
Edgar Simo <bobbens@gmail.com>
parents: 2478
diff changeset
   102
b883974445fc Some more error reporting.
Edgar Simo <bobbens@gmail.com>
parents: 2478
diff changeset
   103
   /* Constant */
2481
5d0ea4576f20 More comments.
Edgar Simo <bobbens@gmail.com>
parents: 2480
diff changeset
   104
   Sint16 level; /* Strength of the constant effect. */
2480
b883974445fc Some more error reporting.
Edgar Simo <bobbens@gmail.com>
parents: 2478
diff changeset
   105
b883974445fc Some more error reporting.
Edgar Simo <bobbens@gmail.com>
parents: 2478
diff changeset
   106
   /* Envelope */
b883974445fc Some more error reporting.
Edgar Simo <bobbens@gmail.com>
parents: 2478
diff changeset
   107
   Uint16 attack_length;
b883974445fc Some more error reporting.
Edgar Simo <bobbens@gmail.com>
parents: 2478
diff changeset
   108
   Uint16 attack_level;
b883974445fc Some more error reporting.
Edgar Simo <bobbens@gmail.com>
parents: 2478
diff changeset
   109
   Uint16 fade_length;
b883974445fc Some more error reporting.
Edgar Simo <bobbens@gmail.com>
parents: 2478
diff changeset
   110
   Uint16 fade_level;
b883974445fc Some more error reporting.
Edgar Simo <bobbens@gmail.com>
parents: 2478
diff changeset
   111
} SDL_HapticConstant;
b883974445fc Some more error reporting.
Edgar Simo <bobbens@gmail.com>
parents: 2478
diff changeset
   112
typedef struct SDL_HapticPeriodic {
b883974445fc Some more error reporting.
Edgar Simo <bobbens@gmail.com>
parents: 2478
diff changeset
   113
   /* Header */
2487
4c8e25ef2d97 Merged seperate waveforms into types to be more compatible.
Edgar Simo <bobbens@gmail.com>
parents: 2486
diff changeset
   114
   Uint16 type; /* SDL_HAPTIC_{SINE,SQUARE,TRIANGLE,SAWTOOTHUP,SAWTOOTHDOWN} */
2477
97f75ea43a93 Starting to add infrastructure to handle haptic effects.
Edgar Simo <bobbens@gmail.com>
parents: 2476
diff changeset
   115
   Uint16 direction;
2480
b883974445fc Some more error reporting.
Edgar Simo <bobbens@gmail.com>
parents: 2478
diff changeset
   116
b883974445fc Some more error reporting.
Edgar Simo <bobbens@gmail.com>
parents: 2478
diff changeset
   117
   /* Replay */
b883974445fc Some more error reporting.
Edgar Simo <bobbens@gmail.com>
parents: 2478
diff changeset
   118
   Uint16 length;
b883974445fc Some more error reporting.
Edgar Simo <bobbens@gmail.com>
parents: 2478
diff changeset
   119
   Uint16 delay;
b883974445fc Some more error reporting.
Edgar Simo <bobbens@gmail.com>
parents: 2478
diff changeset
   120
b883974445fc Some more error reporting.
Edgar Simo <bobbens@gmail.com>
parents: 2478
diff changeset
   121
   /* Trigger */
b883974445fc Some more error reporting.
Edgar Simo <bobbens@gmail.com>
parents: 2478
diff changeset
   122
   Uint16 button;
b883974445fc Some more error reporting.
Edgar Simo <bobbens@gmail.com>
parents: 2478
diff changeset
   123
   Uint16 interval;
b883974445fc Some more error reporting.
Edgar Simo <bobbens@gmail.com>
parents: 2478
diff changeset
   124
b883974445fc Some more error reporting.
Edgar Simo <bobbens@gmail.com>
parents: 2478
diff changeset
   125
   /* Periodic */
2481
5d0ea4576f20 More comments.
Edgar Simo <bobbens@gmail.com>
parents: 2480
diff changeset
   126
   Uint16 period; /* Period of the wave */
5d0ea4576f20 More comments.
Edgar Simo <bobbens@gmail.com>
parents: 2480
diff changeset
   127
   Sint16 magnitude; /* Peak value */
5d0ea4576f20 More comments.
Edgar Simo <bobbens@gmail.com>
parents: 2480
diff changeset
   128
   Sint16 offset; /* Mean value of the wave */
5d0ea4576f20 More comments.
Edgar Simo <bobbens@gmail.com>
parents: 2480
diff changeset
   129
   Uint16 phase; /* Horizontal shift */
2480
b883974445fc Some more error reporting.
Edgar Simo <bobbens@gmail.com>
parents: 2478
diff changeset
   130
b883974445fc Some more error reporting.
Edgar Simo <bobbens@gmail.com>
parents: 2478
diff changeset
   131
   /* Envelope */
b883974445fc Some more error reporting.
Edgar Simo <bobbens@gmail.com>
parents: 2478
diff changeset
   132
   Uint16 attack_length;
b883974445fc Some more error reporting.
Edgar Simo <bobbens@gmail.com>
parents: 2478
diff changeset
   133
   Uint16 attack_level;
b883974445fc Some more error reporting.
Edgar Simo <bobbens@gmail.com>
parents: 2478
diff changeset
   134
   Uint16 fade_length;
b883974445fc Some more error reporting.
Edgar Simo <bobbens@gmail.com>
parents: 2478
diff changeset
   135
   Uint16 fade_level;
b883974445fc Some more error reporting.
Edgar Simo <bobbens@gmail.com>
parents: 2478
diff changeset
   136
} SDL_HapticPeriodic;
2482
b51ad78812d5 Removed the linux only SDL_HAPTIC_RUMBLE (use PERIODIC instead).
Edgar Simo <bobbens@gmail.com>
parents: 2481
diff changeset
   137
typedef struct SDL_HapticCondition {
b51ad78812d5 Removed the linux only SDL_HAPTIC_RUMBLE (use PERIODIC instead).
Edgar Simo <bobbens@gmail.com>
parents: 2481
diff changeset
   138
   /* Header */
b51ad78812d5 Removed the linux only SDL_HAPTIC_RUMBLE (use PERIODIC instead).
Edgar Simo <bobbens@gmail.com>
parents: 2481
diff changeset
   139
   Uint16 type; /* SDL_HAPTIC_{SPRING,DAMPER,INERTIA,FRICTION} */
b51ad78812d5 Removed the linux only SDL_HAPTIC_RUMBLE (use PERIODIC instead).
Edgar Simo <bobbens@gmail.com>
parents: 2481
diff changeset
   140
   Uint16 direction;
b51ad78812d5 Removed the linux only SDL_HAPTIC_RUMBLE (use PERIODIC instead).
Edgar Simo <bobbens@gmail.com>
parents: 2481
diff changeset
   141
b51ad78812d5 Removed the linux only SDL_HAPTIC_RUMBLE (use PERIODIC instead).
Edgar Simo <bobbens@gmail.com>
parents: 2481
diff changeset
   142
   /* Replay */
b51ad78812d5 Removed the linux only SDL_HAPTIC_RUMBLE (use PERIODIC instead).
Edgar Simo <bobbens@gmail.com>
parents: 2481
diff changeset
   143
   Uint16 length;
b51ad78812d5 Removed the linux only SDL_HAPTIC_RUMBLE (use PERIODIC instead).
Edgar Simo <bobbens@gmail.com>
parents: 2481
diff changeset
   144
   Uint16 delay;
b51ad78812d5 Removed the linux only SDL_HAPTIC_RUMBLE (use PERIODIC instead).
Edgar Simo <bobbens@gmail.com>
parents: 2481
diff changeset
   145
b51ad78812d5 Removed the linux only SDL_HAPTIC_RUMBLE (use PERIODIC instead).
Edgar Simo <bobbens@gmail.com>
parents: 2481
diff changeset
   146
   /* Trigger */
b51ad78812d5 Removed the linux only SDL_HAPTIC_RUMBLE (use PERIODIC instead).
Edgar Simo <bobbens@gmail.com>
parents: 2481
diff changeset
   147
   Uint16 button;
b51ad78812d5 Removed the linux only SDL_HAPTIC_RUMBLE (use PERIODIC instead).
Edgar Simo <bobbens@gmail.com>
parents: 2481
diff changeset
   148
   Uint16 interval;
b51ad78812d5 Removed the linux only SDL_HAPTIC_RUMBLE (use PERIODIC instead).
Edgar Simo <bobbens@gmail.com>
parents: 2481
diff changeset
   149
b51ad78812d5 Removed the linux only SDL_HAPTIC_RUMBLE (use PERIODIC instead).
Edgar Simo <bobbens@gmail.com>
parents: 2481
diff changeset
   150
   /* Condition */
b51ad78812d5 Removed the linux only SDL_HAPTIC_RUMBLE (use PERIODIC instead).
Edgar Simo <bobbens@gmail.com>
parents: 2481
diff changeset
   151
   Uint16 right_sat; /* Level when joystick is to the right. */
b51ad78812d5 Removed the linux only SDL_HAPTIC_RUMBLE (use PERIODIC instead).
Edgar Simo <bobbens@gmail.com>
parents: 2481
diff changeset
   152
   Uint16 left_sat; /* Level when joystick is to the left */
b51ad78812d5 Removed the linux only SDL_HAPTIC_RUMBLE (use PERIODIC instead).
Edgar Simo <bobbens@gmail.com>
parents: 2481
diff changeset
   153
   Sint16 right_coeff; /* How fast to increase the force towards the right */
b51ad78812d5 Removed the linux only SDL_HAPTIC_RUMBLE (use PERIODIC instead).
Edgar Simo <bobbens@gmail.com>
parents: 2481
diff changeset
   154
   Sint16 left_coeff; /* How fast to increase the force towards the left */
b51ad78812d5 Removed the linux only SDL_HAPTIC_RUMBLE (use PERIODIC instead).
Edgar Simo <bobbens@gmail.com>
parents: 2481
diff changeset
   155
   Uint16 deadband; /* Size of the dead zone */
b51ad78812d5 Removed the linux only SDL_HAPTIC_RUMBLE (use PERIODIC instead).
Edgar Simo <bobbens@gmail.com>
parents: 2481
diff changeset
   156
   Sint16 center; /* Position of the dead zone */
b51ad78812d5 Removed the linux only SDL_HAPTIC_RUMBLE (use PERIODIC instead).
Edgar Simo <bobbens@gmail.com>
parents: 2481
diff changeset
   157
} SDL_HapticCondition;
b51ad78812d5 Removed the linux only SDL_HAPTIC_RUMBLE (use PERIODIC instead).
Edgar Simo <bobbens@gmail.com>
parents: 2481
diff changeset
   158
typedef struct SDL_HapticRamp {
b51ad78812d5 Removed the linux only SDL_HAPTIC_RUMBLE (use PERIODIC instead).
Edgar Simo <bobbens@gmail.com>
parents: 2481
diff changeset
   159
   /* Header */
b51ad78812d5 Removed the linux only SDL_HAPTIC_RUMBLE (use PERIODIC instead).
Edgar Simo <bobbens@gmail.com>
parents: 2481
diff changeset
   160
   Uint16 type; /* SDL_HAPTIC_RAMP */
b51ad78812d5 Removed the linux only SDL_HAPTIC_RUMBLE (use PERIODIC instead).
Edgar Simo <bobbens@gmail.com>
parents: 2481
diff changeset
   161
   Uint16 direction;
b51ad78812d5 Removed the linux only SDL_HAPTIC_RUMBLE (use PERIODIC instead).
Edgar Simo <bobbens@gmail.com>
parents: 2481
diff changeset
   162
b51ad78812d5 Removed the linux only SDL_HAPTIC_RUMBLE (use PERIODIC instead).
Edgar Simo <bobbens@gmail.com>
parents: 2481
diff changeset
   163
   /* Replay */
b51ad78812d5 Removed the linux only SDL_HAPTIC_RUMBLE (use PERIODIC instead).
Edgar Simo <bobbens@gmail.com>
parents: 2481
diff changeset
   164
   Uint16 length;
b51ad78812d5 Removed the linux only SDL_HAPTIC_RUMBLE (use PERIODIC instead).
Edgar Simo <bobbens@gmail.com>
parents: 2481
diff changeset
   165
   Uint16 delay;
b51ad78812d5 Removed the linux only SDL_HAPTIC_RUMBLE (use PERIODIC instead).
Edgar Simo <bobbens@gmail.com>
parents: 2481
diff changeset
   166
b51ad78812d5 Removed the linux only SDL_HAPTIC_RUMBLE (use PERIODIC instead).
Edgar Simo <bobbens@gmail.com>
parents: 2481
diff changeset
   167
   /* Trigger */
b51ad78812d5 Removed the linux only SDL_HAPTIC_RUMBLE (use PERIODIC instead).
Edgar Simo <bobbens@gmail.com>
parents: 2481
diff changeset
   168
   Uint16 button;
b51ad78812d5 Removed the linux only SDL_HAPTIC_RUMBLE (use PERIODIC instead).
Edgar Simo <bobbens@gmail.com>
parents: 2481
diff changeset
   169
   Uint16 interval;
b51ad78812d5 Removed the linux only SDL_HAPTIC_RUMBLE (use PERIODIC instead).
Edgar Simo <bobbens@gmail.com>
parents: 2481
diff changeset
   170
b51ad78812d5 Removed the linux only SDL_HAPTIC_RUMBLE (use PERIODIC instead).
Edgar Simo <bobbens@gmail.com>
parents: 2481
diff changeset
   171
   /* Ramp */
2495
66c02abeef0e Added SDL_HapticGetEffectStatus().
Edgar Simo <bobbens@gmail.com>
parents: 2489
diff changeset
   172
   Sint16 start; /* Beginning strength level. */
66c02abeef0e Added SDL_HapticGetEffectStatus().
Edgar Simo <bobbens@gmail.com>
parents: 2489
diff changeset
   173
   Sint16 end; /* Ending strength level. */
2482
b51ad78812d5 Removed the linux only SDL_HAPTIC_RUMBLE (use PERIODIC instead).
Edgar Simo <bobbens@gmail.com>
parents: 2481
diff changeset
   174
b51ad78812d5 Removed the linux only SDL_HAPTIC_RUMBLE (use PERIODIC instead).
Edgar Simo <bobbens@gmail.com>
parents: 2481
diff changeset
   175
   /* Envelope */
b51ad78812d5 Removed the linux only SDL_HAPTIC_RUMBLE (use PERIODIC instead).
Edgar Simo <bobbens@gmail.com>
parents: 2481
diff changeset
   176
   Uint16 attack_length;
b51ad78812d5 Removed the linux only SDL_HAPTIC_RUMBLE (use PERIODIC instead).
Edgar Simo <bobbens@gmail.com>
parents: 2481
diff changeset
   177
   Uint16 attack_level;
b51ad78812d5 Removed the linux only SDL_HAPTIC_RUMBLE (use PERIODIC instead).
Edgar Simo <bobbens@gmail.com>
parents: 2481
diff changeset
   178
   Uint16 fade_length;
b51ad78812d5 Removed the linux only SDL_HAPTIC_RUMBLE (use PERIODIC instead).
Edgar Simo <bobbens@gmail.com>
parents: 2481
diff changeset
   179
   Uint16 fade_level;
b51ad78812d5 Removed the linux only SDL_HAPTIC_RUMBLE (use PERIODIC instead).
Edgar Simo <bobbens@gmail.com>
parents: 2481
diff changeset
   180
} SDL_HapticRamp;
2477
97f75ea43a93 Starting to add infrastructure to handle haptic effects.
Edgar Simo <bobbens@gmail.com>
parents: 2476
diff changeset
   181
97f75ea43a93 Starting to add infrastructure to handle haptic effects.
Edgar Simo <bobbens@gmail.com>
parents: 2476
diff changeset
   182
typedef union SDL_HapticEffect {
97f75ea43a93 Starting to add infrastructure to handle haptic effects.
Edgar Simo <bobbens@gmail.com>
parents: 2476
diff changeset
   183
   /* Common for all force feedback effects */
97f75ea43a93 Starting to add infrastructure to handle haptic effects.
Edgar Simo <bobbens@gmail.com>
parents: 2476
diff changeset
   184
   Uint16 type; /* Effect type */
97f75ea43a93 Starting to add infrastructure to handle haptic effects.
Edgar Simo <bobbens@gmail.com>
parents: 2476
diff changeset
   185
   SDL_HapticConstant constant; /* Constant effect */
2480
b883974445fc Some more error reporting.
Edgar Simo <bobbens@gmail.com>
parents: 2478
diff changeset
   186
   SDL_HapticPeriodic periodic; /* Periodic effect */
2482
b51ad78812d5 Removed the linux only SDL_HAPTIC_RUMBLE (use PERIODIC instead).
Edgar Simo <bobbens@gmail.com>
parents: 2481
diff changeset
   187
   SDL_HapticCondition condition; /* Condition effect */
b51ad78812d5 Removed the linux only SDL_HAPTIC_RUMBLE (use PERIODIC instead).
Edgar Simo <bobbens@gmail.com>
parents: 2481
diff changeset
   188
   SDL_HapticRamp ramp; /* Ramp effect */
2477
97f75ea43a93 Starting to add infrastructure to handle haptic effects.
Edgar Simo <bobbens@gmail.com>
parents: 2476
diff changeset
   189
} SDL_HapticEffect;
97f75ea43a93 Starting to add infrastructure to handle haptic effects.
Edgar Simo <bobbens@gmail.com>
parents: 2476
diff changeset
   190
2472
3f73c88c9abb First commit of the SDL_haptic subsystem.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
   191
3f73c88c9abb First commit of the SDL_haptic subsystem.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
   192
/* Function prototypes */
3f73c88c9abb First commit of the SDL_haptic subsystem.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
   193
/*
3f73c88c9abb First commit of the SDL_haptic subsystem.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
   194
 * Count the number of joysticks attached to the system
3f73c88c9abb First commit of the SDL_haptic subsystem.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
   195
 */
3f73c88c9abb First commit of the SDL_haptic subsystem.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
   196
extern DECLSPEC int SDLCALL SDL_NumHaptics(void);
3f73c88c9abb First commit of the SDL_haptic subsystem.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
   197
3f73c88c9abb First commit of the SDL_haptic subsystem.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
   198
/*
2476
242d8a668ebb * Implemented opening and closing of haptic devices.
Edgar Simo <bobbens@gmail.com>
parents: 2472
diff changeset
   199
 * Get the implementation dependent name of a Haptic device.
2472
3f73c88c9abb First commit of the SDL_haptic subsystem.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
   200
 * This can be called before any joysticks are opened.
3f73c88c9abb First commit of the SDL_haptic subsystem.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
   201
 * If no name can be found, this function returns NULL.
3f73c88c9abb First commit of the SDL_haptic subsystem.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
   202
 */
3f73c88c9abb First commit of the SDL_haptic subsystem.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
   203
extern DECLSPEC const char *SDLCALL SDL_HapticName(int device_index);
3f73c88c9abb First commit of the SDL_haptic subsystem.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
   204
2476
242d8a668ebb * Implemented opening and closing of haptic devices.
Edgar Simo <bobbens@gmail.com>
parents: 2472
diff changeset
   205
/*
242d8a668ebb * Implemented opening and closing of haptic devices.
Edgar Simo <bobbens@gmail.com>
parents: 2472
diff changeset
   206
 * Opens a Haptic device for usage - the index passed as an
242d8a668ebb * Implemented opening and closing of haptic devices.
Edgar Simo <bobbens@gmail.com>
parents: 2472
diff changeset
   207
 * argument refers to the N'th Haptic device on this system.
242d8a668ebb * Implemented opening and closing of haptic devices.
Edgar Simo <bobbens@gmail.com>
parents: 2472
diff changeset
   208
 *
242d8a668ebb * Implemented opening and closing of haptic devices.
Edgar Simo <bobbens@gmail.com>
parents: 2472
diff changeset
   209
 * This function returns a Haptic device identifier, or Null
242d8a668ebb * Implemented opening and closing of haptic devices.
Edgar Simo <bobbens@gmail.com>
parents: 2472
diff changeset
   210
 * if an error occurred.
242d8a668ebb * Implemented opening and closing of haptic devices.
Edgar Simo <bobbens@gmail.com>
parents: 2472
diff changeset
   211
 */
242d8a668ebb * Implemented opening and closing of haptic devices.
Edgar Simo <bobbens@gmail.com>
parents: 2472
diff changeset
   212
extern DECLSPEC SDL_Haptic * SDL_HapticOpen(int device_index);
242d8a668ebb * Implemented opening and closing of haptic devices.
Edgar Simo <bobbens@gmail.com>
parents: 2472
diff changeset
   213
2489
96adc8025331 Exposed some of the joystick stuff to the haptic subsystem.
Edgar Simo <bobbens@gmail.com>
parents: 2488
diff changeset
   214
/*
96adc8025331 Exposed some of the joystick stuff to the haptic subsystem.
Edgar Simo <bobbens@gmail.com>
parents: 2488
diff changeset
   215
 * Checks to see if a joystick has haptic features.
96adc8025331 Exposed some of the joystick stuff to the haptic subsystem.
Edgar Simo <bobbens@gmail.com>
parents: 2488
diff changeset
   216
 *
96adc8025331 Exposed some of the joystick stuff to the haptic subsystem.
Edgar Simo <bobbens@gmail.com>
parents: 2488
diff changeset
   217
 * Returns SDL_TRUE if the joystick is haptic, SDL_FALSE if it isn't
96adc8025331 Exposed some of the joystick stuff to the haptic subsystem.
Edgar Simo <bobbens@gmail.com>
parents: 2488
diff changeset
   218
 * and -1 on error.
96adc8025331 Exposed some of the joystick stuff to the haptic subsystem.
Edgar Simo <bobbens@gmail.com>
parents: 2488
diff changeset
   219
 */
96adc8025331 Exposed some of the joystick stuff to the haptic subsystem.
Edgar Simo <bobbens@gmail.com>
parents: 2488
diff changeset
   220
extern DECLSPEC int SDL_JoystickIsHaptic(SDL_Joystick * joystick);
96adc8025331 Exposed some of the joystick stuff to the haptic subsystem.
Edgar Simo <bobbens@gmail.com>
parents: 2488
diff changeset
   221
96adc8025331 Exposed some of the joystick stuff to the haptic subsystem.
Edgar Simo <bobbens@gmail.com>
parents: 2488
diff changeset
   222
/*
96adc8025331 Exposed some of the joystick stuff to the haptic subsystem.
Edgar Simo <bobbens@gmail.com>
parents: 2488
diff changeset
   223
 * Opens a Haptic device for usage from a Joystick device.
96adc8025331 Exposed some of the joystick stuff to the haptic subsystem.
Edgar Simo <bobbens@gmail.com>
parents: 2488
diff changeset
   224
 *
96adc8025331 Exposed some of the joystick stuff to the haptic subsystem.
Edgar Simo <bobbens@gmail.com>
parents: 2488
diff changeset
   225
 * Returns a valid pointer to a haptic device on success or NULL
96adc8025331 Exposed some of the joystick stuff to the haptic subsystem.
Edgar Simo <bobbens@gmail.com>
parents: 2488
diff changeset
   226
 * if an error occurred.
96adc8025331 Exposed some of the joystick stuff to the haptic subsystem.
Edgar Simo <bobbens@gmail.com>
parents: 2488
diff changeset
   227
 */
96adc8025331 Exposed some of the joystick stuff to the haptic subsystem.
Edgar Simo <bobbens@gmail.com>
parents: 2488
diff changeset
   228
extern DECLSPEC SDL_Haptic * SDL_HapticOpenFromJoystick(SDL_Joystick * joystick);
96adc8025331 Exposed some of the joystick stuff to the haptic subsystem.
Edgar Simo <bobbens@gmail.com>
parents: 2488
diff changeset
   229
2476
242d8a668ebb * Implemented opening and closing of haptic devices.
Edgar Simo <bobbens@gmail.com>
parents: 2472
diff changeset
   230
/* 
242d8a668ebb * Implemented opening and closing of haptic devices.
Edgar Simo <bobbens@gmail.com>
parents: 2472
diff changeset
   231
 * Closes a Haptic device previously opened with SDL_HapticOpen.
242d8a668ebb * Implemented opening and closing of haptic devices.
Edgar Simo <bobbens@gmail.com>
parents: 2472
diff changeset
   232
 */
242d8a668ebb * Implemented opening and closing of haptic devices.
Edgar Simo <bobbens@gmail.com>
parents: 2472
diff changeset
   233
extern DECLSPEC void SDL_HapticClose(SDL_Haptic * haptic);
242d8a668ebb * Implemented opening and closing of haptic devices.
Edgar Simo <bobbens@gmail.com>
parents: 2472
diff changeset
   234
2477
97f75ea43a93 Starting to add infrastructure to handle haptic effects.
Edgar Simo <bobbens@gmail.com>
parents: 2476
diff changeset
   235
/*
2478
4fd783e0f34b Added query functions for haptic devices.
Edgar Simo <bobbens@gmail.com>
parents: 2477
diff changeset
   236
 * Returns the number of effects a haptic device can store.
4fd783e0f34b Added query functions for haptic devices.
Edgar Simo <bobbens@gmail.com>
parents: 2477
diff changeset
   237
 */
4fd783e0f34b Added query functions for haptic devices.
Edgar Simo <bobbens@gmail.com>
parents: 2477
diff changeset
   238
extern DECLSPEC int SDL_HapticNumEffects(SDL_Haptic * haptic);
4fd783e0f34b Added query functions for haptic devices.
Edgar Simo <bobbens@gmail.com>
parents: 2477
diff changeset
   239
4fd783e0f34b Added query functions for haptic devices.
Edgar Simo <bobbens@gmail.com>
parents: 2477
diff changeset
   240
/*
4fd783e0f34b Added query functions for haptic devices.
Edgar Simo <bobbens@gmail.com>
parents: 2477
diff changeset
   241
 * Returns the supported effects.  Individual effects can be queried by
4fd783e0f34b Added query functions for haptic devices.
Edgar Simo <bobbens@gmail.com>
parents: 2477
diff changeset
   242
 * bitwise operators.
4fd783e0f34b Added query functions for haptic devices.
Edgar Simo <bobbens@gmail.com>
parents: 2477
diff changeset
   243
 *
4fd783e0f34b Added query functions for haptic devices.
Edgar Simo <bobbens@gmail.com>
parents: 2477
diff changeset
   244
 * Example:  (SDL_HapticQueryEffects(haptic) & SDL_HAPTIC_CONSTANT)
4fd783e0f34b Added query functions for haptic devices.
Edgar Simo <bobbens@gmail.com>
parents: 2477
diff changeset
   245
 */
4fd783e0f34b Added query functions for haptic devices.
Edgar Simo <bobbens@gmail.com>
parents: 2477
diff changeset
   246
extern DECLSPEC unsigned int SDL_HapticQueryEffects(SDL_Haptic * haptic);
4fd783e0f34b Added query functions for haptic devices.
Edgar Simo <bobbens@gmail.com>
parents: 2477
diff changeset
   247
4fd783e0f34b Added query functions for haptic devices.
Edgar Simo <bobbens@gmail.com>
parents: 2477
diff changeset
   248
/*
2486
24dd8b8669fa Added SDL_HAPTIC_CUSTOM (not supported on linux).
Edgar Simo <bobbens@gmail.com>
parents: 2485
diff changeset
   249
 * Checks to see if effect is supported by haptic.
24dd8b8669fa Added SDL_HAPTIC_CUSTOM (not supported on linux).
Edgar Simo <bobbens@gmail.com>
parents: 2485
diff changeset
   250
 *
24dd8b8669fa Added SDL_HAPTIC_CUSTOM (not supported on linux).
Edgar Simo <bobbens@gmail.com>
parents: 2485
diff changeset
   251
 * Returns SDL_TRUE if effect is supported, SDL_FALSE if it isn't and -1
24dd8b8669fa Added SDL_HAPTIC_CUSTOM (not supported on linux).
Edgar Simo <bobbens@gmail.com>
parents: 2485
diff changeset
   252
 * on error.
24dd8b8669fa Added SDL_HAPTIC_CUSTOM (not supported on linux).
Edgar Simo <bobbens@gmail.com>
parents: 2485
diff changeset
   253
 */
24dd8b8669fa Added SDL_HAPTIC_CUSTOM (not supported on linux).
Edgar Simo <bobbens@gmail.com>
parents: 2485
diff changeset
   254
extern DECLSPEC int SDL_HapticEffectSupported(SDL_Haptic * haptic, SDL_HapticEffect * effect);
24dd8b8669fa Added SDL_HAPTIC_CUSTOM (not supported on linux).
Edgar Simo <bobbens@gmail.com>
parents: 2485
diff changeset
   255
24dd8b8669fa Added SDL_HAPTIC_CUSTOM (not supported on linux).
Edgar Simo <bobbens@gmail.com>
parents: 2485
diff changeset
   256
/*
2477
97f75ea43a93 Starting to add infrastructure to handle haptic effects.
Edgar Simo <bobbens@gmail.com>
parents: 2476
diff changeset
   257
 * Creates a new haptic effect on the device.
2483
9d52368ebcf5 Setting effects memory to 0.
Edgar Simo <bobbens@gmail.com>
parents: 2482
diff changeset
   258
 *
9d52368ebcf5 Setting effects memory to 0.
Edgar Simo <bobbens@gmail.com>
parents: 2482
diff changeset
   259
 * Returns the id of the effect on success, -1 on failure.
2477
97f75ea43a93 Starting to add infrastructure to handle haptic effects.
Edgar Simo <bobbens@gmail.com>
parents: 2476
diff changeset
   260
 */
97f75ea43a93 Starting to add infrastructure to handle haptic effects.
Edgar Simo <bobbens@gmail.com>
parents: 2476
diff changeset
   261
extern DECLSPEC int SDL_HapticNewEffect(SDL_Haptic * haptic, SDL_HapticEffect * effect);
97f75ea43a93 Starting to add infrastructure to handle haptic effects.
Edgar Simo <bobbens@gmail.com>
parents: 2476
diff changeset
   262
97f75ea43a93 Starting to add infrastructure to handle haptic effects.
Edgar Simo <bobbens@gmail.com>
parents: 2476
diff changeset
   263
/*
2488
8e2bdbccf7ff Added SDL_HapticUpdateEffect().
Edgar Simo <bobbens@gmail.com>
parents: 2487
diff changeset
   264
 * Uploads an effect.  Can be used dynamically, although behaviour when
8e2bdbccf7ff Added SDL_HapticUpdateEffect().
Edgar Simo <bobbens@gmail.com>
parents: 2487
diff changeset
   265
 * dynamically changing direction may be strange.  Specifically the effect
8e2bdbccf7ff Added SDL_HapticUpdateEffect().
Edgar Simo <bobbens@gmail.com>
parents: 2487
diff changeset
   266
 * may reupload itself and start playing from the start.  You cannot change
8e2bdbccf7ff Added SDL_HapticUpdateEffect().
Edgar Simo <bobbens@gmail.com>
parents: 2487
diff changeset
   267
 * the type either when running UpdateEffect.
8e2bdbccf7ff Added SDL_HapticUpdateEffect().
Edgar Simo <bobbens@gmail.com>
parents: 2487
diff changeset
   268
 *
8e2bdbccf7ff Added SDL_HapticUpdateEffect().
Edgar Simo <bobbens@gmail.com>
parents: 2487
diff changeset
   269
 * Returns the id of the effect on success, -1 on failure.
8e2bdbccf7ff Added SDL_HapticUpdateEffect().
Edgar Simo <bobbens@gmail.com>
parents: 2487
diff changeset
   270
 */
8e2bdbccf7ff Added SDL_HapticUpdateEffect().
Edgar Simo <bobbens@gmail.com>
parents: 2487
diff changeset
   271
extern DECLSPEC int SDL_HapticUpdateEffect(SDL_Haptic * haptic, int effect, SDL_HapticEffect * data);
8e2bdbccf7ff Added SDL_HapticUpdateEffect().
Edgar Simo <bobbens@gmail.com>
parents: 2487
diff changeset
   272
8e2bdbccf7ff Added SDL_HapticUpdateEffect().
Edgar Simo <bobbens@gmail.com>
parents: 2487
diff changeset
   273
/*
2477
97f75ea43a93 Starting to add infrastructure to handle haptic effects.
Edgar Simo <bobbens@gmail.com>
parents: 2476
diff changeset
   274
 * Runs the haptic effect on it's assosciated haptic device.
2483
9d52368ebcf5 Setting effects memory to 0.
Edgar Simo <bobbens@gmail.com>
parents: 2482
diff changeset
   275
 *
9d52368ebcf5 Setting effects memory to 0.
Edgar Simo <bobbens@gmail.com>
parents: 2482
diff changeset
   276
 * Returns 0 on success or -1 on failure.
2477
97f75ea43a93 Starting to add infrastructure to handle haptic effects.
Edgar Simo <bobbens@gmail.com>
parents: 2476
diff changeset
   277
 */
97f75ea43a93 Starting to add infrastructure to handle haptic effects.
Edgar Simo <bobbens@gmail.com>
parents: 2476
diff changeset
   278
extern DECLSPEC int SDL_HapticRunEffect(SDL_Haptic * haptic, int effect);
97f75ea43a93 Starting to add infrastructure to handle haptic effects.
Edgar Simo <bobbens@gmail.com>
parents: 2476
diff changeset
   279
97f75ea43a93 Starting to add infrastructure to handle haptic effects.
Edgar Simo <bobbens@gmail.com>
parents: 2476
diff changeset
   280
/*
2485
67978eea6d10 Added SDL_HapticStopEffect().
Edgar Simo <bobbens@gmail.com>
parents: 2484
diff changeset
   281
 * Stops the haptic effect on it's assosciated haptic device.
67978eea6d10 Added SDL_HapticStopEffect().
Edgar Simo <bobbens@gmail.com>
parents: 2484
diff changeset
   282
 *
67978eea6d10 Added SDL_HapticStopEffect().
Edgar Simo <bobbens@gmail.com>
parents: 2484
diff changeset
   283
 * Returns 0 on success or -1 on failure.
67978eea6d10 Added SDL_HapticStopEffect().
Edgar Simo <bobbens@gmail.com>
parents: 2484
diff changeset
   284
 */
67978eea6d10 Added SDL_HapticStopEffect().
Edgar Simo <bobbens@gmail.com>
parents: 2484
diff changeset
   285
extern DECLSPEC int SDL_HapticStopEffect(SDL_Haptic * haptic, int effect);
67978eea6d10 Added SDL_HapticStopEffect().
Edgar Simo <bobbens@gmail.com>
parents: 2484
diff changeset
   286
67978eea6d10 Added SDL_HapticStopEffect().
Edgar Simo <bobbens@gmail.com>
parents: 2484
diff changeset
   287
/*
67978eea6d10 Added SDL_HapticStopEffect().
Edgar Simo <bobbens@gmail.com>
parents: 2484
diff changeset
   288
 * Destroys a haptic effect on the device.  This will stop the effect if it's
67978eea6d10 Added SDL_HapticStopEffect().
Edgar Simo <bobbens@gmail.com>
parents: 2484
diff changeset
   289
 * running.
2477
97f75ea43a93 Starting to add infrastructure to handle haptic effects.
Edgar Simo <bobbens@gmail.com>
parents: 2476
diff changeset
   290
 */
97f75ea43a93 Starting to add infrastructure to handle haptic effects.
Edgar Simo <bobbens@gmail.com>
parents: 2476
diff changeset
   291
extern DECLSPEC void SDL_HapticDestroyEffect(SDL_Haptic * haptic, int effect);
97f75ea43a93 Starting to add infrastructure to handle haptic effects.
Edgar Simo <bobbens@gmail.com>
parents: 2476
diff changeset
   292
2483
9d52368ebcf5 Setting effects memory to 0.
Edgar Simo <bobbens@gmail.com>
parents: 2482
diff changeset
   293
/*
2495
66c02abeef0e Added SDL_HapticGetEffectStatus().
Edgar Simo <bobbens@gmail.com>
parents: 2489
diff changeset
   294
 * Gets the status of the current effect on the haptic device.
66c02abeef0e Added SDL_HapticGetEffectStatus().
Edgar Simo <bobbens@gmail.com>
parents: 2489
diff changeset
   295
 *
66c02abeef0e Added SDL_HapticGetEffectStatus().
Edgar Simo <bobbens@gmail.com>
parents: 2489
diff changeset
   296
 * Returns 0 if it isn't playing, SDL_HAPTIC_PLAYING if it is playing
66c02abeef0e Added SDL_HapticGetEffectStatus().
Edgar Simo <bobbens@gmail.com>
parents: 2489
diff changeset
   297
 * or -1 on failure.
66c02abeef0e Added SDL_HapticGetEffectStatus().
Edgar Simo <bobbens@gmail.com>
parents: 2489
diff changeset
   298
 */
66c02abeef0e Added SDL_HapticGetEffectStatus().
Edgar Simo <bobbens@gmail.com>
parents: 2489
diff changeset
   299
extern DECLSPEC int SDL_HapticGetEffectStatus(SDL_Haptic *haptic, int effect);
66c02abeef0e Added SDL_HapticGetEffectStatus().
Edgar Simo <bobbens@gmail.com>
parents: 2489
diff changeset
   300
66c02abeef0e Added SDL_HapticGetEffectStatus().
Edgar Simo <bobbens@gmail.com>
parents: 2489
diff changeset
   301
/*
2483
9d52368ebcf5 Setting effects memory to 0.
Edgar Simo <bobbens@gmail.com>
parents: 2482
diff changeset
   302
 * Sets the global gain of the device.  Gain should be between 0 and 100.
9d52368ebcf5 Setting effects memory to 0.
Edgar Simo <bobbens@gmail.com>
parents: 2482
diff changeset
   303
 *
9d52368ebcf5 Setting effects memory to 0.
Edgar Simo <bobbens@gmail.com>
parents: 2482
diff changeset
   304
 * Returns 0 on success or -1 on failure.
9d52368ebcf5 Setting effects memory to 0.
Edgar Simo <bobbens@gmail.com>
parents: 2482
diff changeset
   305
 */
9d52368ebcf5 Setting effects memory to 0.
Edgar Simo <bobbens@gmail.com>
parents: 2482
diff changeset
   306
extern DECLSPEC int SDL_HapticSetGain(SDL_Haptic * haptic, int gain);
9d52368ebcf5 Setting effects memory to 0.
Edgar Simo <bobbens@gmail.com>
parents: 2482
diff changeset
   307
2484
666472fd4cb0 HapticSetGain checks to see if device supports it.
Edgar Simo <bobbens@gmail.com>
parents: 2483
diff changeset
   308
/*
666472fd4cb0 HapticSetGain checks to see if device supports it.
Edgar Simo <bobbens@gmail.com>
parents: 2483
diff changeset
   309
 * Sets the global autocenter of the device.  Autocenter should be between
666472fd4cb0 HapticSetGain checks to see if device supports it.
Edgar Simo <bobbens@gmail.com>
parents: 2483
diff changeset
   310
 * 0 and 100.  Setting it to 0 will disable autocentering.
666472fd4cb0 HapticSetGain checks to see if device supports it.
Edgar Simo <bobbens@gmail.com>
parents: 2483
diff changeset
   311
 *
666472fd4cb0 HapticSetGain checks to see if device supports it.
Edgar Simo <bobbens@gmail.com>
parents: 2483
diff changeset
   312
 * Returns 0 on success or -1 on failure.
666472fd4cb0 HapticSetGain checks to see if device supports it.
Edgar Simo <bobbens@gmail.com>
parents: 2483
diff changeset
   313
 */
666472fd4cb0 HapticSetGain checks to see if device supports it.
Edgar Simo <bobbens@gmail.com>
parents: 2483
diff changeset
   314
extern DECLSPEC int SDL_HapticSetAutocenter(SDL_Haptic * haptic, int autocenter);
666472fd4cb0 HapticSetGain checks to see if device supports it.
Edgar Simo <bobbens@gmail.com>
parents: 2483
diff changeset
   315
2472
3f73c88c9abb First commit of the SDL_haptic subsystem.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
   316
3f73c88c9abb First commit of the SDL_haptic subsystem.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
   317
/* Ends C function definitions when using C++ */
3f73c88c9abb First commit of the SDL_haptic subsystem.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
   318
#ifdef __cplusplus
3f73c88c9abb First commit of the SDL_haptic subsystem.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
   319
/* *INDENT-OFF* */
3f73c88c9abb First commit of the SDL_haptic subsystem.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
   320
}
3f73c88c9abb First commit of the SDL_haptic subsystem.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
   321
/* *INDENT-ON* */
3f73c88c9abb First commit of the SDL_haptic subsystem.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
   322
#endif
3f73c88c9abb First commit of the SDL_haptic subsystem.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
   323
#include "close_code.h"
3f73c88c9abb First commit of the SDL_haptic subsystem.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
   324
3f73c88c9abb First commit of the SDL_haptic subsystem.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
   325
#endif /* _SDL_haptic_h */
3f73c88c9abb First commit of the SDL_haptic subsystem.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
   326
3f73c88c9abb First commit of the SDL_haptic subsystem.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
   327
/* vi: set ts=4 sw=4 expandtab: */
3f73c88c9abb First commit of the SDL_haptic subsystem.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
   328
3f73c88c9abb First commit of the SDL_haptic subsystem.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
   329