src/haptic/windows/SDL_windowshaptic_c.h
author Sam Lantinga <slouken@libsdl.org>
Sun, 01 Jan 2017 18:33:28 -0800
changeset 10737 3406a0f8b041
parent 10003 d91a2c45825e
child 11382 2c50e79b19e0
permissions -rw-r--r--
Updated copyright for 2017
icculus@8179
     1
/*
icculus@8179
     2
  Simple DirectMedia Layer
slouken@10737
     3
  Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
icculus@8179
     4
icculus@8179
     5
  This software is provided 'as-is', without any express or implied
icculus@8179
     6
  warranty.  In no event will the authors be held liable for any damages
icculus@8179
     7
  arising from the use of this software.
icculus@8179
     8
icculus@8179
     9
  Permission is granted to anyone to use this software for any purpose,
icculus@8179
    10
  including commercial applications, and to alter it and redistribute it
icculus@8179
    11
  freely, subject to the following restrictions:
icculus@8179
    12
icculus@8179
    13
  1. The origin of this software must not be misrepresented; you must not
icculus@8179
    14
     claim that you wrote the original software. If you use this software
icculus@8179
    15
     in a product, an acknowledgment in the product documentation would be
icculus@8179
    16
     appreciated but is not required.
icculus@8179
    17
  2. Altered source versions must be plainly marked as such, and must not be
icculus@8179
    18
     misrepresented as being the original software.
icculus@8179
    19
  3. This notice may not be removed or altered from any source distribution.
icculus@8179
    20
*/
slouken@8972
    21
#include "../../SDL_internal.h"
icculus@8179
    22
slouken@8972
    23
#ifndef _SDL_windowshaptic_c_h
slouken@8972
    24
#define _SDL_windowshaptic_c_h
slouken@8972
    25
slouken@8972
    26
#include "SDL_thread.h"
slouken@8976
    27
#include "../SDL_syshaptic.h"
slouken@8972
    28
#include "../../core/windows/SDL_directx.h"
slouken@8972
    29
#include "../../core/windows/SDL_xinput.h"
slouken@8972
    30
slouken@8972
    31
/*
slouken@8972
    32
 * Haptic system hardware data.
slouken@8972
    33
 */
slouken@8972
    34
struct haptic_hwdata
slouken@8972
    35
{
slouken@8972
    36
#if SDL_HAPTIC_DINPUT
slouken@8972
    37
    LPDIRECTINPUTDEVICE8 device;
slouken@8972
    38
#endif
slouken@8972
    39
    DWORD axes[3];              /* Axes to use. */
slouken@8972
    40
    SDL_bool is_joystick;       /* Device is loaded as joystick. */
slouken@8972
    41
    Uint8 bXInputHaptic; /* Supports force feedback via XInput. */
slouken@8972
    42
    Uint8 userid; /* XInput userid index for this joystick */
slouken@8972
    43
    SDL_Thread *thread;
slouken@8972
    44
    SDL_mutex *mutex;
icculus@10003
    45
    Uint32 stopTicks;
icculus@10003
    46
    SDL_atomic_t stopThread;
slouken@8972
    47
};
slouken@8972
    48
slouken@8972
    49
slouken@8972
    50
/*
slouken@8972
    51
 * Haptic system effect data.
slouken@8972
    52
 */
slouken@8972
    53
struct haptic_hweffect
slouken@8972
    54
{
slouken@8972
    55
#if SDL_HAPTIC_DINPUT
slouken@8972
    56
    DIEFFECT effect;
slouken@8972
    57
    LPDIRECTINPUTEFFECT ref;
slouken@8972
    58
#endif
slouken@8972
    59
#if SDL_HAPTIC_XINPUT
slouken@8972
    60
    XINPUT_VIBRATION vibration;
slouken@8972
    61
#endif
slouken@8972
    62
};
slouken@8972
    63
slouken@8972
    64
/*
slouken@8972
    65
* List of available haptic devices.
slouken@8972
    66
*/
slouken@8972
    67
typedef struct SDL_hapticlist_item
slouken@8972
    68
{
slouken@8972
    69
    char *name;
slouken@8972
    70
    SDL_Haptic *haptic;
slouken@8972
    71
#if SDL_HAPTIC_DINPUT
slouken@8972
    72
    DIDEVICEINSTANCE instance;
slouken@8972
    73
    DIDEVCAPS capabilities;
slouken@8972
    74
#endif
slouken@8972
    75
    SDL_bool bXInputHaptic; /* Supports force feedback via XInput. */
slouken@8972
    76
    Uint8 userid; /* XInput userid index for this joystick */
slouken@8972
    77
    struct SDL_hapticlist_item *next;
slouken@8972
    78
} SDL_hapticlist_item;
slouken@8972
    79
slouken@8972
    80
extern SDL_hapticlist_item *SDL_hapticlist;
slouken@8972
    81
slouken@8972
    82
extern int SDL_SYS_AddHapticDevice(SDL_hapticlist_item *item);
slouken@8972
    83
extern int SDL_SYS_RemoveHapticDevice(SDL_hapticlist_item *prev, SDL_hapticlist_item *item);
slouken@8972
    84
slouken@8972
    85
#endif /* _SDL_windowshaptic_c_h */
icculus@8179
    86
icculus@8179
    87
/* vi: set ts=4 sw=4 expandtab: */
icculus@8179
    88