src/haptic/SDL_syshaptic.h
author David Ludwig <dludwig@pobox.com>
Wed, 25 Dec 2013 21:39:48 -0500
changeset 8563 c0e68f3b6bbb
parent 7220 246f71639288
child 8093 b43765095a6f
permissions -rw-r--r--
WinRT: compiled the d3d11 renderer's shaders into SDL itself

Previously, the shaders would get compiled separately, the output of which would need to be packaged into the app. This change should make SDL's dll be the only binary needed to include SDL in a WinRT app.
slouken@2713
     1
/*
slouken@5535
     2
  Simple DirectMedia Layer
slouken@6885
     3
  Copyright (C) 1997-2013 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
#include "SDL_config.h"
slouken@2713
    23
slouken@2713
    24
#include "SDL_haptic.h"
slouken@2713
    25
slouken@2713
    26
slouken@2713
    27
/*
slouken@2713
    28
 * Number of haptic devices on the system.
slouken@2713
    29
 */
slouken@2713
    30
extern Uint8 SDL_numhaptics;
slouken@2713
    31
slouken@2713
    32
slouken@2713
    33
struct haptic_effect
slouken@2713
    34
{
slouken@2713
    35
    SDL_HapticEffect effect;    /* The current event */
slouken@2713
    36
    struct haptic_hweffect *hweffect;   /* The hardware behind the event */
slouken@2713
    37
};
slouken@2713
    38
slouken@2713
    39
/*
slouken@2713
    40
 * The real SDL_Haptic struct.
slouken@2713
    41
 */
slouken@2713
    42
struct _SDL_Haptic
slouken@2713
    43
{
slouken@2713
    44
    Uint8 index;                /* Stores index it is attached to */
slouken@2713
    45
slouken@2713
    46
    struct haptic_effect *effects;      /* Allocated effects */
slouken@2713
    47
    int neffects;               /* Maximum amount of effects */
slouken@2713
    48
    int nplaying;               /* Maximum amount of effects to play at the same time */
slouken@2713
    49
    unsigned int supported;     /* Supported effects */
slouken@2713
    50
    int naxes;                  /* Number of axes on the device. */
slouken@2713
    51
slouken@2713
    52
    struct haptic_hwdata *hwdata;       /* Driver dependent */
slouken@2713
    53
    int ref_count;              /* Count for multiple opens */
slouken@5360
    54
slouken@5360
    55
    int rumble_id;              /* ID of rumble effect for simple rumble API. */
slouken@5360
    56
    SDL_HapticEffect rumble_effect; /* Rumble effect. */
slouken@2713
    57
};
slouken@2713
    58
slouken@7191
    59
/*
slouken@2713
    60
 * Scans the system for haptic devices.
slouken@2713
    61
 *
philipp@7220
    62
 * Returns number of devices on success, -1 on error.
slouken@2713
    63
 */
slouken@2713
    64
extern int SDL_SYS_HapticInit(void);
slouken@2713
    65
slouken@2713
    66
/*
slouken@2713
    67
 * Gets the device dependent name of the haptic device
slouken@2713
    68
 */
slouken@2713
    69
extern const char *SDL_SYS_HapticName(int index);
slouken@2713
    70
slouken@2713
    71
/*
slouken@2713
    72
 * Opens the haptic device for usage.  The haptic device should have
slouken@2713
    73
 * the index value set previously.
slouken@2713
    74
 *
slouken@2713
    75
 * Returns 0 on success, -1 on error.
slouken@2713
    76
 */
slouken@2713
    77
extern int SDL_SYS_HapticOpen(SDL_Haptic * haptic);
slouken@2713
    78
slouken@2713
    79
/*
slouken@2713
    80
 * Returns the index of the haptic core pointer or -1 if none is found.
slouken@2713
    81
 */
slouken@2713
    82
int SDL_SYS_HapticMouse(void);
slouken@2713
    83
slouken@2713
    84
/*
slouken@2713
    85
 * Checks to see if the joystick has haptic capabilities.
slouken@2713
    86
 *
slouken@2713
    87
 * Returns >0 if haptic capabilities are detected, 0 if haptic
slouken@2713
    88
 * capabilities aren't detected and -1 on error.
slouken@2713
    89
 */
slouken@2713
    90
extern int SDL_SYS_JoystickIsHaptic(SDL_Joystick * joystick);
slouken@2713
    91
slouken@2713
    92
/*
slouken@2713
    93
 * Opens the haptic device for usage using the same device as
slouken@2713
    94
 * the joystick.
slouken@2713
    95
 *
slouken@2713
    96
 * Returns 0 on success, -1 on error.
slouken@2713
    97
 */
slouken@2713
    98
extern int SDL_SYS_HapticOpenFromJoystick(SDL_Haptic * haptic,
slouken@2713
    99
                                          SDL_Joystick * joystick);
slouken@2713
   100
/*
slouken@2713
   101
 * Checks to see if haptic device and joystick device are the same.
slouken@2713
   102
 *
slouken@2713
   103
 * Returns 1 if they are the same, 0 if they aren't.
slouken@2713
   104
 */
slouken@2713
   105
extern int SDL_SYS_JoystickSameHaptic(SDL_Haptic * haptic,
slouken@2713
   106
                                      SDL_Joystick * joystick);
slouken@2713
   107
slouken@2713
   108
/*
slouken@2713
   109
 * Closes a haptic device after usage.
slouken@2713
   110
 */
slouken@2713
   111
extern void SDL_SYS_HapticClose(SDL_Haptic * haptic);
slouken@2713
   112
slouken@2713
   113
/*
slouken@2713
   114
 * Performs a cleanup on the haptic subsystem.
slouken@2713
   115
 */
slouken@2713
   116
extern void SDL_SYS_HapticQuit(void);
slouken@2713
   117
slouken@2713
   118
/*
slouken@2713
   119
 * Creates a new haptic effect on the haptic device using base
slouken@2713
   120
 * as a template for the effect.
slouken@2713
   121
 *
slouken@2713
   122
 * Returns 0 on success, -1 on error.
slouken@2713
   123
 */
slouken@2713
   124
extern int SDL_SYS_HapticNewEffect(SDL_Haptic * haptic,
slouken@2713
   125
                                   struct haptic_effect *effect,
slouken@2713
   126
                                   SDL_HapticEffect * base);
slouken@2713
   127
slouken@2713
   128
/*
slouken@2713
   129
 * Updates the haptic effect on the haptic device using data
slouken@2713
   130
 * as a template.
slouken@2713
   131
 *
slouken@2713
   132
 * Returns 0 on success, -1 on error.
slouken@2713
   133
 */
slouken@2713
   134
extern int SDL_SYS_HapticUpdateEffect(SDL_Haptic * haptic,
slouken@2713
   135
                                      struct haptic_effect *effect,
slouken@2713
   136
                                      SDL_HapticEffect * data);
slouken@2713
   137
slouken@2713
   138
/*
slouken@2713
   139
 * Runs the effect on the haptic device.
slouken@2713
   140
 *
slouken@2713
   141
 * Returns 0 on success, -1 on error.
slouken@2713
   142
 */
slouken@2713
   143
extern int SDL_SYS_HapticRunEffect(SDL_Haptic * haptic,
slouken@2713
   144
                                   struct haptic_effect *effect,
slouken@2713
   145
                                   Uint32 iterations);
slouken@2713
   146
slouken@2713
   147
/*
slouken@2713
   148
 * Stops the effect on the haptic device.
slouken@2713
   149
 *
slouken@2713
   150
 * Returns 0 on success, -1 on error.
slouken@2713
   151
 */
slouken@2713
   152
extern int SDL_SYS_HapticStopEffect(SDL_Haptic * haptic,
slouken@2713
   153
                                    struct haptic_effect *effect);
slouken@2713
   154
slouken@2713
   155
/*
slouken@2713
   156
 * Cleanups up the effect on the haptic device.
slouken@2713
   157
 */
slouken@2713
   158
extern void SDL_SYS_HapticDestroyEffect(SDL_Haptic * haptic,
slouken@2713
   159
                                        struct haptic_effect *effect);
slouken@2713
   160
slouken@2713
   161
/*
slouken@2713
   162
 * Queries the device for the status of effect.
slouken@2713
   163
 *
slouken@2713
   164
 * Returns 0 if device is stopped, >0 if device is playing and
slouken@2713
   165
 * -1 on error.
slouken@2713
   166
 */
slouken@2713
   167
extern int SDL_SYS_HapticGetEffectStatus(SDL_Haptic * haptic,
slouken@2713
   168
                                         struct haptic_effect *effect);
slouken@2713
   169
slouken@2713
   170
/*
slouken@2713
   171
 * Sets the global gain of the haptic device.
slouken@2713
   172
 *
slouken@2713
   173
 * Returns 0 on success, -1 on error.
slouken@2713
   174
 */
slouken@2713
   175
extern int SDL_SYS_HapticSetGain(SDL_Haptic * haptic, int gain);
slouken@2713
   176
slouken@2713
   177
/*
slouken@2713
   178
 * Sets the autocenter feature of the haptic device.
slouken@2713
   179
 *
slouken@2713
   180
 * Returns 0 on success, -1 on error.
slouken@2713
   181
 */
slouken@2713
   182
extern int SDL_SYS_HapticSetAutocenter(SDL_Haptic * haptic, int autocenter);
slouken@2713
   183
slouken@2713
   184
/*
slouken@2713
   185
 * Pauses the haptic device.
slouken@2713
   186
 *
slouken@2713
   187
 * Returns 0 on success, -1 on error.
slouken@2713
   188
 */
slouken@2713
   189
extern int SDL_SYS_HapticPause(SDL_Haptic * haptic);
slouken@2713
   190
slouken@2713
   191
/*
slouken@2713
   192
 * Unpauses the haptic device.
slouken@2713
   193
 *
slouken@2713
   194
 * Returns 0 on success, -1 on error.
slouken@2713
   195
 */
slouken@2713
   196
extern int SDL_SYS_HapticUnpause(SDL_Haptic * haptic);
slouken@2713
   197
slouken@2713
   198
/*
slouken@2713
   199
 * Stops all the currently playing haptic effects on the device.
slouken@2713
   200
 *
slouken@2713
   201
 * Returns 0 on success, -1 on error.
slouken@2713
   202
 */
slouken@2713
   203
extern int SDL_SYS_HapticStopAll(SDL_Haptic * haptic);