Update SDL2 to 2.0.8
This commit is contained in:
parent
8bd2c79109
commit
5bf60a9504
89 changed files with 2756 additions and 801 deletions
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
|
||||
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
|
||||
|
@ -22,12 +22,12 @@
|
|||
/**
|
||||
* \file SDL_haptic.h
|
||||
*
|
||||
* \brief The SDL Haptic subsystem allows you to control haptic (force feedback)
|
||||
* \brief The SDL haptic subsystem allows you to control haptic (force feedback)
|
||||
* devices.
|
||||
*
|
||||
* The basic usage is as follows:
|
||||
* - Initialize the Subsystem (::SDL_INIT_HAPTIC).
|
||||
* - Open a Haptic Device.
|
||||
* - Initialize the subsystem (::SDL_INIT_HAPTIC).
|
||||
* - Open a haptic device.
|
||||
* - SDL_HapticOpen() to open from index.
|
||||
* - SDL_HapticOpenFromJoystick() to open from an existing joystick.
|
||||
* - Create an effect (::SDL_HapticEffect).
|
||||
|
@ -104,8 +104,8 @@
|
|||
* \endcode
|
||||
*/
|
||||
|
||||
#ifndef _SDL_haptic_h
|
||||
#define _SDL_haptic_h
|
||||
#ifndef SDL_haptic_h_
|
||||
#define SDL_haptic_h_
|
||||
|
||||
#include "SDL_stdinc.h"
|
||||
#include "SDL_error.h"
|
||||
|
@ -149,7 +149,7 @@ typedef struct _SDL_Haptic SDL_Haptic;
|
|||
*
|
||||
* \sa SDL_HapticCondition
|
||||
*/
|
||||
#define SDL_HAPTIC_CONSTANT (1<<0)
|
||||
#define SDL_HAPTIC_CONSTANT (1u<<0)
|
||||
|
||||
/**
|
||||
* \brief Sine wave effect supported.
|
||||
|
@ -158,7 +158,7 @@ typedef struct _SDL_Haptic SDL_Haptic;
|
|||
*
|
||||
* \sa SDL_HapticPeriodic
|
||||
*/
|
||||
#define SDL_HAPTIC_SINE (1<<1)
|
||||
#define SDL_HAPTIC_SINE (1u<<1)
|
||||
|
||||
/**
|
||||
* \brief Left/Right effect supported.
|
||||
|
@ -169,7 +169,7 @@ typedef struct _SDL_Haptic SDL_Haptic;
|
|||
* \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.
|
||||
*/
|
||||
#define SDL_HAPTIC_LEFTRIGHT (1<<2)
|
||||
#define SDL_HAPTIC_LEFTRIGHT (1u<<2)
|
||||
|
||||
/* !!! FIXME: put this back when we have more bits in 2.1 */
|
||||
/* #define SDL_HAPTIC_SQUARE (1<<2) */
|
||||
|
@ -181,7 +181,7 @@ typedef struct _SDL_Haptic SDL_Haptic;
|
|||
*
|
||||
* \sa SDL_HapticPeriodic
|
||||
*/
|
||||
#define SDL_HAPTIC_TRIANGLE (1<<3)
|
||||
#define SDL_HAPTIC_TRIANGLE (1u<<3)
|
||||
|
||||
/**
|
||||
* \brief Sawtoothup wave effect supported.
|
||||
|
@ -190,7 +190,7 @@ typedef struct _SDL_Haptic SDL_Haptic;
|
|||
*
|
||||
* \sa SDL_HapticPeriodic
|
||||
*/
|
||||
#define SDL_HAPTIC_SAWTOOTHUP (1<<4)
|
||||
#define SDL_HAPTIC_SAWTOOTHUP (1u<<4)
|
||||
|
||||
/**
|
||||
* \brief Sawtoothdown wave effect supported.
|
||||
|
@ -199,7 +199,7 @@ typedef struct _SDL_Haptic SDL_Haptic;
|
|||
*
|
||||
* \sa SDL_HapticPeriodic
|
||||
*/
|
||||
#define SDL_HAPTIC_SAWTOOTHDOWN (1<<5)
|
||||
#define SDL_HAPTIC_SAWTOOTHDOWN (1u<<5)
|
||||
|
||||
/**
|
||||
* \brief Ramp effect supported.
|
||||
|
@ -208,7 +208,7 @@ typedef struct _SDL_Haptic SDL_Haptic;
|
|||
*
|
||||
* \sa SDL_HapticRamp
|
||||
*/
|
||||
#define SDL_HAPTIC_RAMP (1<<6)
|
||||
#define SDL_HAPTIC_RAMP (1u<<6)
|
||||
|
||||
/**
|
||||
* \brief Spring effect supported - uses axes position.
|
||||
|
@ -218,7 +218,7 @@ typedef struct _SDL_Haptic SDL_Haptic;
|
|||
*
|
||||
* \sa SDL_HapticCondition
|
||||
*/
|
||||
#define SDL_HAPTIC_SPRING (1<<7)
|
||||
#define SDL_HAPTIC_SPRING (1u<<7)
|
||||
|
||||
/**
|
||||
* \brief Damper effect supported - uses axes velocity.
|
||||
|
@ -228,7 +228,7 @@ typedef struct _SDL_Haptic SDL_Haptic;
|
|||
*
|
||||
* \sa SDL_HapticCondition
|
||||
*/
|
||||
#define SDL_HAPTIC_DAMPER (1<<8)
|
||||
#define SDL_HAPTIC_DAMPER (1u<<8)
|
||||
|
||||
/**
|
||||
* \brief Inertia effect supported - uses axes acceleration.
|
||||
|
@ -238,7 +238,7 @@ typedef struct _SDL_Haptic SDL_Haptic;
|
|||
*
|
||||
* \sa SDL_HapticCondition
|
||||
*/
|
||||
#define SDL_HAPTIC_INERTIA (1<<9)
|
||||
#define SDL_HAPTIC_INERTIA (1u<<9)
|
||||
|
||||
/**
|
||||
* \brief Friction effect supported - uses axes movement.
|
||||
|
@ -248,14 +248,14 @@ typedef struct _SDL_Haptic SDL_Haptic;
|
|||
*
|
||||
* \sa SDL_HapticCondition
|
||||
*/
|
||||
#define SDL_HAPTIC_FRICTION (1<<10)
|
||||
#define SDL_HAPTIC_FRICTION (1u<<10)
|
||||
|
||||
/**
|
||||
* \brief Custom effect is supported.
|
||||
*
|
||||
* User defined custom haptic effect.
|
||||
*/
|
||||
#define SDL_HAPTIC_CUSTOM (1<<11)
|
||||
#define SDL_HAPTIC_CUSTOM (1u<<11)
|
||||
|
||||
/* @} *//* Haptic effects */
|
||||
|
||||
|
@ -268,7 +268,7 @@ typedef struct _SDL_Haptic SDL_Haptic;
|
|||
*
|
||||
* \sa SDL_HapticSetGain
|
||||
*/
|
||||
#define SDL_HAPTIC_GAIN (1<<12)
|
||||
#define SDL_HAPTIC_GAIN (1u<<12)
|
||||
|
||||
/**
|
||||
* \brief Device can set autocenter.
|
||||
|
@ -277,24 +277,26 @@ typedef struct _SDL_Haptic SDL_Haptic;
|
|||
*
|
||||
* \sa SDL_HapticSetAutocenter
|
||||
*/
|
||||
#define SDL_HAPTIC_AUTOCENTER (1<<13)
|
||||
#define SDL_HAPTIC_AUTOCENTER (1u<<13)
|
||||
|
||||
/**
|
||||
* \brief Device can be queried for effect status.
|
||||
*
|
||||
* Device can be queried for effect status.
|
||||
* Device supports querying effect status.
|
||||
*
|
||||
* \sa SDL_HapticGetEffectStatus
|
||||
*/
|
||||
#define SDL_HAPTIC_STATUS (1<<14)
|
||||
#define SDL_HAPTIC_STATUS (1u<<14)
|
||||
|
||||
/**
|
||||
* \brief Device can be paused.
|
||||
*
|
||||
* Devices supports being paused.
|
||||
*
|
||||
* \sa SDL_HapticPause
|
||||
* \sa SDL_HapticUnpause
|
||||
*/
|
||||
#define SDL_HAPTIC_PAUSE (1<<15)
|
||||
#define SDL_HAPTIC_PAUSE (1u<<15)
|
||||
|
||||
|
||||
/**
|
||||
|
@ -444,7 +446,7 @@ typedef struct SDL_HapticDirection
|
|||
/**
|
||||
* \brief A structure containing a template for a Constant effect.
|
||||
*
|
||||
* The struct is exclusive to the ::SDL_HAPTIC_CONSTANT effect.
|
||||
* This struct is exclusively for the ::SDL_HAPTIC_CONSTANT effect.
|
||||
*
|
||||
* A constant effect applies a constant force in the specified direction
|
||||
* to the joystick.
|
||||
|
@ -676,6 +678,8 @@ typedef struct SDL_HapticLeftRight
|
|||
/**
|
||||
* \brief A structure containing a template for the ::SDL_HAPTIC_CUSTOM effect.
|
||||
*
|
||||
* This struct is exclusively for the ::SDL_HAPTIC_CUSTOM effect.
|
||||
*
|
||||
* A custom force feedback effect is much like a periodic effect, where the
|
||||
* application can define its exact shape. You will have to allocate the
|
||||
* data yourself. Data should consist of channels * samples Uint16 samples.
|
||||
|
@ -804,7 +808,7 @@ typedef union SDL_HapticEffect
|
|||
extern DECLSPEC int SDLCALL SDL_NumHaptics(void);
|
||||
|
||||
/**
|
||||
* \brief Get the implementation dependent name of a Haptic device.
|
||||
* \brief 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.
|
||||
|
@ -817,9 +821,9 @@ extern DECLSPEC int SDLCALL SDL_NumHaptics(void);
|
|||
extern DECLSPEC const char *SDLCALL SDL_HapticName(int device_index);
|
||||
|
||||
/**
|
||||
* \brief Opens a Haptic device for usage.
|
||||
* \brief Opens a haptic device for use.
|
||||
*
|
||||
* The index passed as an argument refers to the N'th Haptic device on this
|
||||
* The index passed as an argument refers to the N'th haptic device on this
|
||||
* system.
|
||||
*
|
||||
* When opening a haptic device, its gain will be set to maximum and
|
||||
|
@ -885,15 +889,15 @@ extern DECLSPEC SDL_Haptic *SDLCALL SDL_HapticOpenFromMouse(void);
|
|||
* \brief Checks to see if a joystick has haptic features.
|
||||
*
|
||||
* \param joystick Joystick to test for haptic capabilities.
|
||||
* \return 1 if the joystick is haptic, 0 if it isn't
|
||||
* or -1 if an error ocurred.
|
||||
* \return SDL_TRUE if the joystick is haptic, SDL_FALSE if it isn't
|
||||
* or -1 if an error occurred.
|
||||
*
|
||||
* \sa SDL_HapticOpenFromJoystick
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_JoystickIsHaptic(SDL_Joystick * joystick);
|
||||
|
||||
/**
|
||||
* \brief Opens a Haptic device for usage from a Joystick device.
|
||||
* \brief Opens a haptic device for use from a joystick device.
|
||||
*
|
||||
* You must still close the haptic device separately. It will not be closed
|
||||
* with the joystick.
|
||||
|
@ -913,7 +917,7 @@ extern DECLSPEC SDL_Haptic *SDLCALL SDL_HapticOpenFromJoystick(SDL_Joystick *
|
|||
joystick);
|
||||
|
||||
/**
|
||||
* \brief Closes a Haptic device previously opened with SDL_HapticOpen().
|
||||
* \brief Closes a haptic device previously opened with SDL_HapticOpen().
|
||||
*
|
||||
* \param haptic Haptic device to close.
|
||||
*/
|
||||
|
@ -957,7 +961,7 @@ extern DECLSPEC int SDLCALL SDL_HapticNumEffectsPlaying(SDL_Haptic * haptic);
|
|||
* Example:
|
||||
* \code
|
||||
* if (SDL_HapticQuery(haptic) & SDL_HAPTIC_CONSTANT) {
|
||||
* printf("We have constant haptic effect!");
|
||||
* printf("We have constant haptic effect!\n");
|
||||
* }
|
||||
* \endcode
|
||||
*
|
||||
|
@ -996,7 +1000,7 @@ extern DECLSPEC int SDLCALL SDL_HapticEffectSupported(SDL_Haptic * haptic,
|
|||
*
|
||||
* \param haptic Haptic device to create the effect on.
|
||||
* \param effect Properties of the effect to create.
|
||||
* \return The id of the effect on success or -1 on error.
|
||||
* \return The identifier of the effect on success or -1 on error.
|
||||
*
|
||||
* \sa SDL_HapticUpdateEffect
|
||||
* \sa SDL_HapticRunEffect
|
||||
|
@ -1008,13 +1012,13 @@ extern DECLSPEC int SDLCALL SDL_HapticNewEffect(SDL_Haptic * haptic,
|
|||
/**
|
||||
* \brief Updates the properties of an effect.
|
||||
*
|
||||
* Can be used dynamically, although behaviour when dynamically changing
|
||||
* Can be used dynamically, although behavior when dynamically changing
|
||||
* direction may be strange. Specifically the effect may reupload itself
|
||||
* and start playing from the start. You cannot change the type either when
|
||||
* running SDL_HapticUpdateEffect().
|
||||
*
|
||||
* \param haptic Haptic device that has the effect.
|
||||
* \param effect Effect to update.
|
||||
* \param effect Identifier of the effect to update.
|
||||
* \param data New effect properties to use.
|
||||
* \return 0 on success or -1 on error.
|
||||
*
|
||||
|
@ -1218,6 +1222,6 @@ extern DECLSPEC int SDLCALL SDL_HapticRumbleStop(SDL_Haptic * haptic);
|
|||
#endif
|
||||
#include "close_code.h"
|
||||
|
||||
#endif /* _SDL_haptic_h */
|
||||
#endif /* SDL_haptic_h_ */
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue