SDL_windowshaptic_c.h
Go to the documentation of this file.
/*
Simple DirectMedia Layer
Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
#include "../../SDL_internal.h"
#ifndef SDL_windowshaptic_c_h_
#define SDL_windowshaptic_c_h_
#include "SDL_thread.h"
#include "../SDL_syshaptic.h"
#include "../../core/windows/SDL_directx.h"
#include "../../core/windows/SDL_xinput.h"
/*
* Haptic system hardware data.
*/
struct haptic_hwdata
{
#if SDL_HAPTIC_DINPUT
LPDIRECTINPUTDEVICE8 device;
#endif
DWORD axes[3]; /* Axes to use. */
SDL_bool is_joystick; /* Device is loaded as joystick. */
Uint8 bXInputHaptic; /* Supports force feedback via XInput. */
Uint8 userid; /* XInput userid index for this joystick */
SDL_Thread *thread;
SDL_mutex *mutex;
Uint32 stopTicks;
SDL_atomic_t stopThread;
};
/*
* Haptic system effect data.
*/
struct haptic_hweffect
{
#if SDL_HAPTIC_DINPUT
DIEFFECT effect;
LPDIRECTINPUTEFFECT ref;
#endif
#if SDL_HAPTIC_XINPUT
XINPUT_VIBRATION vibration;
#endif
};
/*
* List of available haptic devices.
*/
typedef struct SDL_hapticlist_item
{
char *name;
SDL_Haptic *haptic;
#if SDL_HAPTIC_DINPUT
DIDEVICEINSTANCE instance;
DIDEVCAPS capabilities;
#endif
SDL_bool bXInputHaptic; /* Supports force feedback via XInput. */
Uint8 userid; /* XInput userid index for this joystick */
struct SDL_hapticlist_item *next;
} SDL_hapticlist_item;
extern SDL_hapticlist_item *SDL_hapticlist;
extern int SDL_SYS_AddHapticDevice(SDL_hapticlist_item *item);
extern int SDL_SYS_RemoveHapticDevice(SDL_hapticlist_item *prev, SDL_hapticlist_item *item);
#endif /* SDL_windowshaptic_c_h_ */
/* vi: set ts=4 sw=4 expandtab: */
haptic_hwdata::mutex
SDL_mutex * mutex
Definition: SDL_windowshaptic_c.h:44
SDL_hapticlist_item::userid
Uint8 userid
Definition: SDL_windowshaptic_c.h:76
haptic_hweffect
Definition: SDL_windowshaptic_c.h:53
SDL_hapticlist_item::name
char * name
Definition: SDL_windowshaptic_c.h:69
haptic_hwdata::stopThread
SDL_atomic_t stopThread
Definition: SDL_windowshaptic_c.h:46
SDL_atomic_t
A type representing an atomic integer value. It is a struct so people don&#39;t accidentally use numeric ...
Definition: SDL_atomic.h:198
ref
GLenum GLint ref
Definition: SDL_opengl_glext.h:657
SDL_hapticlist_item::haptic
SDL_Haptic * haptic
Definition: SDL_windowshaptic_c.h:70
haptic_hwdata::bXInputHaptic
Uint8 bXInputHaptic
Definition: SDL_windowshaptic_c.h:41
Uint32
uint32_t Uint32
Definition: SDL_stdinc.h:181
SDL_thread.h
SDL_SYS_RemoveHapticDevice
int SDL_SYS_RemoveHapticDevice(SDL_hapticlist_item *prev, SDL_hapticlist_item *item)
SDL_mutex
Definition: SDL_sysmutex.c:29
DIDEVICEINSTANCE
Definition: SDL_directx.h:106
SDL_hapticlist
SDL_hapticlist_item * SDL_hapticlist
SDL_hapticlist_item::next
struct SDL_hapticlist_item * next
Definition: SDL_windowshaptic_c.h:77
device
static SDL_AudioDeviceID device
Definition: loopwave.c:37
haptic_hwdata
Definition: SDL_windowshaptic_c.h:34
haptic_hwdata::is_joystick
SDL_bool is_joystick
Definition: SDL_windowshaptic_c.h:40
Uint8
uint8_t Uint8
Definition: SDL_stdinc.h:157
haptic_hwdata::axes
DWORD axes[3]
Definition: SDL_windowshaptic_c.h:39
haptic_hwdata::stopTicks
Uint32 stopTicks
Definition: SDL_windowshaptic_c.h:45
SDL_bool
SDL_bool
Definition: SDL_stdinc.h:139
SDL_hapticlist_item
Definition: SDL_windowshaptic_c.h:67
SDL_Thread
Definition: SDL_thread_c.h:54
haptic_hwdata::thread
SDL_Thread * thread
Definition: SDL_windowshaptic_c.h:43
SDL_hapticlist_item::bXInputHaptic
SDL_bool bXInputHaptic
Definition: SDL_windowshaptic_c.h:75
SDL_SYS_AddHapticDevice
int SDL_SYS_AddHapticDevice(SDL_hapticlist_item *item)
haptic_hwdata::userid
Uint8 userid
Definition: SDL_windowshaptic_c.h:42