upgrade SDL3 to d4b80726142d9108f16d4806c09779d612501608

This commit is contained in:
Alex Zenla
2024-09-01 07:26:53 -04:00
committed by a dinosaur
parent f2031ac442
commit fbf66585eb
226 changed files with 24489 additions and 11757 deletions

View File

@ -48,15 +48,15 @@
* SDL_free(haptics);
* }
* if (haptic == NULL)
* return -1;
* return;
*
* // Initialize simple rumble
* if (SDL_InitHapticRumble(haptic) != 0)
* return -1;
* if (!SDL_InitHapticRumble(haptic))
* return;
*
* // Play effect at 50% strength for 2 seconds
* if (SDL_PlayHapticRumble(haptic, 0.5, 2000) != 0)
* return -1;
* if (!SDL_PlayHapticRumble(haptic, 0.5, 2000))
* return;
* SDL_Delay(2000);
*
* // Clean up
@ -66,7 +66,7 @@
* Complete example:
*
* ```c
* int test_haptic(SDL_Joystick *joystick)
* SDL_bool test_haptic(SDL_Joystick *joystick)
* {
* SDL_Haptic *haptic;
* SDL_HapticEffect effect;
@ -74,12 +74,12 @@
*
* // Open the device
* haptic = SDL_OpenHapticFromJoystick(joystick);
* if (haptic == NULL) return -1; // Most likely joystick isn't haptic
* if (haptic == NULL) return SDL_FALSE; // Most likely joystick isn't haptic
*
* // See if it can do sine waves
* if ((SDL_GetHapticFeatures(haptic) & SDL_HAPTIC_SINE)==0) {
* SDL_CloseHaptic(haptic); // No sine effect
* return -1;
* return SDL_FALSE;
* }
*
* // Create the effect
@ -106,7 +106,7 @@
* // Close the device
* SDL_CloseHaptic(haptic);
*
* return 0; // Success
* return SDL_TRUE; // Success
* }
* ```
*
@ -919,8 +919,7 @@ typedef union SDL_HapticEffect
*
* 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.
* The value 0 is an invalid ID.
*
* \since This datatype is available since SDL 3.0.0.
*/
@ -1117,8 +1116,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_GetMaxHapticEffects(SDL_Haptic *haptic);
*
* \param haptic the SDL_Haptic device to query maximum playing effects.
* \returns the number of effects the haptic device can play at the same time
* or a negative error code on failure; call SDL_GetError() for more
* information.
* or -1 on failure; call SDL_GetError() for more information.
*
* \since This function is available since SDL 3.0.0.
*
@ -1148,8 +1146,8 @@ extern SDL_DECLSPEC Uint32 SDLCALL SDL_GetHapticFeatures(SDL_Haptic *haptic);
* SDL_HapticDirection effect.
*
* \param haptic the SDL_Haptic device to query.
* \returns the number of axes on success or a negative error code on failure;
* call SDL_GetError() for more information.
* \returns the number of axes on success or -1 on failure; call
* SDL_GetError() for more information.
*
* \since This function is available since SDL 3.0.0.
*/
@ -1175,8 +1173,8 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_HapticEffectSupported(SDL_Haptic *hapti
* \param haptic an SDL_Haptic device to create the effect on.
* \param effect an SDL_HapticEffect structure containing the properties of
* the effect to create.
* \returns the ID of the effect on success or a negative error code on
* failure; call SDL_GetError() for more information.
* \returns the ID of the effect on success or -1 on failure; call
* SDL_GetError() for more information.
*
* \since This function is available since SDL 3.0.0.
*
@ -1198,15 +1196,15 @@ extern SDL_DECLSPEC int SDLCALL SDL_CreateHapticEffect(SDL_Haptic *haptic, const
* \param effect the identifier of the effect to update.
* \param data an SDL_HapticEffect structure containing the new effect
* properties to use.
* \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information.
* \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError()
* for more information.
*
* \since This function is available since SDL 3.0.0.
*
* \sa SDL_CreateHapticEffect
* \sa SDL_RunHapticEffect
*/
extern SDL_DECLSPEC int SDLCALL SDL_UpdateHapticEffect(SDL_Haptic *haptic, int effect, const SDL_HapticEffect *data);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_UpdateHapticEffect(SDL_Haptic *haptic, int effect, const SDL_HapticEffect *data);
/**
* Run the haptic effect on its associated haptic device.
@ -1221,8 +1219,8 @@ extern SDL_DECLSPEC int SDLCALL SDL_UpdateHapticEffect(SDL_Haptic *haptic, int e
* \param effect the ID of the haptic effect to run.
* \param iterations the number of iterations to run the effect; use
* `SDL_HAPTIC_INFINITY` to repeat forever.
* \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information.
* \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError()
* for more information.
*
* \since This function is available since SDL 3.0.0.
*
@ -1230,22 +1228,22 @@ extern SDL_DECLSPEC int SDLCALL SDL_UpdateHapticEffect(SDL_Haptic *haptic, int e
* \sa SDL_StopHapticEffect
* \sa SDL_StopHapticEffects
*/
extern SDL_DECLSPEC int SDLCALL SDL_RunHapticEffect(SDL_Haptic *haptic, int effect, Uint32 iterations);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_RunHapticEffect(SDL_Haptic *haptic, int effect, Uint32 iterations);
/**
* Stop the haptic effect on its associated haptic device.
*
* \param haptic the SDL_Haptic device to stop the effect on.
* \param effect the ID of the haptic effect to stop.
* \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information.
* \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError()
* for more information.
*
* \since This function is available since SDL 3.0.0.
*
* \sa SDL_RunHapticEffect
* \sa SDL_StopHapticEffects
*/
extern SDL_DECLSPEC int SDLCALL SDL_StopHapticEffect(SDL_Haptic *haptic, int effect);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_StopHapticEffect(SDL_Haptic *haptic, int effect);
/**
* Destroy a haptic effect on the device.
@ -1269,12 +1267,14 @@ extern SDL_DECLSPEC void SDLCALL SDL_DestroyHapticEffect(SDL_Haptic *haptic, int
*
* \param haptic the SDL_Haptic device to query for the effect status on.
* \param effect the ID of the haptic effect to query its status.
* \returns 0 if it isn't playing, 1 if it is playing, or a negative error
* code on failure; call SDL_GetError() for more information.
* \returns SDL_TRUE if it is playing, SDL_FALSE if it isn't playing or haptic
* status isn't supported.
*
* \since This function is available since SDL 3.0.0.
*
* \sa SDL_GetHapticFeatures
*/
extern SDL_DECLSPEC int SDLCALL SDL_GetHapticEffectStatus(SDL_Haptic *haptic, int effect);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetHapticEffectStatus(SDL_Haptic *haptic, int effect);
/**
* Set the global gain of the specified haptic device.
@ -1289,14 +1289,14 @@ extern SDL_DECLSPEC int SDLCALL SDL_GetHapticEffectStatus(SDL_Haptic *haptic, in
* \param haptic the SDL_Haptic device to set the gain on.
* \param gain value to set the gain to, should be between 0 and 100 (0 -
* 100).
* \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information.
* \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError()
* for more information.
*
* \since This function is available since SDL 3.0.0.
*
* \sa SDL_GetHapticFeatures
*/
extern SDL_DECLSPEC int SDLCALL SDL_SetHapticGain(SDL_Haptic *haptic, int gain);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetHapticGain(SDL_Haptic *haptic, int gain);
/**
* Set the global autocenter of the device.
@ -1308,14 +1308,14 @@ extern SDL_DECLSPEC int SDLCALL SDL_SetHapticGain(SDL_Haptic *haptic, int gain);
*
* \param haptic the SDL_Haptic device to set autocentering on.
* \param autocenter value to set autocenter to (0-100).
* \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information.
* \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError()
* for more information.
*
* \since This function is available since SDL 3.0.0.
*
* \sa SDL_GetHapticFeatures
*/
extern SDL_DECLSPEC int SDLCALL SDL_SetHapticAutocenter(SDL_Haptic *haptic, int autocenter);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetHapticAutocenter(SDL_Haptic *haptic, int autocenter);
/**
* Pause a haptic device.
@ -1327,14 +1327,14 @@ extern SDL_DECLSPEC int SDLCALL SDL_SetHapticAutocenter(SDL_Haptic *haptic, int
* can cause all sorts of weird errors.
*
* \param haptic the SDL_Haptic device to pause.
* \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information.
* \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError()
* for more information.
*
* \since This function is available since SDL 3.0.0.
*
* \sa SDL_ResumeHaptic
*/
extern SDL_DECLSPEC int SDLCALL SDL_PauseHaptic(SDL_Haptic *haptic);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_PauseHaptic(SDL_Haptic *haptic);
/**
* Resume a haptic device.
@ -1342,28 +1342,28 @@ extern SDL_DECLSPEC int SDLCALL SDL_PauseHaptic(SDL_Haptic *haptic);
* 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
* SDL_GetError() for more information.
* \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError()
* for more information.
*
* \since This function is available since SDL 3.0.0.
*
* \sa SDL_PauseHaptic
*/
extern SDL_DECLSPEC int SDLCALL SDL_ResumeHaptic(SDL_Haptic *haptic);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_ResumeHaptic(SDL_Haptic *haptic);
/**
* Stop all the currently playing effects on a haptic device.
*
* \param haptic the SDL_Haptic device to stop.
* \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information.
* \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError()
* for more information.
*
* \since This function is available since SDL 3.0.0.
*
* \sa SDL_RunHapticEffect
* \sa SDL_StopHapticEffects
*/
extern SDL_DECLSPEC int SDLCALL SDL_StopHapticEffects(SDL_Haptic *haptic);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_StopHapticEffects(SDL_Haptic *haptic);
/**
* Check whether rumble is supported on a haptic device.
@ -1381,8 +1381,8 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_HapticRumbleSupported(SDL_Haptic *hapti
* Initialize a haptic device for simple rumble playback.
*
* \param haptic the haptic device to initialize for simple rumble playback.
* \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information.
* \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError()
* for more information.
*
* \since This function is available since SDL 3.0.0.
*
@ -1390,7 +1390,7 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_HapticRumbleSupported(SDL_Haptic *hapti
* \sa SDL_StopHapticRumble
* \sa SDL_HapticRumbleSupported
*/
extern SDL_DECLSPEC int SDLCALL SDL_InitHapticRumble(SDL_Haptic *haptic);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_InitHapticRumble(SDL_Haptic *haptic);
/**
* Run a simple rumble effect on a haptic device.
@ -1398,28 +1398,28 @@ extern SDL_DECLSPEC int SDLCALL SDL_InitHapticRumble(SDL_Haptic *haptic);
* \param haptic the haptic device to play the rumble effect on.
* \param strength strength of the rumble to play as a 0-1 float value.
* \param length length of the rumble to play in milliseconds.
* \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information.
* \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError()
* for more information.
*
* \since This function is available since SDL 3.0.0.
*
* \sa SDL_InitHapticRumble
* \sa SDL_StopHapticRumble
*/
extern SDL_DECLSPEC int SDLCALL SDL_PlayHapticRumble(SDL_Haptic *haptic, float strength, Uint32 length);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_PlayHapticRumble(SDL_Haptic *haptic, float strength, Uint32 length);
/**
* Stop the simple rumble on a haptic device.
*
* \param haptic the haptic device to stop the rumble effect on.
* \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information.
* \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError()
* for more information.
*
* \since This function is available since SDL 3.0.0.
*
* \sa SDL_PlayHapticRumble
*/
extern SDL_DECLSPEC int SDLCALL SDL_StopHapticRumble(SDL_Haptic *haptic);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_StopHapticRumble(SDL_Haptic *haptic);
/* Ends C function definitions when using C++ */
#ifdef __cplusplus