forked from Green-Sky/tomato
sdl (master post 3.1 preview) Merge commit 'e4f454091a943345938608570b104400f62fd625'
This commit is contained in:
401
external/sdl/SDL/include/SDL3/SDL_haptic.h
vendored
401
external/sdl/SDL/include/SDL3/SDL_haptic.h
vendored
@@ -27,55 +27,60 @@
|
||||
* The basic usage is as follows:
|
||||
* - Initialize the subsystem (::SDL_INIT_HAPTIC).
|
||||
* - Open a haptic device.
|
||||
* - SDL_HapticOpen() to open from index.
|
||||
* - SDL_HapticOpenFromJoystick() to open from an existing joystick.
|
||||
* - SDL_OpenHaptic() to open from index.
|
||||
* - SDL_OpenHapticFromJoystick() to open from an existing joystick.
|
||||
* - Create an effect (::SDL_HapticEffect).
|
||||
* - Upload the effect with SDL_HapticNewEffect().
|
||||
* - Run the effect with SDL_HapticRunEffect().
|
||||
* - (optional) Free the effect with SDL_HapticDestroyEffect().
|
||||
* - Close the haptic device with SDL_HapticClose().
|
||||
* - Upload the effect with SDL_CreateHapticEffect().
|
||||
* - Run the effect with SDL_RunHapticEffect().
|
||||
* - (optional) Free the effect with SDL_DestroyHapticEffect().
|
||||
* - Close the haptic device with SDL_CloseHaptic().
|
||||
*
|
||||
* \par Simple rumble example:
|
||||
* \code
|
||||
* SDL_Haptic *haptic;
|
||||
* SDL_Haptic *haptic = NULL;
|
||||
*
|
||||
* // Open the device
|
||||
* haptic = SDL_HapticOpen( 0 );
|
||||
* SDL_HapticID *haptics = SDL_GetHaptics(NULL);
|
||||
* if (haptics) {
|
||||
* haptic = SDL_OpenHaptic(haptics[0]);
|
||||
* SDL_free(haptics);
|
||||
* }
|
||||
* if (haptic == NULL)
|
||||
* return -1;
|
||||
*
|
||||
* // Initialize simple rumble
|
||||
* if (SDL_HapticRumbleInit( haptic ) != 0)
|
||||
* if (SDL_InitHapticRumble(haptic) != 0)
|
||||
* return -1;
|
||||
*
|
||||
* // Play effect at 50% strength for 2 seconds
|
||||
* if (SDL_HapticRumblePlay( haptic, 0.5, 2000 ) != 0)
|
||||
* if (SDL_PlayHapticRumble(haptic, 0.5, 2000) != 0)
|
||||
* return -1;
|
||||
* SDL_Delay( 2000 );
|
||||
* SDL_Delay(2000);
|
||||
*
|
||||
* // Clean up
|
||||
* SDL_HapticClose( haptic );
|
||||
* SDL_CloseHaptic(haptic);
|
||||
* \endcode
|
||||
*
|
||||
* \par Complete example:
|
||||
* \code
|
||||
* int test_haptic( SDL_Joystick * joystick ) {
|
||||
* int test_haptic(SDL_Joystick *joystick)
|
||||
* {
|
||||
* SDL_Haptic *haptic;
|
||||
* SDL_HapticEffect effect;
|
||||
* int effect_id;
|
||||
*
|
||||
* // Open the device
|
||||
* haptic = SDL_HapticOpenFromJoystick( joystick );
|
||||
* haptic = SDL_OpenHapticFromJoystick(joystick);
|
||||
* if (haptic == NULL) return -1; // Most likely joystick isn't haptic
|
||||
*
|
||||
* // See if it can do sine waves
|
||||
* if ((SDL_HapticQuery(haptic) & SDL_HAPTIC_SINE)==0) {
|
||||
* SDL_HapticClose(haptic); // No sine effect
|
||||
* if ((SDL_GetHapticFeatures(haptic) & SDL_HAPTIC_SINE)==0) {
|
||||
* SDL_CloseHaptic(haptic); // No sine effect
|
||||
* return -1;
|
||||
* }
|
||||
*
|
||||
* // Create the effect
|
||||
* SDL_memset( &effect, 0, sizeof(SDL_HapticEffect) ); // 0 is safe default
|
||||
* SDL_memset(&effect, 0, sizeof(SDL_HapticEffect)); // 0 is safe default
|
||||
* effect.type = SDL_HAPTIC_SINE;
|
||||
* effect.periodic.direction.type = SDL_HAPTIC_POLAR; // Polar coordinates
|
||||
* effect.periodic.direction.dir[0] = 18000; // Force comes from south
|
||||
@@ -86,21 +91,23 @@
|
||||
* effect.periodic.fade_length = 1000; // Takes 1 second to fade away
|
||||
*
|
||||
* // Upload the effect
|
||||
* effect_id = SDL_HapticNewEffect( haptic, &effect );
|
||||
* effect_id = SDL_CreateHapticEffect(haptic, &effect);
|
||||
*
|
||||
* // Test the effect
|
||||
* SDL_HapticRunEffect( haptic, effect_id, 1 );
|
||||
* SDL_Delay( 5000); // Wait for the effect to finish
|
||||
* SDL_RunHapticEffect(haptic, effect_id, 1);
|
||||
* SDL_Delay(5000); // Wait for the effect to finish
|
||||
*
|
||||
* // We destroy the effect, although closing the device also does this
|
||||
* SDL_HapticDestroyEffect( haptic, effect_id );
|
||||
* SDL_DestroyHapticEffect(haptic, effect_id);
|
||||
*
|
||||
* // Close the device
|
||||
* SDL_HapticClose(haptic);
|
||||
* SDL_CloseHaptic(haptic);
|
||||
*
|
||||
* return 0; // Success
|
||||
* }
|
||||
* \endcode
|
||||
*
|
||||
* Note that the SDL haptic subsystem is not thread-safe.
|
||||
*/
|
||||
|
||||
#ifndef SDL_haptic_h_
|
||||
@@ -132,9 +139,9 @@ extern "C" {
|
||||
*
|
||||
* The haptic structure used to identify an SDL haptic.
|
||||
*
|
||||
* \sa SDL_HapticOpen
|
||||
* \sa SDL_HapticOpenFromJoystick
|
||||
* \sa SDL_HapticClose
|
||||
* \sa SDL_OpenHaptic
|
||||
* \sa SDL_OpenHapticFromJoystick
|
||||
* \sa SDL_CloseHaptic
|
||||
*/
|
||||
struct SDL_Haptic;
|
||||
typedef struct SDL_Haptic SDL_Haptic;
|
||||
@@ -159,7 +166,7 @@ typedef struct SDL_Haptic SDL_Haptic;
|
||||
*
|
||||
* \sa SDL_HapticCondition
|
||||
*/
|
||||
#define SDL_HAPTIC_CONSTANT (1u<<0)
|
||||
#define SDL_HAPTIC_CONSTANT (1u<<0)
|
||||
|
||||
/**
|
||||
* Sine wave effect supported.
|
||||
@@ -168,21 +175,16 @@ typedef struct SDL_Haptic SDL_Haptic;
|
||||
*
|
||||
* \sa SDL_HapticPeriodic
|
||||
*/
|
||||
#define SDL_HAPTIC_SINE (1u<<1)
|
||||
#define SDL_HAPTIC_SINE (1u<<1)
|
||||
|
||||
/**
|
||||
* Left/Right effect supported.
|
||||
* Square wave effect supported.
|
||||
*
|
||||
* Haptic effect for direct control over high/low frequency motors.
|
||||
* Periodic haptic effect that simulates square waves.
|
||||
*
|
||||
* \sa SDL_HapticLeftRight
|
||||
* \warning this value was SDL_HAPTIC_SQUARE right before 2.0.0 shipped. Sorry,
|
||||
* we ran out of bits, and this is important for XInput devices.
|
||||
* \sa SDL_HapticPeriodic
|
||||
*/
|
||||
#define SDL_HAPTIC_LEFTRIGHT (1u<<2)
|
||||
|
||||
/* !!! FIXME: put this back when we have more bits in 2.1 */
|
||||
/* #define SDL_HAPTIC_SQUARE (1<<2) */
|
||||
#define SDL_HAPTIC_SQUARE (1<<2)
|
||||
|
||||
/**
|
||||
* Triangle wave effect supported.
|
||||
@@ -191,7 +193,7 @@ typedef struct SDL_Haptic SDL_Haptic;
|
||||
*
|
||||
* \sa SDL_HapticPeriodic
|
||||
*/
|
||||
#define SDL_HAPTIC_TRIANGLE (1u<<3)
|
||||
#define SDL_HAPTIC_TRIANGLE (1u<<3)
|
||||
|
||||
/**
|
||||
* Sawtoothup wave effect supported.
|
||||
@@ -200,7 +202,7 @@ typedef struct SDL_Haptic SDL_Haptic;
|
||||
*
|
||||
* \sa SDL_HapticPeriodic
|
||||
*/
|
||||
#define SDL_HAPTIC_SAWTOOTHUP (1u<<4)
|
||||
#define SDL_HAPTIC_SAWTOOTHUP (1u<<4)
|
||||
|
||||
/**
|
||||
* Sawtoothdown wave effect supported.
|
||||
@@ -218,7 +220,7 @@ typedef struct SDL_Haptic SDL_Haptic;
|
||||
*
|
||||
* \sa SDL_HapticRamp
|
||||
*/
|
||||
#define SDL_HAPTIC_RAMP (1u<<6)
|
||||
#define SDL_HAPTIC_RAMP (1u<<6)
|
||||
|
||||
/**
|
||||
* Spring effect supported - uses axes position.
|
||||
@@ -228,7 +230,7 @@ typedef struct SDL_Haptic SDL_Haptic;
|
||||
*
|
||||
* \sa SDL_HapticCondition
|
||||
*/
|
||||
#define SDL_HAPTIC_SPRING (1u<<7)
|
||||
#define SDL_HAPTIC_SPRING (1u<<7)
|
||||
|
||||
/**
|
||||
* Damper effect supported - uses axes velocity.
|
||||
@@ -238,7 +240,7 @@ typedef struct SDL_Haptic SDL_Haptic;
|
||||
*
|
||||
* \sa SDL_HapticCondition
|
||||
*/
|
||||
#define SDL_HAPTIC_DAMPER (1u<<8)
|
||||
#define SDL_HAPTIC_DAMPER (1u<<8)
|
||||
|
||||
/**
|
||||
* Inertia effect supported - uses axes acceleration.
|
||||
@@ -248,7 +250,7 @@ typedef struct SDL_Haptic SDL_Haptic;
|
||||
*
|
||||
* \sa SDL_HapticCondition
|
||||
*/
|
||||
#define SDL_HAPTIC_INERTIA (1u<<9)
|
||||
#define SDL_HAPTIC_INERTIA (1u<<9)
|
||||
|
||||
/**
|
||||
* Friction effect supported - uses axes movement.
|
||||
@@ -258,14 +260,30 @@ typedef struct SDL_Haptic SDL_Haptic;
|
||||
*
|
||||
* \sa SDL_HapticCondition
|
||||
*/
|
||||
#define SDL_HAPTIC_FRICTION (1u<<10)
|
||||
#define SDL_HAPTIC_FRICTION (1u<<10)
|
||||
|
||||
/**
|
||||
* Left/Right effect supported.
|
||||
*
|
||||
* Haptic effect for direct control over high/low frequency motors.
|
||||
*
|
||||
* \sa SDL_HapticLeftRight
|
||||
*/
|
||||
#define SDL_HAPTIC_LEFTRIGHT (1u<<11)
|
||||
|
||||
/**
|
||||
* Reserved for future use
|
||||
*/
|
||||
#define SDL_HAPTIC_RESERVED1 (1u<<12)
|
||||
#define SDL_HAPTIC_RESERVED2 (1u<<13)
|
||||
#define SDL_HAPTIC_RESERVED3 (1u<<14)
|
||||
|
||||
/**
|
||||
* Custom effect is supported.
|
||||
*
|
||||
* User defined custom haptic effect.
|
||||
*/
|
||||
#define SDL_HAPTIC_CUSTOM (1u<<11)
|
||||
#define SDL_HAPTIC_CUSTOM (1u<<15)
|
||||
|
||||
/* @} *//* Haptic effects */
|
||||
|
||||
@@ -276,37 +294,37 @@ typedef struct SDL_Haptic SDL_Haptic;
|
||||
*
|
||||
* Device supports setting the global gain.
|
||||
*
|
||||
* \sa SDL_HapticSetGain
|
||||
* \sa SDL_SetHapticGain
|
||||
*/
|
||||
#define SDL_HAPTIC_GAIN (1u<<12)
|
||||
#define SDL_HAPTIC_GAIN (1u<<16)
|
||||
|
||||
/**
|
||||
* Device can set autocenter.
|
||||
*
|
||||
* Device supports setting autocenter.
|
||||
*
|
||||
* \sa SDL_HapticSetAutocenter
|
||||
* \sa SDL_SetHapticAutocenter
|
||||
*/
|
||||
#define SDL_HAPTIC_AUTOCENTER (1u<<13)
|
||||
#define SDL_HAPTIC_AUTOCENTER (1u<<17)
|
||||
|
||||
/**
|
||||
* Device can be queried for effect status.
|
||||
*
|
||||
* Device supports querying effect status.
|
||||
*
|
||||
* \sa SDL_HapticGetEffectStatus
|
||||
* \sa SDL_GetHapticEffectStatus
|
||||
*/
|
||||
#define SDL_HAPTIC_STATUS (1u<<14)
|
||||
#define SDL_HAPTIC_STATUS (1u<<18)
|
||||
|
||||
/**
|
||||
* Device can be paused.
|
||||
*
|
||||
* Devices supports being paused.
|
||||
*
|
||||
* \sa SDL_HapticPause
|
||||
* \sa SDL_HapticUnpause
|
||||
* \sa SDL_PauseHaptic
|
||||
* \sa SDL_ResumeHaptic
|
||||
*/
|
||||
#define SDL_HAPTIC_PAUSE (1u<<15)
|
||||
#define SDL_HAPTIC_PAUSE (1u<<19)
|
||||
|
||||
|
||||
/**
|
||||
@@ -356,7 +374,7 @@ typedef struct SDL_Haptic SDL_Haptic;
|
||||
/**
|
||||
* Used to play a device an infinite number of times.
|
||||
*
|
||||
* \sa SDL_HapticRunEffect
|
||||
* \sa SDL_RunHapticEffect
|
||||
*/
|
||||
#define SDL_HAPTIC_INFINITY 4294967295U
|
||||
|
||||
@@ -455,7 +473,7 @@ typedef struct SDL_Haptic SDL_Haptic;
|
||||
* \sa SDL_HAPTIC_SPHERICAL
|
||||
* \sa SDL_HAPTIC_STEERING_AXIS
|
||||
* \sa SDL_HapticEffect
|
||||
* \sa SDL_HapticNumAxes
|
||||
* \sa SDL_GetNumHapticAxes
|
||||
*/
|
||||
typedef struct SDL_HapticDirection
|
||||
{
|
||||
@@ -504,7 +522,7 @@ typedef struct SDL_HapticConstant
|
||||
*
|
||||
* The struct handles the following effects:
|
||||
* - ::SDL_HAPTIC_SINE
|
||||
* - ::SDL_HAPTIC_LEFTRIGHT
|
||||
* - ::SDL_HAPTIC_SQUARE
|
||||
* - ::SDL_HAPTIC_TRIANGLE
|
||||
* - ::SDL_HAPTIC_SAWTOOTHUP
|
||||
* - ::SDL_HAPTIC_SAWTOOTHDOWN
|
||||
@@ -550,7 +568,7 @@ typedef struct SDL_HapticConstant
|
||||
\endverbatim
|
||||
*
|
||||
* \sa SDL_HAPTIC_SINE
|
||||
* \sa SDL_HAPTIC_LEFTRIGHT
|
||||
* \sa SDL_HAPTIC_SQUARE
|
||||
* \sa SDL_HAPTIC_TRIANGLE
|
||||
* \sa SDL_HAPTIC_SAWTOOTHUP
|
||||
* \sa SDL_HAPTIC_SAWTOOTHDOWN
|
||||
@@ -559,7 +577,7 @@ typedef struct SDL_HapticConstant
|
||||
typedef struct SDL_HapticPeriodic
|
||||
{
|
||||
/* Header */
|
||||
Uint16 type; /**< ::SDL_HAPTIC_SINE, ::SDL_HAPTIC_LEFTRIGHT,
|
||||
Uint16 type; /**< ::SDL_HAPTIC_SINE, ::SDL_HAPTIC_SQUARE
|
||||
::SDL_HAPTIC_TRIANGLE, ::SDL_HAPTIC_SAWTOOTHUP or
|
||||
::SDL_HAPTIC_SAWTOOTHDOWN */
|
||||
SDL_HapticDirection direction; /**< Direction of the effect. */
|
||||
@@ -819,36 +837,46 @@ typedef union SDL_HapticEffect
|
||||
SDL_HapticCustom custom; /**< Custom effect. */
|
||||
} SDL_HapticEffect;
|
||||
|
||||
/**
|
||||
* This is a unique ID for a haptic device for the time it is connected to the system, and is never reused for the lifetime of the application. If the haptic device is disconnected and reconnected, it will get a new ID.
|
||||
*
|
||||
* The ID value starts at 1 and increments from there. The value 0 is an invalid ID.
|
||||
*/
|
||||
typedef Uint32 SDL_HapticID;
|
||||
|
||||
|
||||
/* Function prototypes */
|
||||
|
||||
/**
|
||||
* Count the number of haptic devices attached to the system.
|
||||
* Get a list of currently connected haptic devices.
|
||||
*
|
||||
* \returns the number of haptic devices detected on the system or a negative
|
||||
* error code on failure; call SDL_GetError() for more information.
|
||||
* \param count a pointer filled in with the number of haptic devices returned
|
||||
* \returns a 0 terminated array of haptic device instance IDs which should be
|
||||
* freed with SDL_free(), or NULL on error; call SDL_GetError() for
|
||||
* more details.
|
||||
*
|
||||
* \since This function is available since SDL 3.0.0.
|
||||
*
|
||||
* \sa SDL_HapticName
|
||||
* \sa SDL_OpenHaptic
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_NumHaptics(void);
|
||||
extern DECLSPEC SDL_HapticID *SDLCALL SDL_GetHaptics(int *count);
|
||||
|
||||
/**
|
||||
* Get the implementation dependent name of a haptic device.
|
||||
*
|
||||
* This can be called before any joysticks are opened. If no name can be
|
||||
* found, this function returns NULL.
|
||||
* This can be called before any haptic devices are opened.
|
||||
*
|
||||
* \param device_index index of the device to query.
|
||||
* \returns the name of the device or NULL on failure; call SDL_GetError() for
|
||||
* more information.
|
||||
* \param instance_id the haptic device instance ID
|
||||
* \returns the name of the selected haptic device. If no name can be found,
|
||||
* this function returns NULL; call SDL_GetError() for more
|
||||
* information.
|
||||
*
|
||||
* \since This function is available since SDL 3.0.0.
|
||||
*
|
||||
* \sa SDL_NumHaptics
|
||||
* \sa SDL_GetHapticName
|
||||
* \sa SDL_OpenHaptic
|
||||
*/
|
||||
extern DECLSPEC const char *SDLCALL SDL_HapticName(int device_index);
|
||||
extern DECLSPEC const char *SDLCALL SDL_GetHapticInstanceName(SDL_HapticID instance_id);
|
||||
|
||||
/**
|
||||
* Open a haptic device for use.
|
||||
@@ -857,53 +885,60 @@ extern DECLSPEC const char *SDLCALL SDL_HapticName(int device_index);
|
||||
* system.
|
||||
*
|
||||
* When opening a haptic device, its gain will be set to maximum and
|
||||
* autocenter will be disabled. To modify these values use SDL_HapticSetGain()
|
||||
* and SDL_HapticSetAutocenter().
|
||||
* autocenter will be disabled. To modify these values use SDL_SetHapticGain()
|
||||
* and SDL_SetHapticAutocenter().
|
||||
*
|
||||
* \param device_index index of the device to open
|
||||
* \param instance_id the haptic device instance ID
|
||||
* \returns the device identifier or NULL on failure; call SDL_GetError() for
|
||||
* more information.
|
||||
*
|
||||
* \since This function is available since SDL 3.0.0.
|
||||
*
|
||||
* \sa SDL_HapticClose
|
||||
* \sa SDL_HapticIndex
|
||||
* \sa SDL_HapticOpenFromJoystick
|
||||
* \sa SDL_HapticOpenFromMouse
|
||||
* \sa SDL_HapticPause
|
||||
* \sa SDL_HapticSetAutocenter
|
||||
* \sa SDL_HapticSetGain
|
||||
* \sa SDL_HapticStopAll
|
||||
* \sa SDL_CloseHaptic
|
||||
* \sa SDL_GetHaptics
|
||||
* \sa SDL_OpenHapticFromJoystick
|
||||
* \sa SDL_OpenHapticFromMouse
|
||||
* \sa SDL_SetHapticAutocenter
|
||||
* \sa SDL_SetHapticGain
|
||||
*/
|
||||
extern DECLSPEC SDL_Haptic *SDLCALL SDL_HapticOpen(int device_index);
|
||||
extern DECLSPEC SDL_Haptic *SDLCALL SDL_OpenHaptic(SDL_HapticID instance_id);
|
||||
|
||||
|
||||
/**
|
||||
* Check if the haptic device at the designated index has been opened.
|
||||
* Get the SDL_Haptic associated with an instance ID, if it has been opened.
|
||||
*
|
||||
* \param device_index the index of the device to query
|
||||
* \returns 1 if it has been opened, 0 if it hasn't or on failure; call
|
||||
* SDL_GetError() for more information.
|
||||
* \param instance_id the instance ID to get the SDL_Haptic for
|
||||
* \returns an SDL_Haptic on success or NULL on failure or if it hasn't been
|
||||
* opened yet; call SDL_GetError() for more information.
|
||||
*
|
||||
* \since This function is available since SDL 3.0.0.
|
||||
*
|
||||
* \sa SDL_HapticIndex
|
||||
* \sa SDL_HapticOpen
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_HapticOpened(int device_index);
|
||||
extern DECLSPEC SDL_Haptic *SDLCALL SDL_GetHapticFromInstanceID(SDL_HapticID instance_id);
|
||||
|
||||
/**
|
||||
* Get the index of a haptic device.
|
||||
* Get the instance ID of an opened haptic device.
|
||||
*
|
||||
* \param haptic the SDL_Haptic device to query
|
||||
* \returns the index of the specified haptic device or a negative error code
|
||||
* on failure; call SDL_GetError() for more information.
|
||||
* \returns the instance ID of the specified haptic device on success or 0 on
|
||||
* failure; call SDL_GetError() for more information.
|
||||
*
|
||||
* \since This function is available since SDL 3.0.0.
|
||||
*/
|
||||
extern DECLSPEC SDL_HapticID SDLCALL SDL_GetHapticInstanceID(SDL_Haptic *haptic);
|
||||
|
||||
/**
|
||||
* Get the implementation dependent name of a haptic device.
|
||||
*
|
||||
* \param haptic the SDL_Haptic obtained from SDL_OpenJoystick()
|
||||
* \returns the name of the selected haptic device. If no name can be found,
|
||||
* this function returns NULL; call SDL_GetError() for more
|
||||
* information.
|
||||
*
|
||||
* \since This function is available since SDL 3.0.0.
|
||||
*
|
||||
* \sa SDL_HapticOpen
|
||||
* \sa SDL_HapticOpened
|
||||
* \sa SDL_GetHapticInstanceName
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_HapticIndex(SDL_Haptic * haptic);
|
||||
extern DECLSPEC const char *SDLCALL SDL_GetHapticName(SDL_Haptic *haptic);
|
||||
|
||||
/**
|
||||
* Query whether or not the current mouse has haptic capabilities.
|
||||
@@ -912,9 +947,9 @@ extern DECLSPEC int SDLCALL SDL_HapticIndex(SDL_Haptic * haptic);
|
||||
*
|
||||
* \since This function is available since SDL 3.0.0.
|
||||
*
|
||||
* \sa SDL_HapticOpenFromMouse
|
||||
* \sa SDL_OpenHapticFromMouse
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_MouseIsHaptic(void);
|
||||
extern DECLSPEC SDL_bool SDLCALL SDL_IsMouseHaptic(void);
|
||||
|
||||
/**
|
||||
* Try to open a haptic device from the current mouse.
|
||||
@@ -924,24 +959,22 @@ extern DECLSPEC int SDLCALL SDL_MouseIsHaptic(void);
|
||||
*
|
||||
* \since This function is available since SDL 3.0.0.
|
||||
*
|
||||
* \sa SDL_HapticOpen
|
||||
* \sa SDL_MouseIsHaptic
|
||||
* \sa SDL_CloseHaptic
|
||||
* \sa SDL_IsMouseHaptic
|
||||
*/
|
||||
extern DECLSPEC SDL_Haptic *SDLCALL SDL_HapticOpenFromMouse(void);
|
||||
extern DECLSPEC SDL_Haptic *SDLCALL SDL_OpenHapticFromMouse(void);
|
||||
|
||||
/**
|
||||
* Query if a joystick has haptic features.
|
||||
*
|
||||
* \param joystick the SDL_Joystick to test for haptic capabilities
|
||||
* \returns SDL_TRUE if the joystick is haptic, SDL_FALSE if it isn't, or a
|
||||
* negative error code on failure; call SDL_GetError() for more
|
||||
* information.
|
||||
* \returns SDL_TRUE if the joystick is haptic or SDL_FALSE if it isn't.
|
||||
*
|
||||
* \since This function is available since SDL 3.0.0.
|
||||
*
|
||||
* \sa SDL_HapticOpenFromJoystick
|
||||
* \sa SDL_OpenHapticFromJoystick
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_JoystickIsHaptic(SDL_Joystick * joystick);
|
||||
extern DECLSPEC SDL_bool SDLCALL SDL_IsJoystickHaptic(SDL_Joystick *joystick);
|
||||
|
||||
/**
|
||||
* Open a haptic device for use from a joystick device.
|
||||
@@ -960,30 +993,28 @@ extern DECLSPEC int SDLCALL SDL_JoystickIsHaptic(SDL_Joystick * joystick);
|
||||
*
|
||||
* \since This function is available since SDL 3.0.0.
|
||||
*
|
||||
* \sa SDL_HapticClose
|
||||
* \sa SDL_HapticOpen
|
||||
* \sa SDL_JoystickIsHaptic
|
||||
* \sa SDL_CloseHaptic
|
||||
* \sa SDL_IsJoystickHaptic
|
||||
*/
|
||||
extern DECLSPEC SDL_Haptic *SDLCALL SDL_HapticOpenFromJoystick(SDL_Joystick *
|
||||
joystick);
|
||||
extern DECLSPEC SDL_Haptic *SDLCALL SDL_OpenHapticFromJoystick(SDL_Joystick *joystick);
|
||||
|
||||
/**
|
||||
* Close a haptic device previously opened with SDL_HapticOpen().
|
||||
* Close a haptic device previously opened with SDL_OpenHaptic().
|
||||
*
|
||||
* \param haptic the SDL_Haptic device to close
|
||||
*
|
||||
* \since This function is available since SDL 3.0.0.
|
||||
*
|
||||
* \sa SDL_HapticOpen
|
||||
* \sa SDL_OpenHaptic
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_HapticClose(SDL_Haptic * haptic);
|
||||
extern DECLSPEC void SDLCALL SDL_CloseHaptic(SDL_Haptic *haptic);
|
||||
|
||||
/**
|
||||
* Get the number of effects a haptic device can store.
|
||||
*
|
||||
* On some platforms this isn't fully supported, and therefore is an
|
||||
* approximation. Always check to see if your created effect was actually
|
||||
* created and do not rely solely on SDL_HapticNumEffects().
|
||||
* created and do not rely solely on SDL_GetMaxHapticEffects().
|
||||
*
|
||||
* \param haptic the SDL_Haptic device to query
|
||||
* \returns the number of effects the haptic device can store or a negative
|
||||
@@ -991,10 +1022,10 @@ extern DECLSPEC void SDLCALL SDL_HapticClose(SDL_Haptic * haptic);
|
||||
*
|
||||
* \since This function is available since SDL 3.0.0.
|
||||
*
|
||||
* \sa SDL_HapticNumEffectsPlaying
|
||||
* \sa SDL_HapticQuery
|
||||
* \sa SDL_GetMaxHapticEffectsPlaying
|
||||
* \sa SDL_GetHapticFeatures
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_HapticNumEffects(SDL_Haptic * haptic);
|
||||
extern DECLSPEC int SDLCALL SDL_GetMaxHapticEffects(SDL_Haptic *haptic);
|
||||
|
||||
/**
|
||||
* Get the number of effects a haptic device can play at the same time.
|
||||
@@ -1008,10 +1039,10 @@ extern DECLSPEC int SDLCALL SDL_HapticNumEffects(SDL_Haptic * haptic);
|
||||
*
|
||||
* \since This function is available since SDL 3.0.0.
|
||||
*
|
||||
* \sa SDL_HapticNumEffects
|
||||
* \sa SDL_HapticQuery
|
||||
* \sa SDL_GetMaxHapticEffects
|
||||
* \sa SDL_GetHapticFeatures
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_HapticNumEffectsPlaying(SDL_Haptic * haptic);
|
||||
extern DECLSPEC int SDLCALL SDL_GetMaxHapticEffectsPlaying(SDL_Haptic *haptic);
|
||||
|
||||
/**
|
||||
* Get the haptic device's supported features in bitwise manner.
|
||||
@@ -1023,9 +1054,9 @@ extern DECLSPEC int SDLCALL SDL_HapticNumEffectsPlaying(SDL_Haptic * haptic);
|
||||
* \since This function is available since SDL 3.0.0.
|
||||
*
|
||||
* \sa SDL_HapticEffectSupported
|
||||
* \sa SDL_HapticNumEffects
|
||||
* \sa SDL_GetMaxHapticEffects
|
||||
*/
|
||||
extern DECLSPEC unsigned int SDLCALL SDL_HapticQuery(SDL_Haptic * haptic);
|
||||
extern DECLSPEC Uint32 SDLCALL SDL_GetHapticFeatures(SDL_Haptic *haptic);
|
||||
|
||||
|
||||
/**
|
||||
@@ -1040,25 +1071,21 @@ extern DECLSPEC unsigned int SDLCALL SDL_HapticQuery(SDL_Haptic * haptic);
|
||||
*
|
||||
* \since This function is available since SDL 3.0.0.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_HapticNumAxes(SDL_Haptic * haptic);
|
||||
extern DECLSPEC int SDLCALL SDL_GetNumHapticAxes(SDL_Haptic *haptic);
|
||||
|
||||
/**
|
||||
* Check to see if an effect is supported by a haptic device.
|
||||
*
|
||||
* \param haptic the SDL_Haptic device to query
|
||||
* \param effect the desired effect to query
|
||||
* \returns SDL_TRUE if effect is supported, SDL_FALSE if it isn't, or a
|
||||
* negative error code on failure; call SDL_GetError() for more
|
||||
* information.
|
||||
* \returns SDL_TRUE if the effect is supported or SDL_FALSE if it isn't.
|
||||
*
|
||||
* \since This function is available since SDL 3.0.0.
|
||||
*
|
||||
* \sa SDL_HapticNewEffect
|
||||
* \sa SDL_HapticQuery
|
||||
* \sa SDL_CreateHapticEffect
|
||||
* \sa SDL_GetHapticFeatures
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_HapticEffectSupported(SDL_Haptic * haptic,
|
||||
SDL_HapticEffect *
|
||||
effect);
|
||||
extern DECLSPEC SDL_bool SDLCALL SDL_HapticEffectSupported(SDL_Haptic *haptic, const SDL_HapticEffect *effect);
|
||||
|
||||
/**
|
||||
* Create a new haptic effect on a specified device.
|
||||
@@ -1071,12 +1098,11 @@ extern DECLSPEC int SDLCALL SDL_HapticEffectSupported(SDL_Haptic * haptic,
|
||||
*
|
||||
* \since This function is available since SDL 3.0.0.
|
||||
*
|
||||
* \sa SDL_HapticDestroyEffect
|
||||
* \sa SDL_HapticRunEffect
|
||||
* \sa SDL_HapticUpdateEffect
|
||||
* \sa SDL_DestroyHapticEffect
|
||||
* \sa SDL_RunHapticEffect
|
||||
* \sa SDL_UpdateHapticEffect
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_HapticNewEffect(SDL_Haptic * haptic,
|
||||
SDL_HapticEffect * effect);
|
||||
extern DECLSPEC int SDLCALL SDL_CreateHapticEffect(SDL_Haptic *haptic, const SDL_HapticEffect *effect);
|
||||
|
||||
/**
|
||||
* Update the properties of an effect.
|
||||
@@ -1084,7 +1110,7 @@ extern DECLSPEC int SDLCALL SDL_HapticNewEffect(SDL_Haptic * haptic,
|
||||
* Can be used dynamically, although behavior when dynamically changing
|
||||
* direction may be strange. Specifically the effect may re-upload itself and
|
||||
* start playing from the start. You also cannot change the type either when
|
||||
* running SDL_HapticUpdateEffect().
|
||||
* running SDL_UpdateHapticEffect().
|
||||
*
|
||||
* \param haptic the SDL_Haptic device that has the effect
|
||||
* \param effect the identifier of the effect to update
|
||||
@@ -1095,13 +1121,10 @@ extern DECLSPEC int SDLCALL SDL_HapticNewEffect(SDL_Haptic * haptic,
|
||||
*
|
||||
* \since This function is available since SDL 3.0.0.
|
||||
*
|
||||
* \sa SDL_HapticDestroyEffect
|
||||
* \sa SDL_HapticNewEffect
|
||||
* \sa SDL_HapticRunEffect
|
||||
* \sa SDL_CreateHapticEffect
|
||||
* \sa SDL_RunHapticEffect
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_HapticUpdateEffect(SDL_Haptic * haptic,
|
||||
int effect,
|
||||
SDL_HapticEffect * data);
|
||||
extern DECLSPEC int SDLCALL SDL_UpdateHapticEffect(SDL_Haptic *haptic, int effect, const SDL_HapticEffect *data);
|
||||
|
||||
/**
|
||||
* Run the haptic effect on its associated haptic device.
|
||||
@@ -1121,13 +1144,11 @@ extern DECLSPEC int SDLCALL SDL_HapticUpdateEffect(SDL_Haptic * haptic,
|
||||
*
|
||||
* \since This function is available since SDL 3.0.0.
|
||||
*
|
||||
* \sa SDL_HapticDestroyEffect
|
||||
* \sa SDL_HapticGetEffectStatus
|
||||
* \sa SDL_HapticStopEffect
|
||||
* \sa SDL_GetHapticEffectStatus
|
||||
* \sa SDL_StopHapticEffect
|
||||
* \sa SDL_StopHapticEffects
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_HapticRunEffect(SDL_Haptic * haptic,
|
||||
int effect,
|
||||
Uint32 iterations);
|
||||
extern DECLSPEC int SDLCALL SDL_RunHapticEffect(SDL_Haptic *haptic, int effect, Uint32 iterations);
|
||||
|
||||
/**
|
||||
* Stop the haptic effect on its associated haptic device.
|
||||
@@ -1141,11 +1162,10 @@ extern DECLSPEC int SDLCALL SDL_HapticRunEffect(SDL_Haptic * haptic,
|
||||
*
|
||||
* \since This function is available since SDL 3.0.0.
|
||||
*
|
||||
* \sa SDL_HapticDestroyEffect
|
||||
* \sa SDL_HapticRunEffect
|
||||
* \sa SDL_RunHapticEffect
|
||||
* \sa SDL_StopHapticEffects
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_HapticStopEffect(SDL_Haptic * haptic,
|
||||
int effect);
|
||||
extern DECLSPEC int SDLCALL SDL_StopHapticEffect(SDL_Haptic *haptic, int effect);
|
||||
|
||||
/**
|
||||
* Destroy a haptic effect on the device.
|
||||
@@ -1158,10 +1178,9 @@ extern DECLSPEC int SDLCALL SDL_HapticStopEffect(SDL_Haptic * haptic,
|
||||
*
|
||||
* \since This function is available since SDL 3.0.0.
|
||||
*
|
||||
* \sa SDL_HapticNewEffect
|
||||
* \sa SDL_CreateHapticEffect
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_HapticDestroyEffect(SDL_Haptic * haptic,
|
||||
int effect);
|
||||
extern DECLSPEC void SDLCALL SDL_DestroyHapticEffect(SDL_Haptic *haptic, int effect);
|
||||
|
||||
/**
|
||||
* Get the status of the current effect on the specified haptic device.
|
||||
@@ -1174,12 +1193,8 @@ extern DECLSPEC void SDLCALL SDL_HapticDestroyEffect(SDL_Haptic * haptic,
|
||||
* code on failure; call SDL_GetError() for more information.
|
||||
*
|
||||
* \since This function is available since SDL 3.0.0.
|
||||
*
|
||||
* \sa SDL_HapticRunEffect
|
||||
* \sa SDL_HapticStopEffect
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_HapticGetEffectStatus(SDL_Haptic * haptic,
|
||||
int effect);
|
||||
extern DECLSPEC int SDLCALL SDL_GetHapticEffectStatus(SDL_Haptic *haptic, int effect);
|
||||
|
||||
/**
|
||||
* Set the global gain of the specified haptic device.
|
||||
@@ -1188,7 +1203,7 @@ extern DECLSPEC int SDLCALL SDL_HapticGetEffectStatus(SDL_Haptic * haptic,
|
||||
*
|
||||
* The user may specify the maximum gain by setting the environment variable
|
||||
* `SDL_HAPTIC_GAIN_MAX` which should be between 0 and 100. All calls to
|
||||
* SDL_HapticSetGain() will scale linearly using `SDL_HAPTIC_GAIN_MAX` as the
|
||||
* SDL_SetHapticGain() will scale linearly using `SDL_HAPTIC_GAIN_MAX` as the
|
||||
* maximum.
|
||||
*
|
||||
* \param haptic the SDL_Haptic device to set the gain on
|
||||
@@ -1198,9 +1213,9 @@ extern DECLSPEC int SDLCALL SDL_HapticGetEffectStatus(SDL_Haptic * haptic,
|
||||
*
|
||||
* \since This function is available since SDL 3.0.0.
|
||||
*
|
||||
* \sa SDL_HapticQuery
|
||||
* \sa SDL_GetHapticFeatures
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_HapticSetGain(SDL_Haptic * haptic, int gain);
|
||||
extern DECLSPEC int SDLCALL SDL_SetHapticGain(SDL_Haptic *haptic, int gain);
|
||||
|
||||
/**
|
||||
* Set the global autocenter of the device.
|
||||
@@ -1217,16 +1232,15 @@ extern DECLSPEC int SDLCALL SDL_HapticSetGain(SDL_Haptic * haptic, int gain);
|
||||
*
|
||||
* \since This function is available since SDL 3.0.0.
|
||||
*
|
||||
* \sa SDL_HapticQuery
|
||||
* \sa SDL_GetHapticFeatures
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_HapticSetAutocenter(SDL_Haptic * haptic,
|
||||
int autocenter);
|
||||
extern DECLSPEC int SDLCALL SDL_SetHapticAutocenter(SDL_Haptic *haptic, int autocenter);
|
||||
|
||||
/**
|
||||
* Pause a haptic device.
|
||||
*
|
||||
* Device must support the `SDL_HAPTIC_PAUSE` feature. Call
|
||||
* SDL_HapticUnpause() to resume playback.
|
||||
* Device must support the `SDL_HAPTIC_PAUSE` feature. Call SDL_ResumeHaptic()
|
||||
* to resume playback.
|
||||
*
|
||||
* Do not modify the effects nor add new ones while the device is paused. That
|
||||
* can cause all sorts of weird errors.
|
||||
@@ -1237,14 +1251,14 @@ extern DECLSPEC int SDLCALL SDL_HapticSetAutocenter(SDL_Haptic * haptic,
|
||||
*
|
||||
* \since This function is available since SDL 3.0.0.
|
||||
*
|
||||
* \sa SDL_HapticUnpause
|
||||
* \sa SDL_ResumeHaptic
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_HapticPause(SDL_Haptic * haptic);
|
||||
extern DECLSPEC int SDLCALL SDL_PauseHaptic(SDL_Haptic *haptic);
|
||||
|
||||
/**
|
||||
* Unpause a haptic device.
|
||||
* Resume a haptic device.
|
||||
*
|
||||
* Call to unpause after SDL_HapticPause().
|
||||
* Call to unpause after SDL_PauseHaptic().
|
||||
*
|
||||
* \param haptic the SDL_Haptic device to unpause
|
||||
* \returns 0 on success or a negative error code on failure; call
|
||||
@@ -1252,9 +1266,9 @@ extern DECLSPEC int SDLCALL SDL_HapticPause(SDL_Haptic * haptic);
|
||||
*
|
||||
* \since This function is available since SDL 3.0.0.
|
||||
*
|
||||
* \sa SDL_HapticPause
|
||||
* \sa SDL_PauseHaptic
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_HapticUnpause(SDL_Haptic * haptic);
|
||||
extern DECLSPEC int SDLCALL SDL_ResumeHaptic(SDL_Haptic *haptic);
|
||||
|
||||
/**
|
||||
* Stop all the currently playing effects on a haptic device.
|
||||
@@ -1264,24 +1278,23 @@ extern DECLSPEC int SDLCALL SDL_HapticUnpause(SDL_Haptic * haptic);
|
||||
* SDL_GetError() for more information.
|
||||
*
|
||||
* \since This function is available since SDL 3.0.0.
|
||||
*
|
||||
* \sa SDL_RunHapticEffect
|
||||
* \sa SDL_StopHapticEffects
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_HapticStopAll(SDL_Haptic * haptic);
|
||||
extern DECLSPEC int SDLCALL SDL_StopHapticEffects(SDL_Haptic *haptic);
|
||||
|
||||
/**
|
||||
* Check whether rumble is supported on a haptic device.
|
||||
*
|
||||
* \param haptic haptic device to check for rumble support
|
||||
* \returns SDL_TRUE if effect is supported, SDL_FALSE if it isn't, or a
|
||||
* negative error code on failure; call SDL_GetError() for more
|
||||
* information.
|
||||
* \returns SDL_TRUE if the effect is supported or SDL_FALSE if it isn't.
|
||||
*
|
||||
* \since This function is available since SDL 3.0.0.
|
||||
*
|
||||
* \sa SDL_HapticRumbleInit
|
||||
* \sa SDL_HapticRumblePlay
|
||||
* \sa SDL_HapticRumbleStop
|
||||
* \sa SDL_InitHapticRumble
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_HapticRumbleSupported(SDL_Haptic * haptic);
|
||||
extern DECLSPEC SDL_bool SDLCALL SDL_HapticRumbleSupported(SDL_Haptic *haptic);
|
||||
|
||||
/**
|
||||
* Initialize a haptic device for simple rumble playback.
|
||||
@@ -1292,12 +1305,11 @@ extern DECLSPEC int SDLCALL SDL_HapticRumbleSupported(SDL_Haptic * haptic);
|
||||
*
|
||||
* \since This function is available since SDL 3.0.0.
|
||||
*
|
||||
* \sa SDL_HapticOpen
|
||||
* \sa SDL_HapticRumblePlay
|
||||
* \sa SDL_HapticRumbleStop
|
||||
* \sa SDL_PlayHapticRumble
|
||||
* \sa SDL_StopHapticRumble
|
||||
* \sa SDL_HapticRumbleSupported
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_HapticRumbleInit(SDL_Haptic * haptic);
|
||||
extern DECLSPEC int SDLCALL SDL_InitHapticRumble(SDL_Haptic *haptic);
|
||||
|
||||
/**
|
||||
* Run a simple rumble effect on a haptic device.
|
||||
@@ -1310,11 +1322,10 @@ extern DECLSPEC int SDLCALL SDL_HapticRumbleInit(SDL_Haptic * haptic);
|
||||
*
|
||||
* \since This function is available since SDL 3.0.0.
|
||||
*
|
||||
* \sa SDL_HapticRumbleInit
|
||||
* \sa SDL_HapticRumbleStop
|
||||
* \sa SDL_HapticRumbleSupported
|
||||
* \sa SDL_InitHapticRumble
|
||||
* \sa SDL_StopHapticRumble
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_HapticRumblePlay(SDL_Haptic * haptic, float strength, Uint32 length );
|
||||
extern DECLSPEC int SDLCALL SDL_PlayHapticRumble(SDL_Haptic *haptic, float strength, Uint32 length);
|
||||
|
||||
/**
|
||||
* Stop the simple rumble on a haptic device.
|
||||
@@ -1325,11 +1336,9 @@ extern DECLSPEC int SDLCALL SDL_HapticRumblePlay(SDL_Haptic * haptic, float stre
|
||||
*
|
||||
* \since This function is available since SDL 3.0.0.
|
||||
*
|
||||
* \sa SDL_HapticRumbleInit
|
||||
* \sa SDL_HapticRumblePlay
|
||||
* \sa SDL_HapticRumbleSupported
|
||||
* \sa SDL_PlayHapticRumble
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_HapticRumbleStop(SDL_Haptic * haptic);
|
||||
extern DECLSPEC int SDLCALL SDL_StopHapticRumble(SDL_Haptic *haptic);
|
||||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
|
||||
Reference in New Issue
Block a user