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

@ -4,49 +4,6 @@
<dict>
<key>AvailableLibraries</key>
<array>
<dict>
<key>BinaryPath</key>
<string>SDL3.framework/SDL3</string>
<key>LibraryIdentifier</key>
<string>tvos-arm64</string>
<key>LibraryPath</key>
<string>SDL3.framework</string>
<key>SupportedArchitectures</key>
<array>
<string>arm64</string>
</array>
<key>SupportedPlatform</key>
<string>tvos</string>
</dict>
<dict>
<key>BinaryPath</key>
<string>SDL3.framework/Versions/A/SDL3</string>
<key>LibraryIdentifier</key>
<string>macos-arm64_x86_64</string>
<key>LibraryPath</key>
<string>SDL3.framework</string>
<key>SupportedArchitectures</key>
<array>
<string>arm64</string>
<string>x86_64</string>
</array>
<key>SupportedPlatform</key>
<string>macos</string>
</dict>
<dict>
<key>BinaryPath</key>
<string>SDL3.framework/SDL3</string>
<key>LibraryIdentifier</key>
<string>ios-arm64</string>
<key>LibraryPath</key>
<string>SDL3.framework</string>
<key>SupportedArchitectures</key>
<array>
<string>arm64</string>
</array>
<key>SupportedPlatform</key>
<string>ios</string>
</dict>
<dict>
<key>BinaryPath</key>
<string>SDL3.framework/SDL3</string>
@ -64,6 +21,34 @@
<key>SupportedPlatformVariant</key>
<string>simulator</string>
</dict>
<dict>
<key>BinaryPath</key>
<string>SDL3.framework/SDL3</string>
<key>LibraryIdentifier</key>
<string>ios-arm64</string>
<key>LibraryPath</key>
<string>SDL3.framework</string>
<key>SupportedArchitectures</key>
<array>
<string>arm64</string>
</array>
<key>SupportedPlatform</key>
<string>ios</string>
</dict>
<dict>
<key>BinaryPath</key>
<string>SDL3.framework/SDL3</string>
<key>LibraryIdentifier</key>
<string>tvos-arm64</string>
<key>LibraryPath</key>
<string>SDL3.framework</string>
<key>SupportedArchitectures</key>
<array>
<string>arm64</string>
</array>
<key>SupportedPlatform</key>
<string>tvos</string>
</dict>
<dict>
<key>BinaryPath</key>
<string>SDL3.framework/SDL3</string>
@ -81,6 +66,21 @@
<key>SupportedPlatformVariant</key>
<string>simulator</string>
</dict>
<dict>
<key>BinaryPath</key>
<string>SDL3.framework/Versions/A/SDL3</string>
<key>LibraryIdentifier</key>
<string>macos-arm64_x86_64</string>
<key>LibraryPath</key>
<string>SDL3.framework</string>
<key>SupportedArchitectures</key>
<array>
<string>arm64</string>
<string>x86_64</string>
</array>
<key>SupportedPlatform</key>
<string>macos</string>
</dict>
</array>
<key>CFBundlePackageType</key>
<string>XFWK</string>

View File

@ -43,6 +43,7 @@
#include <SDL3/SDL_events.h>
#include <SDL3/SDL_filesystem.h>
#include <SDL3/SDL_gamepad.h>
#include <SDL3/SDL_gpu.h>
#include <SDL3/SDL_guid.h>
#include <SDL3/SDL_haptic.h>
#include <SDL3/SDL_hidapi.h>

View File

@ -303,9 +303,6 @@ extern SDL_DECLSPEC SDL_AssertState SDLCALL SDL_ReportAssertion(SDL_AssertData *
* "break" so that your debugger takes control as soon as assert is triggered,
* instead of risking a bad UI interaction (deadlock, etc) in the application.
*
* Note that SDL_ASSERT is an _environment variable_ and not an SDL hint!
* Please refer to your platform's documentation for how to set it!
*
* \param condition boolean value to test.
*
* \since This macro is available since SDL 3.0.0.
@ -335,9 +332,7 @@ extern SDL_DECLSPEC SDL_AssertState SDLCALL SDL_ReportAssertion(SDL_AssertData *
* an assertion in a background thread, it might be desirable to set this to
* "break" so that your debugger takes control as soon as assert is triggered,
* instead of risking a bad UI interaction (deadlock, etc) in the application.
*
* Note that SDL_ASSERT is an _environment variable_ and not an SDL hint!
* Please refer to your platform's documentation for how to set it!
* *
*
* \param condition boolean value to test.
*
@ -366,18 +361,14 @@ extern SDL_DECLSPEC SDL_AssertState SDLCALL SDL_ReportAssertion(SDL_AssertData *
* "break" so that your debugger takes control as soon as assert is triggered,
* instead of risking a bad UI interaction (deadlock, etc) in the application.
*
* Note that SDL_ASSERT is an _environment variable_ and not an SDL hint!
* Please refer to your platform's documentation for how to set it!
*
* \param condition boolean value to test.
*
* \since This macro is available since SDL 3.0.0.
*/
#define SDL_assert_paranoid(condition) SDL_disabled_assert(condition)
#endif
/* Enable various levels of assertions. */
#if SDL_ASSERT_LEVEL == 0 /* assertions disabled */
#elif SDL_ASSERT_LEVEL == 0 /* assertions disabled */
# define SDL_assert(condition) SDL_disabled_assert(condition)
# define SDL_assert_release(condition) SDL_disabled_assert(condition)
# define SDL_assert_paranoid(condition) SDL_disabled_assert(condition)
@ -412,9 +403,6 @@ extern SDL_DECLSPEC SDL_AssertState SDLCALL SDL_ReportAssertion(SDL_AssertData *
* "break" so that your debugger takes control as soon as assert is triggered,
* instead of risking a bad UI interaction (deadlock, etc) in the application.
*
* Note that SDL_ASSERT is an _environment variable_ and not an SDL hint!
* Please refer to your platform's documentation for how to set it!
*
* \param condition boolean value to test.
*
* \since This macro is available since SDL 3.0.0.

View File

@ -455,8 +455,8 @@ extern SDL_DECLSPEC int SDLCALL SDL_AtomicAdd(SDL_AtomicInt *a, int v);
* \since This function is available since SDL 3.0.0.
*
* \sa SDL_AtomicCompareAndSwap
* \sa SDL_AtomicGetPtr
* \sa SDL_AtomicSetPtr
* \sa SDL_AtomicGetPointer
* \sa SDL_AtomicSetPointer
*/
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_AtomicCompareAndSwapPointer(void **a, void *oldval, void *newval);
@ -475,9 +475,9 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_AtomicCompareAndSwapPointer(void **a, v
* \since This function is available since SDL 3.0.0.
*
* \sa SDL_AtomicCompareAndSwapPointer
* \sa SDL_AtomicGetPtr
* \sa SDL_AtomicGetPointer
*/
extern SDL_DECLSPEC void * SDLCALL SDL_AtomicSetPtr(void **a, void *v);
extern SDL_DECLSPEC void * SDLCALL SDL_AtomicSetPointer(void **a, void *v);
/**
* Get the value of a pointer atomically.
@ -493,9 +493,9 @@ extern SDL_DECLSPEC void * SDLCALL SDL_AtomicSetPtr(void **a, void *v);
* \since This function is available since SDL 3.0.0.
*
* \sa SDL_AtomicCompareAndSwapPointer
* \sa SDL_AtomicSetPtr
* \sa SDL_AtomicSetPointer
*/
extern SDL_DECLSPEC void * SDLCALL SDL_AtomicGetPtr(void **a);
extern SDL_DECLSPEC void * SDLCALL SDL_AtomicGetPointer(void **a);
/* Ends C function definitions when using C++ */
#ifdef __cplusplus

View File

@ -127,6 +127,7 @@ extern "C" {
*/
typedef enum SDL_AudioFormat
{
SDL_AUDIO_UNKNOWN = 0x0000u, /**< Unspecified audio format */
SDL_AUDIO_U8 = 0x0008u, /**< Unsigned 8-bit samples */
/* SDL_DEFINE_AUDIO_FORMAT(0, 0, 0, 8), */
SDL_AUDIO_S8 = 0x8008u, /**< Signed 8-bit samples */
@ -531,14 +532,14 @@ extern SDL_DECLSPEC const char * SDLCALL SDL_GetAudioDeviceName(SDL_AudioDeviceI
* \param spec on return, will be filled with device details.
* \param sample_frames pointer to store device buffer size, in sample frames.
* Can be NULL.
* \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.
*
* \threadsafety It is safe to call this function from any thread.
*
* \since This function is available since SDL 3.0.0.
*/
extern SDL_DECLSPEC int SDLCALL SDL_GetAudioDeviceFormat(SDL_AudioDeviceID devid, SDL_AudioSpec *spec, int *sample_frames);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetAudioDeviceFormat(SDL_AudioDeviceID devid, SDL_AudioSpec *spec, int *sample_frames);
/**
* Get the current channel map of an audio device.
@ -658,8 +659,8 @@ extern SDL_DECLSPEC SDL_AudioDeviceID SDLCALL SDL_OpenAudioDevice(SDL_AudioDevic
* created through SDL_OpenAudioDevice() can be.
*
* \param dev a device opened by SDL_OpenAudioDevice().
* \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.
*
* \threadsafety It is safe to call this function from any thread.
*
@ -668,7 +669,7 @@ extern SDL_DECLSPEC SDL_AudioDeviceID SDLCALL SDL_OpenAudioDevice(SDL_AudioDevic
* \sa SDL_ResumeAudioDevice
* \sa SDL_AudioDevicePaused
*/
extern SDL_DECLSPEC int SDLCALL SDL_PauseAudioDevice(SDL_AudioDeviceID dev);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_PauseAudioDevice(SDL_AudioDeviceID dev);
/**
* Use this function to unpause audio playback on a specified device.
@ -686,8 +687,8 @@ extern SDL_DECLSPEC int SDLCALL SDL_PauseAudioDevice(SDL_AudioDeviceID dev);
* created through SDL_OpenAudioDevice() can be.
*
* \param dev a device opened by SDL_OpenAudioDevice().
* \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.
*
* \threadsafety It is safe to call this function from any thread.
*
@ -696,7 +697,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_PauseAudioDevice(SDL_AudioDeviceID dev);
* \sa SDL_AudioDevicePaused
* \sa SDL_PauseAudioDevice
*/
extern SDL_DECLSPEC int SDLCALL SDL_ResumeAudioDevice(SDL_AudioDeviceID dev);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_ResumeAudioDevice(SDL_AudioDeviceID dev);
/**
* Use this function to query if an audio device is paused.
@ -766,8 +767,8 @@ extern SDL_DECLSPEC float SDLCALL SDL_GetAudioDeviceGain(SDL_AudioDeviceID devid
*
* \param devid the audio device on which to change gain.
* \param gain the gain. 1.0f is no change, 0.0f is silence.
* \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.
*
* \threadsafety It is safe to call this function from any thread, as it holds
* a stream-specific mutex while running.
@ -776,7 +777,7 @@ extern SDL_DECLSPEC float SDLCALL SDL_GetAudioDeviceGain(SDL_AudioDeviceID devid
*
* \sa SDL_GetAudioDeviceGain
*/
extern SDL_DECLSPEC int SDLCALL SDL_SetAudioDeviceGain(SDL_AudioDeviceID devid, float gain);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetAudioDeviceGain(SDL_AudioDeviceID devid, float gain);
/**
* Close a previously-opened audio device.
@ -823,8 +824,8 @@ extern SDL_DECLSPEC void SDLCALL SDL_CloseAudioDevice(SDL_AudioDeviceID devid);
* \param devid an audio device to bind a stream to.
* \param streams an array of audio streams to bind.
* \param num_streams number streams listed in the `streams` array.
* \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.
*
* \threadsafety It is safe to call this function from any thread.
*
@ -834,7 +835,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_CloseAudioDevice(SDL_AudioDeviceID devid);
* \sa SDL_UnbindAudioStream
* \sa SDL_GetAudioStreamDevice
*/
extern SDL_DECLSPEC int SDLCALL SDL_BindAudioStreams(SDL_AudioDeviceID devid, SDL_AudioStream **streams, int num_streams);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_BindAudioStreams(SDL_AudioDeviceID devid, SDL_AudioStream **streams, int num_streams);
/**
* Bind a single audio stream to an audio device.
@ -844,8 +845,8 @@ extern SDL_DECLSPEC int SDLCALL SDL_BindAudioStreams(SDL_AudioDeviceID devid, SD
*
* \param devid an audio device to bind a stream to.
* \param stream an audio stream to bind to a device.
* \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.
*
* \threadsafety It is safe to call this function from any thread.
*
@ -855,7 +856,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_BindAudioStreams(SDL_AudioDeviceID devid, SD
* \sa SDL_UnbindAudioStream
* \sa SDL_GetAudioStreamDevice
*/
extern SDL_DECLSPEC int SDLCALL SDL_BindAudioStream(SDL_AudioDeviceID devid, SDL_AudioStream *stream);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_BindAudioStream(SDL_AudioDeviceID devid, SDL_AudioStream *stream);
/**
* Unbind a list of audio streams from their audio devices.
@ -952,8 +953,8 @@ extern SDL_DECLSPEC SDL_PropertiesID SDLCALL SDL_GetAudioStreamProperties(SDL_Au
* \param stream the SDL_AudioStream to query.
* \param src_spec where to store the input audio format; ignored if NULL.
* \param dst_spec where to store the output audio format; ignored if NULL.
* \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.
*
* \threadsafety It is safe to call this function from any thread, as it holds
* a stream-specific mutex while running.
@ -962,9 +963,7 @@ extern SDL_DECLSPEC SDL_PropertiesID SDLCALL SDL_GetAudioStreamProperties(SDL_Au
*
* \sa SDL_SetAudioStreamFormat
*/
extern SDL_DECLSPEC int SDLCALL SDL_GetAudioStreamFormat(SDL_AudioStream *stream,
SDL_AudioSpec *src_spec,
SDL_AudioSpec *dst_spec);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetAudioStreamFormat(SDL_AudioStream *stream, SDL_AudioSpec *src_spec, SDL_AudioSpec *dst_spec);
/**
* Change the input and output formats of an audio stream.
@ -984,8 +983,8 @@ extern SDL_DECLSPEC int SDLCALL SDL_GetAudioStreamFormat(SDL_AudioStream *stream
* changed.
* \param dst_spec the new format of the audio output; if NULL, it is not
* changed.
* \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.
*
* \threadsafety It is safe to call this function from any thread, as it holds
* a stream-specific mutex while running.
@ -995,9 +994,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_GetAudioStreamFormat(SDL_AudioStream *stream
* \sa SDL_GetAudioStreamFormat
* \sa SDL_SetAudioStreamFrequencyRatio
*/
extern SDL_DECLSPEC int SDLCALL SDL_SetAudioStreamFormat(SDL_AudioStream *stream,
const SDL_AudioSpec *src_spec,
const SDL_AudioSpec *dst_spec);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetAudioStreamFormat(SDL_AudioStream *stream, const SDL_AudioSpec *src_spec, const SDL_AudioSpec *dst_spec);
/**
* Get the frequency ratio of an audio stream.
@ -1030,8 +1027,8 @@ extern SDL_DECLSPEC float SDLCALL SDL_GetAudioStreamFrequencyRatio(SDL_AudioStre
* \param stream the stream the frequency ratio is being changed.
* \param ratio the frequency ratio. 1.0 is normal speed. Must be between 0.01
* and 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.
*
* \threadsafety It is safe to call this function from any thread, as it holds
* a stream-specific mutex while running.
@ -1041,7 +1038,7 @@ extern SDL_DECLSPEC float SDLCALL SDL_GetAudioStreamFrequencyRatio(SDL_AudioStre
* \sa SDL_GetAudioStreamFrequencyRatio
* \sa SDL_SetAudioStreamFormat
*/
extern SDL_DECLSPEC int SDLCALL SDL_SetAudioStreamFrequencyRatio(SDL_AudioStream *stream, float ratio);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetAudioStreamFrequencyRatio(SDL_AudioStream *stream, float ratio);
/**
* Get the gain of an audio stream.
@ -1077,8 +1074,8 @@ extern SDL_DECLSPEC float SDLCALL SDL_GetAudioStreamGain(SDL_AudioStream *stream
*
* \param stream the stream on which the gain is being changed.
* \param gain the gain. 1.0f is no change, 0.0f is silence.
* \returns 0 on successor 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.
*
* \threadsafety It is safe to call this function from any thread, as it holds
* a stream-specific mutex while running.
@ -1087,7 +1084,7 @@ extern SDL_DECLSPEC float SDLCALL SDL_GetAudioStreamGain(SDL_AudioStream *stream
*
* \sa SDL_GetAudioStreamGain
*/
extern SDL_DECLSPEC int SDLCALL SDL_SetAudioStreamGain(SDL_AudioStream *stream, float gain);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetAudioStreamGain(SDL_AudioStream *stream, float gain);
/**
* Get the current input channel map of an audio stream.
@ -1174,8 +1171,8 @@ extern SDL_DECLSPEC int * SDLCALL SDL_GetAudioStreamOutputChannelMap(SDL_AudioSt
* \param stream the SDL_AudioStream to change.
* \param chmap the new channel map, NULL to reset to default.
* \param count The number of channels in the map.
* \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.
*
* \threadsafety It is safe to call this function from any thread, as it holds
* a stream-specific mutex while running. Don't change the
@ -1186,7 +1183,7 @@ extern SDL_DECLSPEC int * SDLCALL SDL_GetAudioStreamOutputChannelMap(SDL_AudioSt
*
* \sa SDL_SetAudioStreamInputChannelMap
*/
extern SDL_DECLSPEC int SDLCALL SDL_SetAudioStreamInputChannelMap(SDL_AudioStream *stream, const int *chmap, int count);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetAudioStreamInputChannelMap(SDL_AudioStream *stream, const int *chmap, int count);
/**
* Set the current output channel map of an audio stream.
@ -1221,8 +1218,8 @@ extern SDL_DECLSPEC int SDLCALL SDL_SetAudioStreamInputChannelMap(SDL_AudioStrea
* \param stream the SDL_AudioStream to change.
* \param chmap the new channel map, NULL to reset to default.
* \param count The number of channels in the map.
* \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.
*
* \threadsafety It is safe to call this function from any thread, as it holds
* a stream-specific mutex while running. Don't change the
@ -1233,7 +1230,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_SetAudioStreamInputChannelMap(SDL_AudioStrea
*
* \sa SDL_SetAudioStreamInputChannelMap
*/
extern SDL_DECLSPEC int SDLCALL SDL_SetAudioStreamOutputChannelMap(SDL_AudioStream *stream, const int *chmap, int count);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetAudioStreamOutputChannelMap(SDL_AudioStream *stream, const int *chmap, int count);
/**
* Add data to the stream.
@ -1249,8 +1246,8 @@ extern SDL_DECLSPEC int SDLCALL SDL_SetAudioStreamOutputChannelMap(SDL_AudioStre
* \param stream the stream the audio data is being added to.
* \param buf a pointer to the audio data to add.
* \param len the number of bytes to write to the stream.
* \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.
*
* \threadsafety It is safe to call this function from any thread, but if the
* stream has a callback set, the caller might need to manage
@ -1263,7 +1260,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_SetAudioStreamOutputChannelMap(SDL_AudioStre
* \sa SDL_GetAudioStreamData
* \sa SDL_GetAudioStreamQueued
*/
extern SDL_DECLSPEC int SDLCALL SDL_PutAudioStreamData(SDL_AudioStream *stream, const void *buf, int len);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_PutAudioStreamData(SDL_AudioStream *stream, const void *buf, int len);
/**
* Get converted/resampled data from the stream.
@ -1280,8 +1277,8 @@ extern SDL_DECLSPEC int SDLCALL SDL_PutAudioStreamData(SDL_AudioStream *stream,
* \param stream the stream the audio is being requested from.
* \param buf a buffer to fill with audio data.
* \param len the maximum number of bytes to fill.
* \returns the number of bytes read from the stream or a negative error code
* on failure; call SDL_GetError() for more information.
* \returns the number of bytes read from the stream or -1 on failure; call
* SDL_GetError() for more information.
*
* \threadsafety It is safe to call this function from any thread, but if the
* stream has a callback set, the caller might need to manage
@ -1309,7 +1306,8 @@ extern SDL_DECLSPEC int SDLCALL SDL_GetAudioStreamData(SDL_AudioStream *stream,
* clamped.
*
* \param stream the audio stream to query.
* \returns the number of converted/resampled bytes available.
* \returns the number of converted/resampled bytes available or -1 on
* failure; call SDL_GetError() for more information.
*
* \threadsafety It is safe to call this function from any thread.
*
@ -1341,7 +1339,8 @@ extern SDL_DECLSPEC int SDLCALL SDL_GetAudioStreamAvailable(SDL_AudioStream *str
* clamped.
*
* \param stream the audio stream to query.
* \returns the number of bytes queued.
* \returns the number of bytes queued or -1 on failure; call SDL_GetError()
* for more information.
*
* \threadsafety It is safe to call this function from any thread.
*
@ -1362,8 +1361,8 @@ extern SDL_DECLSPEC int SDLCALL SDL_GetAudioStreamQueued(SDL_AudioStream *stream
* input, so the complete output becomes available.
*
* \param stream the audio stream to flush.
* \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.
*
* \threadsafety It is safe to call this function from any thread.
*
@ -1371,7 +1370,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_GetAudioStreamQueued(SDL_AudioStream *stream
*
* \sa SDL_PutAudioStreamData
*/
extern SDL_DECLSPEC int SDLCALL SDL_FlushAudioStream(SDL_AudioStream *stream);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_FlushAudioStream(SDL_AudioStream *stream);
/**
* Clear any pending data in the stream.
@ -1380,8 +1379,8 @@ extern SDL_DECLSPEC int SDLCALL SDL_FlushAudioStream(SDL_AudioStream *stream);
* stream until more is added.
*
* \param stream the audio stream to clear.
* \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.
*
* \threadsafety It is safe to call this function from any thread.
*
@ -1392,7 +1391,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_FlushAudioStream(SDL_AudioStream *stream);
* \sa SDL_GetAudioStreamQueued
* \sa SDL_PutAudioStreamData
*/
extern SDL_DECLSPEC int SDLCALL SDL_ClearAudioStream(SDL_AudioStream *stream);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_ClearAudioStream(SDL_AudioStream *stream);
/**
* Use this function to pause audio playback on the audio device associated
@ -1407,8 +1406,8 @@ extern SDL_DECLSPEC int SDLCALL SDL_ClearAudioStream(SDL_AudioStream *stream);
* loading, etc.
*
* \param stream the audio stream associated with the audio 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.
*
* \threadsafety It is safe to call this function from any thread.
*
@ -1416,7 +1415,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_ClearAudioStream(SDL_AudioStream *stream);
*
* \sa SDL_ResumeAudioStreamDevice
*/
extern SDL_DECLSPEC int SDLCALL SDL_PauseAudioStreamDevice(SDL_AudioStream *stream);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_PauseAudioStreamDevice(SDL_AudioStream *stream);
/**
* Use this function to unpause audio playback on the audio device associated
@ -1427,8 +1426,8 @@ extern SDL_DECLSPEC int SDLCALL SDL_PauseAudioStreamDevice(SDL_AudioStream *stre
* to progress again, and audio can be generated.
*
* \param stream the audio stream associated with the audio device to resume.
* \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.
*
* \threadsafety It is safe to call this function from any thread.
*
@ -1436,7 +1435,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_PauseAudioStreamDevice(SDL_AudioStream *stre
*
* \sa SDL_PauseAudioStreamDevice
*/
extern SDL_DECLSPEC int SDLCALL SDL_ResumeAudioStreamDevice(SDL_AudioStream *stream);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_ResumeAudioStreamDevice(SDL_AudioStream *stream);
/**
* Lock an audio stream for serialized access.
@ -1455,8 +1454,8 @@ extern SDL_DECLSPEC int SDLCALL SDL_ResumeAudioStreamDevice(SDL_AudioStream *str
* all the same attributes (recursive locks are allowed, etc).
*
* \param stream the audio stream to lock.
* \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.
*
* \threadsafety It is safe to call this function from any thread.
*
@ -1464,7 +1463,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_ResumeAudioStreamDevice(SDL_AudioStream *str
*
* \sa SDL_UnlockAudioStream
*/
extern SDL_DECLSPEC int SDLCALL SDL_LockAudioStream(SDL_AudioStream *stream);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_LockAudioStream(SDL_AudioStream *stream);
/**
@ -1473,8 +1472,8 @@ extern SDL_DECLSPEC int SDLCALL SDL_LockAudioStream(SDL_AudioStream *stream);
* This unlocks an audio stream after a call to SDL_LockAudioStream.
*
* \param stream the audio stream to unlock.
* \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.
*
* \threadsafety You should only call this from the same thread that
* previously called SDL_LockAudioStream.
@ -1483,7 +1482,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_LockAudioStream(SDL_AudioStream *stream);
*
* \sa SDL_LockAudioStream
*/
extern SDL_DECLSPEC int SDLCALL SDL_UnlockAudioStream(SDL_AudioStream *stream);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_UnlockAudioStream(SDL_AudioStream *stream);
/**
* A callback that fires when data passes through an SDL_AudioStream.
@ -1558,13 +1557,12 @@ typedef void (SDLCALL *SDL_AudioStreamCallback)(void *userdata, SDL_AudioStream
* Setting a NULL function turns off the callback.
*
* \param stream the audio stream to set the new callback on.
* \param callback the new callback function to call when data is added to the
* stream.
* \param callback the new callback function to call when data is requested
* from the stream.
* \param userdata an opaque pointer provided to the callback for its own
* personal use.
* \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information. This only fails if `stream`
* is NULL.
* \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError()
* for more information. This only fails if `stream` is NULL.
*
* \threadsafety It is safe to call this function from any thread.
*
@ -1572,7 +1570,7 @@ typedef void (SDLCALL *SDL_AudioStreamCallback)(void *userdata, SDL_AudioStream
*
* \sa SDL_SetAudioStreamPutCallback
*/
extern SDL_DECLSPEC int SDLCALL SDL_SetAudioStreamGetCallback(SDL_AudioStream *stream, SDL_AudioStreamCallback callback, void *userdata);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetAudioStreamGetCallback(SDL_AudioStream *stream, SDL_AudioStreamCallback callback, void *userdata);
/**
* Set a callback that runs when data is added to an audio stream.
@ -1612,9 +1610,8 @@ extern SDL_DECLSPEC int SDLCALL SDL_SetAudioStreamGetCallback(SDL_AudioStream *s
* stream.
* \param userdata an opaque pointer provided to the callback for its own
* personal use.
* \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information. This only fails if `stream`
* is NULL.
* \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError()
* for more information. This only fails if `stream` is NULL.
*
* \threadsafety It is safe to call this function from any thread.
*
@ -1622,7 +1619,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_SetAudioStreamGetCallback(SDL_AudioStream *s
*
* \sa SDL_SetAudioStreamGetCallback
*/
extern SDL_DECLSPEC int SDLCALL SDL_SetAudioStreamPutCallback(SDL_AudioStream *stream, SDL_AudioStreamCallback callback, void *userdata);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetAudioStreamPutCallback(SDL_AudioStream *stream, SDL_AudioStreamCallback callback, void *userdata);
/**
@ -1791,14 +1788,14 @@ typedef void (SDLCALL *SDL_AudioPostmixCallback)(void *userdata, const SDL_Audio
* \param devid the ID of an opened audio device.
* \param callback a callback function to be called. Can be NULL.
* \param userdata app-controlled pointer passed to callback. Can be NULL.
* \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.
*
* \threadsafety It is safe to call this function from any thread.
*
* \since This function is available since SDL 3.0.0.
*/
extern SDL_DECLSPEC int SDLCALL SDL_SetAudioPostmixCallback(SDL_AudioDeviceID devid, SDL_AudioPostmixCallback callback, void *userdata);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetAudioPostmixCallback(SDL_AudioDeviceID devid, SDL_AudioPostmixCallback callback, void *userdata);
/**
@ -1861,13 +1858,13 @@ extern SDL_DECLSPEC int SDLCALL SDL_SetAudioPostmixCallback(SDL_AudioDeviceID de
* function.
* \param audio_len a pointer filled with the length of the audio data buffer
* in bytes.
* \returns 0 on success. `audio_buf` will be filled with a pointer to an
* allocated buffer containing the audio data, and `audio_len` is
* \returns SDL_TRUE on success. `audio_buf` will be filled with a pointer to
* an allocated buffer containing the audio data, and `audio_len` is
* filled with the length of that audio buffer in bytes.
*
* This function returns -1 if the .WAV file cannot be opened, uses
* an unknown data format, or is corrupt; call SDL_GetError() for
* more information.
* This function returns SDL_FALSE if the .WAV file cannot be opened,
* uses an unknown data format, or is corrupt; call SDL_GetError()
* for more information.
*
* When the application is done with the data returned in
* `audio_buf`, it should call SDL_free() to dispose of it.
@ -1879,9 +1876,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_SetAudioPostmixCallback(SDL_AudioDeviceID de
* \sa SDL_free
* \sa SDL_LoadWAV
*/
extern SDL_DECLSPEC int SDLCALL SDL_LoadWAV_IO(SDL_IOStream * src, SDL_bool closeio,
SDL_AudioSpec * spec, Uint8 ** audio_buf,
Uint32 * audio_len);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_LoadWAV_IO(SDL_IOStream *src, SDL_bool closeio, SDL_AudioSpec *spec, Uint8 **audio_buf, Uint32 *audio_len);
/**
* Loads a WAV from a file path.
@ -1889,7 +1884,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_LoadWAV_IO(SDL_IOStream * src, SDL_bool clos
* This is a convenience function that is effectively the same as:
*
* ```c
* SDL_LoadWAV_IO(SDL_IOFromFile(path, "rb"), 1, spec, audio_buf, audio_len);
* SDL_LoadWAV_IO(SDL_IOFromFile(path, "rb"), SDL_TRUE, spec, audio_buf, audio_len);
* ```
*
* \param path the file path of the WAV file to open.
@ -1899,13 +1894,13 @@ extern SDL_DECLSPEC int SDLCALL SDL_LoadWAV_IO(SDL_IOStream * src, SDL_bool clos
* function.
* \param audio_len a pointer filled with the length of the audio data buffer
* in bytes.
* \returns 0 on success. `audio_buf` will be filled with a pointer to an
* allocated buffer containing the audio data, and `audio_len` is
* \returns SDL_TRUE on success. `audio_buf` will be filled with a pointer to
* an allocated buffer containing the audio data, and `audio_len` is
* filled with the length of that audio buffer in bytes.
*
* This function returns -1 if the .WAV file cannot be opened, uses
* an unknown data format, or is corrupt; call SDL_GetError() for
* more information.
* This function returns SDL_FALSE if the .WAV file cannot be opened,
* uses an unknown data format, or is corrupt; call SDL_GetError()
* for more information.
*
* When the application is done with the data returned in
* `audio_buf`, it should call SDL_free() to dispose of it.
@ -1917,8 +1912,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_LoadWAV_IO(SDL_IOStream * src, SDL_bool clos
* \sa SDL_free
* \sa SDL_LoadWAV_IO
*/
extern SDL_DECLSPEC int SDLCALL SDL_LoadWAV(const char *path, SDL_AudioSpec * spec,
Uint8 ** audio_buf, Uint32 * audio_len);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_LoadWAV(const char *path, SDL_AudioSpec *spec, Uint8 **audio_buf, Uint32 *audio_len);
/**
* Mix audio data in a specified format.
@ -1947,17 +1941,14 @@ extern SDL_DECLSPEC int SDLCALL SDL_LoadWAV(const char *path, SDL_AudioSpec * sp
* \param len the length of the audio buffer in bytes.
* \param volume ranges from 0.0 - 1.0, and should be set to 1.0 for full
* audio volume.
* \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.
*
* \threadsafety It is safe to call this function from any thread.
*
* \since This function is available since SDL 3.0.0.
*/
extern SDL_DECLSPEC int SDLCALL SDL_MixAudio(Uint8 * dst,
const Uint8 * src,
SDL_AudioFormat format,
Uint32 len, float volume);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_MixAudio(Uint8 *dst, const Uint8 *src, SDL_AudioFormat format, Uint32 len, float volume);
/**
* Convert some audio data of one format to another format.
@ -1980,20 +1971,27 @@ extern SDL_DECLSPEC int SDLCALL SDL_MixAudio(Uint8 * dst,
* which should be freed with SDL_free(). On error, it will be
* NULL.
* \param dst_len will be filled with the len of dst_data.
* \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.
*
* \threadsafety It is safe to call this function from any thread.
*
* \since This function is available since SDL 3.0.0.
*/
extern SDL_DECLSPEC int SDLCALL SDL_ConvertAudioSamples(const SDL_AudioSpec *src_spec,
const Uint8 *src_data,
int src_len,
const SDL_AudioSpec *dst_spec,
Uint8 **dst_data,
int *dst_len);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_ConvertAudioSamples(const SDL_AudioSpec *src_spec, const Uint8 *src_data, int src_len, const SDL_AudioSpec *dst_spec, Uint8 **dst_data, int *dst_len);
/**
* Get the human readable name of an audio format.
*
* \param format the audio format to query.
* \returns the human readable name of the specified audio format or
* "SDL_AUDIO_UNKNOWN" if the format isn't recognized.
*
* \threadsafety It is safe to call this function from any thread.
*
* \since This function is available since SDL 3.0.0.
*/
extern SDL_DECLSPEC const char * SDLCALL SDL_GetAudioFormatName(SDL_AudioFormat format);
/**
* Get the appropriate memset value for silencing an audio format.

View File

@ -48,8 +48,7 @@ extern "C" {
*
* If the 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.
*
@ -367,15 +366,15 @@ extern SDL_DECLSPEC SDL_PropertiesID SDLCALL SDL_GetCameraProperties(SDL_Camera
* be converting to this format behind the scenes.
*
* If the system is waiting for the user to approve access to the camera, as
* some platforms require, this will return -1, but this isn't necessarily a
* fatal error; you should either wait for an SDL_EVENT_CAMERA_DEVICE_APPROVED
* (or SDL_EVENT_CAMERA_DEVICE_DENIED) event, or poll SDL_IsCameraApproved()
* occasionally until it returns non-zero.
* some platforms require, this will return SDL_FALSE, but this isn't
* necessarily a fatal error; you should either wait for an
* SDL_EVENT_CAMERA_DEVICE_APPROVED (or SDL_EVENT_CAMERA_DEVICE_DENIED) event,
* or poll SDL_IsCameraApproved() occasionally until it returns non-zero.
*
* \param camera opened camera device.
* \param spec the SDL_CameraSpec to be initialized by this function.
* \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.
*
* \threadsafety It is safe to call this function from any thread.
*
@ -383,7 +382,7 @@ extern SDL_DECLSPEC SDL_PropertiesID SDLCALL SDL_GetCameraProperties(SDL_Camera
*
* \sa SDL_OpenCamera
*/
extern SDL_DECLSPEC int SDLCALL SDL_GetCameraFormat(SDL_Camera *camera, SDL_CameraSpec *spec);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetCameraFormat(SDL_Camera *camera, SDL_CameraSpec *spec);
/**
* Acquire a frame.
@ -447,8 +446,6 @@ extern SDL_DECLSPEC SDL_Surface * SDLCALL SDL_AcquireCameraFrame(SDL_Camera *cam
*
* \param camera opened camera device.
* \param frame the video frame surface to release.
* \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information.
*
* \threadsafety It is safe to call this function from any thread.
*
@ -456,7 +453,7 @@ extern SDL_DECLSPEC SDL_Surface * SDLCALL SDL_AcquireCameraFrame(SDL_Camera *cam
*
* \sa SDL_AcquireCameraFrame
*/
extern SDL_DECLSPEC int SDLCALL SDL_ReleaseCameraFrame(SDL_Camera *camera, SDL_Surface *frame);
extern SDL_DECLSPEC void SDLCALL SDL_ReleaseCameraFrame(SDL_Camera *camera, SDL_Surface *frame);
/**
* Use this function to shut down camera processing and close the camera

View File

@ -46,15 +46,15 @@ extern "C" {
* Put UTF-8 text into the clipboard.
*
* \param text the text to store in the clipboard.
* \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_GetClipboardText
* \sa SDL_HasClipboardText
*/
extern SDL_DECLSPEC int SDLCALL SDL_SetClipboardText(const char *text);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetClipboardText(const char *text);
/**
* Get UTF-8 text from the clipboard.
@ -89,15 +89,15 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_HasClipboardText(void);
* Put UTF-8 text into the primary selection.
*
* \param text the text to store in the primary selection.
* \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_GetPrimarySelectionText
* \sa SDL_HasPrimarySelectionText
*/
extern SDL_DECLSPEC int SDLCALL SDL_SetPrimarySelectionText(const char *text);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetPrimarySelectionText(const char *text);
/**
* Get UTF-8 text from the primary selection.
@ -185,8 +185,8 @@ typedef void (SDLCALL *SDL_ClipboardCleanupCallback)(void *userdata);
* \param userdata an opaque pointer that will be forwarded to the callbacks.
* \param mime_types a list of mime-types that are being offered.
* \param num_mime_types the number of mime-types in the mime_types list.
* \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.
*
@ -194,19 +194,19 @@ typedef void (SDLCALL *SDL_ClipboardCleanupCallback)(void *userdata);
* \sa SDL_GetClipboardData
* \sa SDL_HasClipboardData
*/
extern SDL_DECLSPEC int SDLCALL SDL_SetClipboardData(SDL_ClipboardDataCallback callback, SDL_ClipboardCleanupCallback cleanup, void *userdata, const char **mime_types, size_t num_mime_types);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetClipboardData(SDL_ClipboardDataCallback callback, SDL_ClipboardCleanupCallback cleanup, void *userdata, const char **mime_types, size_t num_mime_types);
/**
* Clear the clipboard data.
*
* \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_SetClipboardData
*/
extern SDL_DECLSPEC int SDLCALL SDL_ClearClipboardData(void);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_ClearClipboardData(void);
/**
* Get the data from clipboard for a given mime type.

View File

@ -56,25 +56,25 @@ extern "C" {
* \param fmt a printf()-style message format string.
* \param ... additional parameters matching % tokens in the `fmt` string, if
* any.
* \returns -1.
* \returns SDL_FALSE.
*
* \since This function is available since SDL 3.0.0.
*
* \sa SDL_ClearError
* \sa SDL_GetError
*/
extern SDL_DECLSPEC int SDLCALL SDL_SetError(SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(1);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetError(SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(1);
/**
* Set an error indicating that memory allocation failed.
*
* This function does not do any memory allocation.
*
* \returns -1.
* \returns SDL_FALSE.
*
* \since This function is available since SDL 3.0.0.
*/
extern SDL_DECLSPEC int SDLCALL SDL_OutOfMemory(void);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_OutOfMemory(void);
/**
* Retrieve a message about the last error that occurred on the current
@ -114,14 +114,14 @@ extern SDL_DECLSPEC const char * SDLCALL SDL_GetError(void);
/**
* Clear any previous error message for this thread.
*
* \returns 0.
* \returns SDL_TRUE.
*
* \since This function is available since SDL 3.0.0.
*
* \sa SDL_GetError
* \sa SDL_SetError
*/
extern SDL_DECLSPEC int SDLCALL SDL_ClearError(void);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_ClearError(void);
/**
* \name Internal error functions

View File

@ -151,8 +151,6 @@ typedef enum SDL_EventType
in an event watcher, the window handle is still valid and can still be used to retrieve any userdata
associated with the window. Otherwise, the handle has already been destroyed and all resources
associated with it are invalid */
SDL_EVENT_WINDOW_PEN_ENTER, /**< Window has gained focus of the pressure-sensitive pen with ID "data1" */
SDL_EVENT_WINDOW_PEN_LEAVE, /**< Window has lost focus of the pressure-sensitive pen with ID "data1" */
SDL_EVENT_WINDOW_HDR_STATE_CHANGED, /**< Window HDR properties have changed */
SDL_EVENT_WINDOW_FIRST = SDL_EVENT_WINDOW_SHOWN,
SDL_EVENT_WINDOW_LAST = SDL_EVENT_WINDOW_HDR_STATE_CHANGED,
@ -227,11 +225,14 @@ typedef enum SDL_EventType
SDL_EVENT_SENSOR_UPDATE = 0x1200, /**< A sensor was updated */
/* Pressure-sensitive pen events */
SDL_EVENT_PEN_DOWN = 0x1300, /**< Pressure-sensitive pen touched drawing surface */
SDL_EVENT_PEN_PROXIMITY_IN = 0x1300, /**< Pressure-sensitive pen has become available */
SDL_EVENT_PEN_PROXIMITY_OUT, /**< Pressure-sensitive pen has become unavailable */
SDL_EVENT_PEN_DOWN, /**< Pressure-sensitive pen touched drawing surface */
SDL_EVENT_PEN_UP, /**< Pressure-sensitive pen stopped touching drawing surface */
SDL_EVENT_PEN_MOTION, /**< Pressure-sensitive pen moved, or angle/pressure changed */
SDL_EVENT_PEN_BUTTON_DOWN, /**< Pressure-sensitive pen button pressed */
SDL_EVENT_PEN_BUTTON_UP, /**< Pressure-sensitive pen button released */
SDL_EVENT_PEN_MOTION, /**< Pressure-sensitive pen is moving on the tablet */
SDL_EVENT_PEN_AXIS, /**< Pressure-sensitive pen angle/pressure/etc changed */
/* Camera hotplug events */
SDL_EVENT_CAMERA_DEVICE_ADDED = 0x1400, /**< A new camera device is available */
@ -426,7 +427,7 @@ typedef struct SDL_MouseMotionEvent
Uint32 reserved;
Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
SDL_WindowID windowID; /**< The window with mouse focus, if any */
SDL_MouseID which; /**< The mouse instance id, SDL_TOUCH_MOUSEID, or SDL_PEN_MOUSEID */
SDL_MouseID which; /**< The mouse instance id or SDL_TOUCH_MOUSEID */
SDL_MouseButtonFlags state; /**< The current button state */
float x; /**< X coordinate, relative to window */
float y; /**< Y coordinate, relative to window */
@ -445,7 +446,7 @@ typedef struct SDL_MouseButtonEvent
Uint32 reserved;
Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
SDL_WindowID windowID; /**< The window with mouse focus, if any */
SDL_MouseID which; /**< The mouse instance id, SDL_TOUCH_MOUSEID, or SDL_PEN_MOUSEID */
SDL_MouseID which; /**< The mouse instance id, SDL_TOUCH_MOUSEID */
Uint8 button; /**< The mouse button index */
Uint8 state; /**< SDL_PRESSED or SDL_RELEASED */
Uint8 clicks; /**< 1 for single-click, 2 for double-click, etc. */
@ -465,7 +466,7 @@ typedef struct SDL_MouseWheelEvent
Uint32 reserved;
Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
SDL_WindowID windowID; /**< The window with mouse focus, if any */
SDL_MouseID which; /**< The mouse instance id, SDL_TOUCH_MOUSEID, or SDL_PEN_MOUSEID */
SDL_MouseID which; /**< The mouse instance id, SDL_TOUCH_MOUSEID */
float x; /**< The amount scrolled horizontally, positive to the right and negative to the left */
float y; /**< The amount scrolled vertically, positive away from the user and negative toward the user */
SDL_MouseWheelDirection direction; /**< Set to one of the SDL_MOUSEWHEEL_* defines. When FLIPPED the values in X and Y will be opposite. Multiply by -1 to change them back */
@ -714,67 +715,118 @@ typedef struct SDL_TouchFingerEvent
SDL_WindowID windowID; /**< The window underneath the finger, if any */
} SDL_TouchFingerEvent;
/**
* Pressure-sensitive pen touched or stopped touching surface (event.ptip.*)
* Pressure-sensitive pen proximity event structure (event.pmotion.*)
*
* When a pen becomes visible to the system (it is close enough to a tablet,
* etc), SDL will send an SDL_EVENT_PEN_PROXIMITY_IN event with the new pen's
* ID. This ID is valid until the pen leaves proximity again (has been removed
* from the tablet's area, the tablet has been unplugged, etc). If the same
* pen reenters proximity again, it will be given a new ID.
*
* Note that "proximity" means "close enough for the tablet to know the tool
* is there." The pen touching and lifting off from the tablet while not
* leaving the area are handled by SDL_EVENT_PEN_DOWN and SDL_EVENT_PEN_UP.
*
* \since This struct is available since SDL 3.0.0.
*/
typedef struct SDL_PenTipEvent
typedef struct SDL_PenProximityEvent
{
SDL_EventType type; /**< SDL_EVENT_PEN_PROXIMITY_IN or SDL_EVENT_PEN_PROXIMITY_OUT */
Uint32 reserved;
Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
SDL_WindowID windowID; /**< The window with mouse focus, if any */
SDL_PenID which; /**< The pen instance id */
} SDL_PenProximityEvent;
/**
* Pressure-sensitive pen motion event structure (event.pmotion.*)
*
* Depending on the hardware, you may get motion events when the pen is not
* touching a tablet, for tracking a pen even when it isn't drawing. You
* should listen for SDL_EVENT_PEN_DOWN and SDL_EVENT_PEN_UP events, or check
* `pen_state & SDL_PEN_INPUT_DOWN` to decide if a pen is "drawing" when
* dealing with pen motion.
*
* \since This struct is available since SDL 3.0.0.
*/
typedef struct SDL_PenMotionEvent
{
SDL_EventType type; /**< SDL_EVENT_PEN_MOTION */
Uint32 reserved;
Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
SDL_WindowID windowID; /**< The window with mouse focus, if any */
SDL_PenID which; /**< The pen instance id */
SDL_PenInputFlags pen_state; /**< Complete pen input state at time of event */
float x; /**< X position of pen on tablet */
float y; /**< Y position of pen on tablet */
} SDL_PenMotionEvent;
/**
* Pressure-sensitive pen touched event structure (event.ptouch.*)
*
* These events come when a pen touches a surface (a tablet, etc), or lifts
* off from one.
*
* \since This struct is available since SDL 3.0.0.
*/
typedef struct SDL_PenTouchEvent
{
SDL_EventType type; /**< SDL_EVENT_PEN_DOWN or SDL_EVENT_PEN_UP */
Uint32 reserved;
Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
SDL_WindowID windowID; /**< The window with pen focus, if any */
SDL_PenID which; /**< The pen instance id */
Uint8 tip; /**< SDL_PEN_TIP_INK when using a regular pen tip, or SDL_PEN_TIP_ERASER if the pen is being used as an eraser (e.g., flipped to use the eraser tip) */
Uint8 state; /**< SDL_PRESSED on SDL_EVENT_PEN_DOWN and SDL_RELEASED on SDL_EVENT_PEN_UP */
Uint16 pen_state; /**< Pen button masks (where SDL_BUTTON(1) is the first button, SDL_BUTTON(2) is the second button etc.), SDL_PEN_DOWN_MASK is set if the pen is touching the surface, and SDL_PEN_ERASER_MASK is set if the pen is (used as) an eraser. */
float x; /**< X coordinate, relative to window */
float y; /**< Y coordinate, relative to window */
float axes[SDL_PEN_NUM_AXES]; /**< Pen axes such as pressure and tilt (ordered as per SDL_PenAxis) */
} SDL_PenTipEvent;
/**
* Pressure-sensitive pen motion / pressure / angle event structure
* (event.pmotion.*)
*
* \since This struct is available since SDL 3.0.0.
*/
typedef struct SDL_PenMotionEvent
{
SDL_EventType type; /**< SDL_EVENT_PEN_MOTION */
Uint32 reserved;
Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
SDL_WindowID windowID; /**< The window with pen focus, if any */
SDL_PenID which; /**< The pen instance id */
Uint8 padding1;
Uint8 padding2;
Uint16 pen_state; /**< Pen button masks (where SDL_BUTTON(1) is the first button, SDL_BUTTON(2) is the second button etc.), SDL_PEN_DOWN_MASK is set if the pen is touching the surface, and SDL_PEN_ERASER_MASK is set if the pen is (used as) an eraser. */
float x; /**< X coordinate, relative to window */
float y; /**< Y coordinate, relative to window */
float axes[SDL_PEN_NUM_AXES]; /**< Pen axes such as pressure and tilt (ordered as per SDL_PenAxis) */
} SDL_PenMotionEvent;
SDL_PenInputFlags pen_state; /**< Complete pen input state at time of event */
float x; /**< X position of pen on tablet */
float y; /**< Y position of pen on tablet */
Uint8 eraser; /**< Non-zero if eraser end is used (not all pens support this). */
Uint8 state; /**< SDL_PRESSED (pen is touching) or SDL_RELEASED (pen is lifted off) */
} SDL_PenTouchEvent;
/**
* Pressure-sensitive pen button event structure (event.pbutton.*)
*
* This is for buttons on the pen itself that the user might click. The pen
* itself pressing down to draw triggers a SDL_EVENT_PEN_DOWN event instead.
*
* \since This struct is available since SDL 3.0.0.
*/
typedef struct SDL_PenButtonEvent
{
SDL_EventType type; /**< SDL_EVENT_PEN_BUTTON_DOWN or SDL_EVENT_PEN_BUTTON_UP */
SDL_EventType type; /**< SDL_EVENT_PEN_BUTTON_DOWN or SDL_EVENT_PEN_BUTTON_UP */
Uint32 reserved;
Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
SDL_WindowID windowID; /**< The window with mouse focus, if any */
SDL_PenID which; /**< The pen instance id */
SDL_PenInputFlags pen_state; /**< Complete pen input state at time of event */
float x; /**< X position of pen on tablet */
float y; /**< Y position of pen on tablet */
Uint8 button; /**< The pen button index (first button is 1). */
Uint8 state; /**< SDL_PRESSED or SDL_RELEASED */
} SDL_PenButtonEvent;
/**
* Pressure-sensitive pen pressure / angle event structure (event.paxis.*)
*
* You might get some of these events even if the pen isn't touching the
* tablet.
*
* \since This struct is available since SDL 3.0.0.
*/
typedef struct SDL_PenAxisEvent
{
SDL_EventType type; /**< SDL_EVENT_PEN_AXIS */
Uint32 reserved;
Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
SDL_WindowID windowID; /**< The window with pen focus, if any */
SDL_PenID which; /**< The pen instance id */
Uint8 button; /**< The pen button index (1 represents the pen tip for compatibility with mouse events) */
Uint8 state; /**< SDL_PRESSED or SDL_RELEASED */
Uint16 pen_state; /**< Pen button masks (where SDL_BUTTON(1) is the first button, SDL_BUTTON(2) is the second button etc.), SDL_PEN_DOWN_MASK is set if the pen is touching the surface, and SDL_PEN_ERASER_MASK is set if the pen is (used as) an eraser. */
float x; /**< X coordinate, relative to window */
float y; /**< Y coordinate, relative to window */
float axes[SDL_PEN_NUM_AXES]; /**< Pen axes such as pressure and tilt (ordered as per SDL_PenAxis) */
} SDL_PenButtonEvent;
SDL_PenInputFlags pen_state; /**< Complete pen input state at time of event */
float x; /**< X position of pen on tablet */
float y; /**< Y position of pen on tablet */
SDL_PenAxis axis; /**< Axis that has changed */
float value; /**< New value of axis */
} SDL_PenAxisEvent;
/**
* An event used to drop text or request a file open by the system
@ -894,9 +946,11 @@ typedef union SDL_Event
SDL_QuitEvent quit; /**< Quit request event data */
SDL_UserEvent user; /**< Custom event data */
SDL_TouchFingerEvent tfinger; /**< Touch finger event data */
SDL_PenTipEvent ptip; /**< Pen tip touching or leaving drawing surface */
SDL_PenMotionEvent pmotion; /**< Pen change in position, pressure, or angle */
SDL_PenButtonEvent pbutton; /**< Pen button press */
SDL_PenProximityEvent pproximity; /**< Pen proximity event data */
SDL_PenTouchEvent ptouch; /**< Pen tip touching event data */
SDL_PenMotionEvent pmotion; /**< Pen motion event data */
SDL_PenButtonEvent pbutton; /**< Pen button event data */
SDL_PenAxisEvent paxis; /**< Pen axis event data */
SDL_DropEvent drop; /**< Drag and drop event data */
SDL_ClipboardEvent clipboard; /**< Clipboard event data */
@ -985,8 +1039,8 @@ typedef enum SDL_EventAction
* SDL_EVENT_FIRST is a safe choice.
* \param maxType maximum value of the event type to be considered;
* SDL_EVENT_LAST is a safe choice.
* \returns the number of events actually stored or a negative error code on
* failure; call SDL_GetError() for more information.
* \returns the number of events actually stored or -1 on failure; call
* SDL_GetError() for more information.
*
* \since This function is available since SDL 3.0.0.
*
@ -1200,9 +1254,9 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_WaitEventTimeout(SDL_Event *event, Sint
* its own custom event types.
*
* \param event the SDL_Event to be added to the queue.
* \returns 1 on success, 0 if the event was filtered, or a negative error
* code on failure; call SDL_GetError() for more information. A
* common reason for error is the event queue being full.
* \returns SDL_TRUE on success, SDL_FALSE if the event was filtered or on
* failure; call SDL_GetError() for more information. A common reason
* for error is the event queue being full.
*
* \since This function is available since SDL 3.0.0.
*
@ -1210,7 +1264,7 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_WaitEventTimeout(SDL_Event *event, Sint
* \sa SDL_PollEvent
* \sa SDL_RegisterEvents
*/
extern SDL_DECLSPEC int SDLCALL SDL_PushEvent(SDL_Event *event);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_PushEvent(SDL_Event *event);
/**
* A function pointer used for callbacks that watch the event queue.
@ -1218,8 +1272,9 @@ extern SDL_DECLSPEC int SDLCALL SDL_PushEvent(SDL_Event *event);
* \param userdata what was passed as `userdata` to SDL_SetEventFilter() or
* SDL_AddEventWatch, etc.
* \param event the event that triggered the callback.
* \returns 1 to permit event to be added to the queue, and 0 to disallow it.
* When used with SDL_AddEventWatch, the return value is ignored.
* \returns SDL_TRUE to permit event to be added to the queue, and SDL_FALSE
* to disallow it. When used with SDL_AddEventWatch, the return value
* is ignored.
*
* \threadsafety SDL may call this callback at any time from any thread; the
* application is responsible for locking resources the callback
@ -1230,16 +1285,16 @@ extern SDL_DECLSPEC int SDLCALL SDL_PushEvent(SDL_Event *event);
* \sa SDL_SetEventFilter
* \sa SDL_AddEventWatch
*/
typedef int (SDLCALL *SDL_EventFilter)(void *userdata, SDL_Event *event);
typedef SDL_bool (SDLCALL *SDL_EventFilter)(void *userdata, SDL_Event *event);
/**
* Set up a filter to process all events before they change internal state and
* are posted to the internal event queue.
*
* If the filter function returns 1 when called, then the event will be added
* to the internal queue. If it returns 0, then the event will be dropped from
* the queue, but the internal state will still be updated. This allows
* selective filtering of dynamically arriving events.
* If the filter function returns SDL_TRUE when called, then the event will be
* added to the internal queue. If it returns SDL_FALSE, then the event will
* be dropped from the queue, but the internal state will still be updated.
* This allows selective filtering of dynamically arriving events.
*
* **WARNING**: Be very careful of what you do in the event filter function,
* as it may run in a different thread!
@ -1317,17 +1372,17 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetEventFilter(SDL_EventFilter *filter,
*
* \param filter an SDL_EventFilter function to call when an event happens.
* \param userdata a pointer that is passed to `filter`.
* \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.
*
* \threadsafety It is safe to call this function from any thread.
*
* \since This function is available since SDL 3.0.0.
*
* \sa SDL_DelEventWatch
* \sa SDL_RemoveEventWatch
* \sa SDL_SetEventFilter
*/
extern SDL_DECLSPEC int SDLCALL SDL_AddEventWatch(SDL_EventFilter filter, void *userdata);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_AddEventWatch(SDL_EventFilter filter, void *userdata);
/**
* Remove an event watch callback added with SDL_AddEventWatch().
@ -1342,11 +1397,11 @@ extern SDL_DECLSPEC int SDLCALL SDL_AddEventWatch(SDL_EventFilter filter, void *
*
* \sa SDL_AddEventWatch
*/
extern SDL_DECLSPEC void SDLCALL SDL_DelEventWatch(SDL_EventFilter filter, void *userdata);
extern SDL_DECLSPEC void SDLCALL SDL_RemoveEventWatch(SDL_EventFilter filter, void *userdata);
/**
* Run a specific filter function on the current event queue, removing any
* events for which the filter returns 0.
* events for which the filter returns SDL_FALSE.
*
* See SDL_SetEventFilter() for more information. Unlike SDL_SetEventFilter(),
* this function does not change the filter permanently, it only uses the

View File

@ -266,12 +266,12 @@ typedef Uint32 SDL_GlobFlags;
* Create a directory.
*
* \param path the path of the directory to create.
* \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.
*/
extern SDL_DECLSPEC int SDLCALL SDL_CreateDirectory(const char *path);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_CreateDirectory(const char *path);
/* Callback for directory enumeration. Return 1 to keep enumerating,
0 to stop enumerating (no error), -1 to stop enumerating and
@ -289,47 +289,47 @@ typedef int (SDLCALL *SDL_EnumerateDirectoryCallback)(void *userdata, const char
* \param path the path of the directory to enumerate.
* \param callback a function that is called for each entry in the directory.
* \param userdata a pointer that is passed to `callback`.
* \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.
*/
extern SDL_DECLSPEC int SDLCALL SDL_EnumerateDirectory(const char *path, SDL_EnumerateDirectoryCallback callback, void *userdata);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_EnumerateDirectory(const char *path, SDL_EnumerateDirectoryCallback callback, void *userdata);
/**
* Remove a file or an empty directory.
*
* \param path the path of the directory to enumerate.
* \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.
*/
extern SDL_DECLSPEC int SDLCALL SDL_RemovePath(const char *path);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_RemovePath(const char *path);
/**
* Rename a file or directory.
*
* \param oldpath the old path.
* \param newpath the new path.
* \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.
*/
extern SDL_DECLSPEC int SDLCALL SDL_RenamePath(const char *oldpath, const char *newpath);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_RenamePath(const char *oldpath, const char *newpath);
/**
* Copy a file.
*
* \param oldpath the old path.
* \param newpath the new path.
* \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.
*/
extern SDL_DECLSPEC int SDLCALL SDL_CopyFile(const char *oldpath, const char *newpath);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_CopyFile(const char *oldpath, const char *newpath);
/**
* Get information about a filesystem path.
@ -337,12 +337,12 @@ extern SDL_DECLSPEC int SDLCALL SDL_CopyFile(const char *oldpath, const char *ne
* \param path the path to query.
* \param info a pointer filled in with information about the path, or NULL to
* check for the existence of a file.
* \returns 0 on success or a negative error code if the file doesn't exist,
* or another failure; call SDL_GetError() for more information.
* \returns SDL_TRUE on success or SDL_FALSE if the file doesn't exist, or
* another failure; call SDL_GetError() for more information.
*
* \since This function is available since SDL 3.0.0.
*/
extern SDL_DECLSPEC int SDLCALL SDL_GetPathInfo(const char *path, SDL_PathInfo *info);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetPathInfo(const char *path, SDL_PathInfo *info);
/**
* Enumerate a directory tree, filtered by pattern, and return a list.

View File

@ -379,12 +379,12 @@ extern SDL_DECLSPEC int SDLCALL SDL_AddGamepadMappingsFromFile(const char *file)
*
* This will generate gamepad events as needed if device mappings change.
*
* \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.
*/
extern SDL_DECLSPEC int SDLCALL SDL_ReloadGamepadMappings(void);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_ReloadGamepadMappings(void);
/**
* Get the current gamepad mappings.
@ -442,15 +442,15 @@ extern SDL_DECLSPEC char * SDLCALL SDL_GetGamepadMapping(SDL_Gamepad *gamepad);
* \param instance_id the joystick instance ID.
* \param mapping the mapping to use for this device, or NULL to clear the
* mapping.
* \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_AddGamepadMapping
* \sa SDL_GetGamepadMapping
*/
extern SDL_DECLSPEC int SDLCALL SDL_SetGamepadMapping(SDL_JoystickID instance_id, const char *mapping);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetGamepadMapping(SDL_JoystickID instance_id, const char *mapping);
/**
* Return whether a gamepad is currently connected.
@ -813,14 +813,14 @@ extern SDL_DECLSPEC int SDLCALL SDL_GetGamepadPlayerIndex(SDL_Gamepad *gamepad);
* \param gamepad the gamepad object to adjust.
* \param player_index player index to assign to this gamepad, or -1 to clear
* the player index and turn off player LEDs.
* \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_GetGamepadPlayerIndex
*/
extern SDL_DECLSPEC int SDLCALL SDL_SetGamepadPlayerIndex(SDL_Gamepad *gamepad, int player_index);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetGamepadPlayerIndex(SDL_Gamepad *gamepad, int player_index);
/**
* Get the USB vendor ID of an opened gamepad, if available.
@ -1257,14 +1257,14 @@ extern SDL_DECLSPEC int SDLCALL SDL_GetNumGamepadTouchpadFingers(SDL_Gamepad *ga
* \param y filled with y position, normalized 0 to 1, with the origin in the
* upper left.
* \param pressure filled with pressure value.
* \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_GetNumGamepadTouchpadFingers
*/
extern SDL_DECLSPEC int SDLCALL SDL_GetGamepadTouchpadFinger(SDL_Gamepad *gamepad, int touchpad, int finger, Uint8 *state, float *x, float *y, float *pressure);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetGamepadTouchpadFinger(SDL_Gamepad *gamepad, int touchpad, int finger, Uint8 *state, float *x, float *y, float *pressure);
/**
* Return whether a gamepad has a particular sensor.
@ -1287,15 +1287,15 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GamepadHasSensor(SDL_Gamepad *gamepad,
* \param gamepad the gamepad to update.
* \param type the type of sensor to enable/disable.
* \param enabled whether data reporting should be enabled.
* \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_GamepadHasSensor
* \sa SDL_GamepadSensorEnabled
*/
extern SDL_DECLSPEC int SDLCALL SDL_SetGamepadSensorEnabled(SDL_Gamepad *gamepad, SDL_SensorType type, SDL_bool enabled);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetGamepadSensorEnabled(SDL_Gamepad *gamepad, SDL_SensorType type, SDL_bool enabled);
/**
* Query whether sensor data reporting is enabled for a gamepad.
@ -1331,12 +1331,12 @@ extern SDL_DECLSPEC float SDLCALL SDL_GetGamepadSensorDataRate(SDL_Gamepad *game
* \param type the type of sensor to query.
* \param data a pointer filled with the current sensor state.
* \param num_values the number of values to write to data.
* \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.
*/
extern SDL_DECLSPEC int SDLCALL SDL_GetGamepadSensorData(SDL_Gamepad *gamepad, SDL_SensorType type, float *data, int num_values);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetGamepadSensorData(SDL_Gamepad *gamepad, SDL_SensorType type, float *data, int num_values);
/**
* Start a rumble effect on a gamepad.
@ -1353,11 +1353,12 @@ extern SDL_DECLSPEC int SDLCALL SDL_GetGamepadSensorData(SDL_Gamepad *gamepad, S
* \param high_frequency_rumble the intensity of the high frequency (right)
* rumble motor, from 0 to 0xFFFF.
* \param duration_ms the duration of the rumble effect, in milliseconds.
* \returns 0, or -1 if rumble isn't supported on this gamepad.
* \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.
*/
extern SDL_DECLSPEC int SDLCALL SDL_RumbleGamepad(SDL_Gamepad *gamepad, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble, Uint32 duration_ms);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_RumbleGamepad(SDL_Gamepad *gamepad, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble, Uint32 duration_ms);
/**
* Start a rumble effect in the gamepad's triggers.
@ -1378,14 +1379,14 @@ extern SDL_DECLSPEC int SDLCALL SDL_RumbleGamepad(SDL_Gamepad *gamepad, Uint16 l
* \param right_rumble the intensity of the right trigger rumble motor, from 0
* to 0xFFFF.
* \param duration_ms the duration of the rumble effect, 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_RumbleGamepad
*/
extern SDL_DECLSPEC int SDLCALL SDL_RumbleGamepadTriggers(SDL_Gamepad *gamepad, Uint16 left_rumble, Uint16 right_rumble, Uint32 duration_ms);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_RumbleGamepadTriggers(SDL_Gamepad *gamepad, Uint16 left_rumble, Uint16 right_rumble, Uint32 duration_ms);
/**
* Update a gamepad's LED color.
@ -1400,12 +1401,12 @@ extern SDL_DECLSPEC int SDLCALL SDL_RumbleGamepadTriggers(SDL_Gamepad *gamepad,
* \param red the intensity of the red LED.
* \param green the intensity of the green LED.
* \param blue the intensity of the blue LED.
* \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.
*/
extern SDL_DECLSPEC int SDLCALL SDL_SetGamepadLED(SDL_Gamepad *gamepad, Uint8 red, Uint8 green, Uint8 blue);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetGamepadLED(SDL_Gamepad *gamepad, Uint8 red, Uint8 green, Uint8 blue);
/**
* Send a gamepad specific effect packet.
@ -1413,12 +1414,12 @@ extern SDL_DECLSPEC int SDLCALL SDL_SetGamepadLED(SDL_Gamepad *gamepad, Uint8 re
* \param gamepad the gamepad to affect.
* \param data the data to send to the gamepad.
* \param size the size of the data to send to the gamepad.
* \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.
*/
extern SDL_DECLSPEC int SDLCALL SDL_SendGamepadEffect(SDL_Gamepad *gamepad, const void *data, int size);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SendGamepadEffect(SDL_Gamepad *gamepad, const void *data, int size);
/**
* Close a gamepad previously opened with SDL_OpenGamepad().

File diff suppressed because it is too large Load Diff

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

File diff suppressed because it is too large Load Diff

View File

@ -31,6 +31,7 @@
#include <SDL3/SDL_stdinc.h>
#include <SDL3/SDL_error.h>
#include <SDL3/SDL_events.h>
#include <SDL3/SDL_begin_code.h>
/* Set up for C function definitions, even when using C++ */
@ -66,6 +67,38 @@ typedef Uint32 SDL_InitFlags;
#define SDL_INIT_SENSOR 0x00008000u /**< `SDL_INIT_SENSOR` implies `SDL_INIT_EVENTS` */
#define SDL_INIT_CAMERA 0x00010000u /**< `SDL_INIT_CAMERA` implies `SDL_INIT_EVENTS` */
/**
* Return values for optional main callbacks.
*
* Returning SDL_APP_SUCCESS or SDL_APP_FAILURE from SDL_AppInit,
* SDL_AppEvent, or SDL_AppIterate will terminate the program and report
* success/failure to the operating system. What that means is
* platform-dependent. On Unix, for example, on success, the process error
* code will be zero, and on failure it will be 1. This interface doesn't
* allow you to return specific exit codes, just whether there was an error
* generally or not.
*
* Returning SDL_APP_CONTINUE from these functions will let the app continue
* to run.
*
* See
* [Main callbacks in SDL3](https://wiki.libsdl.org/SDL3/README/main-functions#main-callbacks-in-sdl3)
* for complete details.
*
* \since This enum is available since SDL 3.0.0.
*/
typedef enum SDL_AppResult
{
SDL_APP_CONTINUE, /**< Value that requests that the app continue from the main callbacks. */
SDL_APP_SUCCESS, /**< Value that requests termination with success from the main callbacks. */
SDL_APP_FAILURE /**< Value that requests termination with error from the main callbacks. */
} SDL_AppResult;
typedef SDL_AppResult (SDLCALL *SDL_AppInit_func)(void **appstate, int argc, char *argv[]);
typedef SDL_AppResult (SDLCALL *SDL_AppIterate_func)(void *appstate);
typedef SDL_AppResult (SDLCALL *SDL_AppEvent_func)(void *appstate, const SDL_Event *event);
typedef void (SDLCALL *SDL_AppQuit_func)(void *appstate);
/**
* Initialize the SDL library.
*
@ -110,8 +143,8 @@ typedef Uint32 SDL_InitFlags;
* SDL_SetAppMetadataProperty().
*
* \param flags subsystem initialization flags.
* \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.
*
@ -122,7 +155,7 @@ typedef Uint32 SDL_InitFlags;
* \sa SDL_SetMainReady
* \sa SDL_WasInit
*/
extern SDL_DECLSPEC int SDLCALL SDL_Init(SDL_InitFlags flags);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_Init(SDL_InitFlags flags);
/**
* Compatibility function to initialize the SDL library.
@ -130,8 +163,8 @@ extern SDL_DECLSPEC int SDLCALL SDL_Init(SDL_InitFlags flags);
* This function and SDL_Init() are interchangeable.
*
* \param flags any of the flags used by SDL_Init(); see SDL_Init for details.
* \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.
*
@ -139,7 +172,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_Init(SDL_InitFlags flags);
* \sa SDL_Quit
* \sa SDL_QuitSubSystem
*/
extern SDL_DECLSPEC int SDLCALL SDL_InitSubSystem(SDL_InitFlags flags);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_InitSubSystem(SDL_InitFlags flags);
/**
* Shut down specific SDL subsystems.
@ -215,8 +248,8 @@ extern SDL_DECLSPEC void SDLCALL SDL_Quit(void);
* hash, or whatever makes sense).
* \param appidentifier A unique string in reverse-domain format that
* identifies this app ("com.example.mygame2").
* \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.
*
* \threadsafety It is safe to call this function from any thread.
*
@ -224,7 +257,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_Quit(void);
*
* \sa SDL_SetAppMetadataProperty
*/
extern SDL_DECLSPEC int SDLCALL SDL_SetAppMetadata(const char *appname, const char *appversion, const char *appidentifier);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetAppMetadata(const char *appname, const char *appversion, const char *appidentifier);
/**
* Specify metadata about your app through a set of properties.
@ -250,7 +283,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_SetAppMetadata(const char *appname, const ch
* anywhere the OS shows the name of the application separately from window
* titles, such as volume control applets, etc. This defaults to "SDL
* Application".
* - SDL_PROP_APP_METADATA_VERSION_STRING`: The version of the app that is
* - `SDL_PROP_APP_METADATA_VERSION_STRING`: The version of the app that is
* running; there are no rules on format, so "1.0.3beta2" and "April 22nd,
* 2024" and a git hash are all valid options. This has no default.
* - `SDL_PROP_APP_METADATA_IDENTIFIER_STRING`: A unique string that
@ -260,16 +293,16 @@ extern SDL_DECLSPEC int SDLCALL SDL_SetAppMetadata(const char *appname, const ch
* associated desktop settings and icons. If you plan to package your
* application in a container such as Flatpak, the app ID should match the
* name of your Flatpak container as well. This has no default.
* - SDL_PROP_APP_METADATA_CREATOR_STRING`: The human-readable name of the
* - `SDL_PROP_APP_METADATA_CREATOR_STRING`: The human-readable name of the
* creator/developer/maker of this app, like "MojoWorkshop, LLC"
* - SDL_PROP_APP_METADATA_COPYRIGHT_STRING`: The human-readable copyright
* - `SDL_PROP_APP_METADATA_COPYRIGHT_STRING`: The human-readable copyright
* notice, like "Copyright (c) 2024 MojoWorkshop, LLC" or whatnot. Keep this
* to one line, don't paste a copy of a whole software license in here. This
* has no default.
* - SDL_PROP_APP_METADATA_URL_STRING`: A URL to the app on the web. Maybe a
* - `SDL_PROP_APP_METADATA_URL_STRING`: A URL to the app on the web. Maybe a
* product page, or a storefront, or even a GitHub repository, for user's
* further information This has no default.
* - SDL_PROP_APP_METADATA_TYPE_STRING`: The type of application this is.
* - `SDL_PROP_APP_METADATA_TYPE_STRING`: The type of application this is.
* Currently this string can be "game" for a video game, "mediaplayer" for a
* media player, or generically "application" if nothing else applies.
* Future versions of SDL might add new types. This defaults to
@ -277,8 +310,8 @@ extern SDL_DECLSPEC int SDLCALL SDL_SetAppMetadata(const char *appname, const ch
*
* \param name the name of the metadata property to set.
* \param value the value of the property, or NULL to remove that property.
* \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.
*
* \threadsafety It is safe to call this function from any thread.
*
@ -287,7 +320,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_SetAppMetadata(const char *appname, const ch
* \sa SDL_GetAppMetadataProperty
* \sa SDL_SetAppMetadata
*/
extern SDL_DECLSPEC int SDLCALL SDL_SetAppMetadataProperty(const char *name, const char *value);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetAppMetadataProperty(const char *name, const char *value);
#define SDL_PROP_APP_METADATA_NAME_STRING "SDL.app.metadata.name"
#define SDL_PROP_APP_METADATA_VERSION_STRING "SDL.app.metadata.version"

View File

@ -132,9 +132,10 @@ typedef struct SDL_IOStreamInterface
* The SDL_IOStream is still destroyed even if this fails, so clean up anything
* even if flushing to disk returns an error.
*
* \return 0 if successful or -1 on write error when flushing data.
* \return SDL_TRUE if successful or SDL_FALSE on write error when flushing data.
*/
int (SDLCALL *close)(void *userdata);
SDL_bool (SDLCALL *close)(void *userdata);
} SDL_IOStreamInterface;
@ -371,21 +372,21 @@ extern SDL_DECLSPEC SDL_IOStream * SDLCALL SDL_OpenIO(const SDL_IOStreamInterfac
*
* SDL_CloseIO() closes and cleans up the SDL_IOStream stream. It releases any
* resources used by the stream and frees the SDL_IOStream itself. This
* returns 0 on success, or -1 if the stream failed to flush to its output
* (e.g. to disk).
* returns SDL_TRUE on success, or SDL_FALSE if the stream failed to flush to
* its output (e.g. to disk).
*
* Note that if this fails to flush the stream to disk, this function reports
* an error, but the SDL_IOStream is still invalid once this function returns.
*
* \param context SDL_IOStream structure to close.
* \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_OpenIO
*/
extern SDL_DECLSPEC int SDLCALL SDL_CloseIO(SDL_IOStream *context);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_CloseIO(SDL_IOStream *context);
/**
* Get the properties associated with an SDL_IOStream.
@ -481,9 +482,9 @@ extern SDL_DECLSPEC Sint64 SDLCALL SDL_TellIO(SDL_IOStream *context);
*
* This function reads up `size` bytes from the data source to the area
* pointed at by `ptr`. This function may read less bytes than requested. It
* will return zero when the data stream is completely read, or on error. To
* determine if there was an error or all data was read, call
* SDL_GetIOStatus().
* will return zero when the data stream is completely read, and
* SDL_GetIOStatus() will return SDL_IO_STATUS_EOF, or on error, and
* SDL_GetIOStatus() will return SDL_IO_STATUS_ERROR.
*
* \param context a pointer to an SDL_IOStream structure.
* \param ptr a pointer to a buffer to read data into.

View File

@ -91,8 +91,7 @@ typedef struct SDL_Joystick SDL_Joystick;
*
* If the joystick 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.
*/
@ -447,11 +446,12 @@ typedef struct SDL_VirtualJoystickDesc
void *userdata; /**< User data pointer passed to callbacks */
void (SDLCALL *Update)(void *userdata); /**< Called when the joystick state should be updated */
void (SDLCALL *SetPlayerIndex)(void *userdata, int player_index); /**< Called when the player index is set */
int (SDLCALL *Rumble)(void *userdata, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble); /**< Implements SDL_RumbleJoystick() */
int (SDLCALL *RumbleTriggers)(void *userdata, Uint16 left_rumble, Uint16 right_rumble); /**< Implements SDL_RumbleJoystickTriggers() */
int (SDLCALL *SetLED)(void *userdata, Uint8 red, Uint8 green, Uint8 blue); /**< Implements SDL_SetJoystickLED() */
int (SDLCALL *SendEffect)(void *userdata, const void *data, int size); /**< Implements SDL_SendJoystickEffect() */
int (SDLCALL *SetSensorsEnabled)(void *userdata, SDL_bool enabled); /**< Implements SDL_SetGamepadSensorEnabled() */
SDL_bool (SDLCALL *Rumble)(void *userdata, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble); /**< Implements SDL_RumbleJoystick() */
SDL_bool (SDLCALL *RumbleTriggers)(void *userdata, Uint16 left_rumble, Uint16 right_rumble); /**< Implements SDL_RumbleJoystickTriggers() */
SDL_bool (SDLCALL *SetLED)(void *userdata, Uint8 red, Uint8 green, Uint8 blue); /**< Implements SDL_SetJoystickLED() */
SDL_bool (SDLCALL *SendEffect)(void *userdata, const void *data, int size); /**< Implements SDL_SendJoystickEffect() */
SDL_bool (SDLCALL *SetSensorsEnabled)(void *userdata, SDL_bool enabled); /**< Implements SDL_SetGamepadSensorEnabled() */
void (SDLCALL *Cleanup)(void *userdata); /**< Cleans up the userdata when the joystick is detached */
} SDL_VirtualJoystickDesc;
/**
@ -472,14 +472,14 @@ extern SDL_DECLSPEC SDL_JoystickID SDLCALL SDL_AttachVirtualJoystick(const SDL_V
*
* \param instance_id the joystick instance ID, previously returned from
* SDL_AttachVirtualJoystick().
* \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_AttachVirtualJoystick
*/
extern SDL_DECLSPEC int SDLCALL SDL_DetachVirtualJoystick(SDL_JoystickID instance_id);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_DetachVirtualJoystick(SDL_JoystickID instance_id);
/**
* Query whether or not a joystick is virtual.
@ -507,12 +507,12 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_IsJoystickVirtual(SDL_JoystickID instan
* \param joystick the virtual joystick on which to set state.
* \param axis the index of the axis on the virtual joystick to update.
* \param value the new value for the specified axis.
* \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.
*/
extern SDL_DECLSPEC int SDLCALL SDL_SetJoystickVirtualAxis(SDL_Joystick *joystick, int axis, Sint16 value);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetJoystickVirtualAxis(SDL_Joystick *joystick, int axis, Sint16 value);
/**
* Generate ball motion on an opened virtual joystick.
@ -527,12 +527,12 @@ extern SDL_DECLSPEC int SDLCALL SDL_SetJoystickVirtualAxis(SDL_Joystick *joystic
* \param ball the index of the ball on the virtual joystick to update.
* \param xrel the relative motion on the X axis.
* \param yrel the relative motion on the Y axis.
* \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.
*/
extern SDL_DECLSPEC int SDLCALL SDL_SetJoystickVirtualBall(SDL_Joystick *joystick, int ball, Sint16 xrel, Sint16 yrel);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetJoystickVirtualBall(SDL_Joystick *joystick, int ball, Sint16 xrel, Sint16 yrel);
/**
* Set the state of a button on an opened virtual joystick.
@ -546,12 +546,12 @@ extern SDL_DECLSPEC int SDLCALL SDL_SetJoystickVirtualBall(SDL_Joystick *joystic
* \param joystick the virtual joystick on which to set state.
* \param button the index of the button on the virtual joystick to update.
* \param value the new value for the specified button.
* \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.
*/
extern SDL_DECLSPEC int SDLCALL SDL_SetJoystickVirtualButton(SDL_Joystick *joystick, int button, Uint8 value);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetJoystickVirtualButton(SDL_Joystick *joystick, int button, Uint8 value);
/**
* Set the state of a hat on an opened virtual joystick.
@ -565,12 +565,12 @@ extern SDL_DECLSPEC int SDLCALL SDL_SetJoystickVirtualButton(SDL_Joystick *joyst
* \param joystick the virtual joystick on which to set state.
* \param hat the index of the hat on the virtual joystick to update.
* \param value the new value for the specified hat.
* \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.
*/
extern SDL_DECLSPEC int SDLCALL SDL_SetJoystickVirtualHat(SDL_Joystick *joystick, int hat, Uint8 value);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetJoystickVirtualHat(SDL_Joystick *joystick, int hat, Uint8 value);
/**
* Set touchpad finger state on an opened virtual joystick.
@ -592,12 +592,12 @@ extern SDL_DECLSPEC int SDLCALL SDL_SetJoystickVirtualHat(SDL_Joystick *joystick
* \param y the y coordinate of the finger on the touchpad, normalized 0 to 1,
* with the origin in the upper left.
* \param pressure the pressure of the finger.
* \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.
*/
extern SDL_DECLSPEC int SDLCALL SDL_SetJoystickVirtualTouchpad(SDL_Joystick *joystick, int touchpad, int finger, Uint8 state, float x, float y, float pressure);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetJoystickVirtualTouchpad(SDL_Joystick *joystick, int touchpad, int finger, Uint8 state, float x, float y, float pressure);
/**
* Send a sensor update for an opened virtual joystick.
@ -614,12 +614,12 @@ extern SDL_DECLSPEC int SDLCALL SDL_SetJoystickVirtualTouchpad(SDL_Joystick *joy
* the sensor reading.
* \param data the data associated with the sensor reading.
* \param num_values the number of values pointed to by `data`.
* \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.
*/
extern SDL_DECLSPEC int SDLCALL SDL_SendJoystickVirtualSensorData(SDL_Joystick *joystick, SDL_SensorType type, Uint64 sensor_timestamp, const float *data, int num_values);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SendJoystickVirtualSensorData(SDL_Joystick *joystick, SDL_SensorType type, Uint64 sensor_timestamp, const float *data, int num_values);
/**
* Get the properties associated with a joystick.
@ -698,14 +698,14 @@ extern SDL_DECLSPEC int SDLCALL SDL_GetJoystickPlayerIndex(SDL_Joystick *joystic
* \param joystick the SDL_Joystick obtained from SDL_OpenJoystick().
* \param player_index player index to assign to this joystick, or -1 to clear
* the player index and turn off player LEDs.
* \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_GetJoystickPlayerIndex
*/
extern SDL_DECLSPEC int SDLCALL SDL_SetJoystickPlayerIndex(SDL_Joystick *joystick, int player_index);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetJoystickPlayerIndex(SDL_Joystick *joystick, int player_index);
/**
* Get the implementation-dependent GUID for the joystick.
@ -853,9 +853,8 @@ extern SDL_DECLSPEC SDL_JoystickID SDLCALL SDL_GetJoystickID(SDL_Joystick *joyst
* device and platform.
*
* \param joystick an SDL_Joystick structure containing joystick information.
* \returns the number of axis controls/number of axes on success or a
* negative error code on failure; call SDL_GetError() for more
* information.
* \returns the number of axis controls/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.
*
@ -875,8 +874,8 @@ extern SDL_DECLSPEC int SDLCALL SDL_GetNumJoystickAxes(SDL_Joystick *joystick);
* Most joysticks do not have trackballs.
*
* \param joystick an SDL_Joystick structure containing joystick information.
* \returns the number of trackballs on success or a negative error code on
* failure; call SDL_GetError() for more information.
* \returns the number of trackballs on success or -1 on failure; call
* SDL_GetError() for more information.
*
* \since This function is available since SDL 3.0.0.
*
@ -891,8 +890,8 @@ extern SDL_DECLSPEC int SDLCALL SDL_GetNumJoystickBalls(SDL_Joystick *joystick);
* Get the number of POV hats on a joystick.
*
* \param joystick an SDL_Joystick structure containing joystick information.
* \returns the number of POV hats on success or a negative error code on
* failure; call SDL_GetError() for more information.
* \returns the number of POV hats on success or -1 on failure; call
* SDL_GetError() for more information.
*
* \since This function is available since SDL 3.0.0.
*
@ -907,8 +906,8 @@ extern SDL_DECLSPEC int SDLCALL SDL_GetNumJoystickHats(SDL_Joystick *joystick);
* Get the number of buttons on a joystick.
*
* \param joystick an SDL_Joystick structure containing joystick information.
* \returns the number of buttons on success or a negative error code on
* failure; call SDL_GetError() for more information.
* \returns the number of buttons on success or -1 on failure; call
* SDL_GetError() for more information.
*
* \since This function is available since SDL 3.0.0.
*
@ -1013,14 +1012,14 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetJoystickAxisInitialState(SDL_Joystic
* \param ball the ball index to query; ball indices start at index 0.
* \param dx stores the difference in the x axis position since the last poll.
* \param dy stores the difference in the y axis position since the last poll.
* \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_GetNumJoystickBalls
*/
extern SDL_DECLSPEC int SDLCALL SDL_GetJoystickBall(SDL_Joystick *joystick, int ball, int *dx, int *dy);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetJoystickBall(SDL_Joystick *joystick, int ball, int *dx, int *dy);
/**
* Get the current state of a POV hat on a joystick.
@ -1076,11 +1075,11 @@ extern SDL_DECLSPEC Uint8 SDLCALL SDL_GetJoystickButton(SDL_Joystick *joystick,
* \param high_frequency_rumble the intensity of the high frequency (right)
* rumble motor, from 0 to 0xFFFF.
* \param duration_ms the duration of the rumble effect, in milliseconds.
* \returns 0, or -1 if rumble isn't supported on this joystick.
* \returns SDL_TRUE, or SDL_FALSE if rumble isn't supported on this joystick.
*
* \since This function is available since SDL 3.0.0.
*/
extern SDL_DECLSPEC int SDLCALL SDL_RumbleJoystick(SDL_Joystick *joystick, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble, Uint32 duration_ms);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_RumbleJoystick(SDL_Joystick *joystick, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble, Uint32 duration_ms);
/**
* Start a rumble effect in the joystick's triggers.
@ -1102,14 +1101,14 @@ extern SDL_DECLSPEC int SDLCALL SDL_RumbleJoystick(SDL_Joystick *joystick, Uint1
* \param right_rumble the intensity of the right trigger rumble motor, from 0
* to 0xFFFF.
* \param duration_ms the duration of the rumble effect, 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_RumbleJoystick
*/
extern SDL_DECLSPEC int SDLCALL SDL_RumbleJoystickTriggers(SDL_Joystick *joystick, Uint16 left_rumble, Uint16 right_rumble, Uint32 duration_ms);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_RumbleJoystickTriggers(SDL_Joystick *joystick, Uint16 left_rumble, Uint16 right_rumble, Uint32 duration_ms);
/**
* Update a joystick's LED color.
@ -1124,12 +1123,12 @@ extern SDL_DECLSPEC int SDLCALL SDL_RumbleJoystickTriggers(SDL_Joystick *joystic
* \param red the intensity of the red LED.
* \param green the intensity of the green LED.
* \param blue the intensity of the blue LED.
* \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.
*/
extern SDL_DECLSPEC int SDLCALL SDL_SetJoystickLED(SDL_Joystick *joystick, Uint8 red, Uint8 green, Uint8 blue);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetJoystickLED(SDL_Joystick *joystick, Uint8 red, Uint8 green, Uint8 blue);
/**
* Send a joystick specific effect packet.
@ -1137,12 +1136,12 @@ extern SDL_DECLSPEC int SDLCALL SDL_SetJoystickLED(SDL_Joystick *joystick, Uint8
* \param joystick the joystick to affect.
* \param data the data to send to the joystick.
* \param size the size of the data to send to the joystick.
* \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.
*/
extern SDL_DECLSPEC int SDLCALL SDL_SendJoystickEffect(SDL_Joystick *joystick, const void *data, int size);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SendJoystickEffect(SDL_Joystick *joystick, const void *data, int size);
/**
* Close a joystick previously opened with SDL_OpenJoystick().

View File

@ -45,8 +45,7 @@ extern "C" {
*
* If the keyboard 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.
*/
@ -184,61 +183,27 @@ extern SDL_DECLSPEC SDL_Keymod SDLCALL SDL_GetModState(void);
*/
extern SDL_DECLSPEC void SDLCALL SDL_SetModState(SDL_Keymod modstate);
/**
* Get the key code corresponding to the given scancode according to a default
* en_US keyboard layout.
*
* See SDL_Keycode for details.
*
* \param scancode the desired SDL_Scancode to query.
* \param modstate the modifier state to use when translating the scancode to
* a keycode.
* \returns the SDL_Keycode that corresponds to the given SDL_Scancode.
*
* \since This function is available since SDL 3.0.0.
*
* \sa SDL_GetKeyName
* \sa SDL_GetScancodeFromKey
*/
extern SDL_DECLSPEC SDL_Keycode SDLCALL SDL_GetDefaultKeyFromScancode(SDL_Scancode scancode, SDL_Keymod modstate);
/**
* Get the key code corresponding to the given scancode according to the
* current keyboard layout.
*
* See SDL_Keycode for details.
* If you want to get the keycode as it would be delivered in key events,
* including options specified in SDL_HINT_KEYCODE_OPTIONS, then you should
* pass `key_event` as SDL_TRUE. Otherwise this function simply translates the
* scancode based on the given modifier state.
*
* \param scancode the desired SDL_Scancode to query.
* \param modstate the modifier state to use when translating the scancode to
* a keycode.
* \param key_event SDL_TRUE if the keycode will be used in key events.
* \returns the SDL_Keycode that corresponds to the given SDL_Scancode.
*
* \since This function is available since SDL 3.0.0.
*
* \sa SDL_GetDefaultKeyFromScancode
* \sa SDL_GetKeyName
* \sa SDL_GetScancodeFromKey
*/
extern SDL_DECLSPEC SDL_Keycode SDLCALL SDL_GetKeyFromScancode(SDL_Scancode scancode, SDL_Keymod modstate);
/**
* Get the scancode corresponding to the given key code according to a default
* en_US keyboard layout.
*
* Note that there may be multiple scancode+modifier states that can generate
* this keycode, this will just return the first one found.
*
* \param key the desired SDL_Keycode to query.
* \param modstate a pointer to the modifier state that would be used when the
* scancode generates this key, may be NULL.
* \returns the SDL_Scancode that corresponds to the given SDL_Keycode.
*
* \since This function is available since SDL 3.0.0.
*
* \sa SDL_GetScancodeFromKey
* \sa SDL_GetScancodeName
*/
extern SDL_DECLSPEC SDL_Scancode SDLCALL SDL_GetDefaultScancodeFromKey(SDL_Keycode key, SDL_Keymod *modstate);
extern SDL_DECLSPEC SDL_Keycode SDLCALL SDL_GetKeyFromScancode(SDL_Scancode scancode, SDL_Keymod modstate, SDL_bool key_event);
/**
* Get the scancode corresponding to the given key code according to the
@ -254,7 +219,6 @@ extern SDL_DECLSPEC SDL_Scancode SDLCALL SDL_GetDefaultScancodeFromKey(SDL_Keyco
*
* \since This function is available since SDL 3.0.0.
*
* \sa SDL_GetDefaultScancodeFromKey
* \sa SDL_GetKeyFromScancode
* \sa SDL_GetScancodeName
*/
@ -267,14 +231,14 @@ extern SDL_DECLSPEC SDL_Scancode SDLCALL SDL_GetScancodeFromKey(SDL_Keycode key,
* \param name the name to use for the scancode, encoded as UTF-8. The string
* is not copied, so the pointer given to this function must stay
* valid while SDL is being used.
* \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_GetScancodeName
*/
extern SDL_DECLSPEC int SDLCALL SDL_SetScancodeName(SDL_Scancode scancode, const char *name);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetScancodeName(SDL_Scancode scancode, const char *name);
/**
* Get a human-readable name for a scancode.
@ -318,9 +282,6 @@ extern SDL_DECLSPEC SDL_Scancode SDLCALL SDL_GetScancodeFromName(const char *nam
/**
* Get a human-readable name for a key.
*
* Both lowercase and uppercase alphabetic keycodes have uppercase names, e.g.
* SDL_Keycode 'a' and 'A' both have the name "A".
*
* If the key doesn't have a name, this function returns an empty string ("").
*
* \param key the desired SDL_Keycode to query.
@ -361,8 +322,8 @@ extern SDL_DECLSPEC SDL_Keycode SDLCALL SDL_GetKeyFromName(const char *name);
* On some platforms using this function shows the screen keyboard.
*
* \param window the window to enable text input.
* \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.
*
@ -371,7 +332,7 @@ extern SDL_DECLSPEC SDL_Keycode SDLCALL SDL_GetKeyFromName(const char *name);
* \sa SDL_StopTextInput
* \sa SDL_TextInputActive
*/
extern SDL_DECLSPEC int SDLCALL SDL_StartTextInput(SDL_Window *window);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_StartTextInput(SDL_Window *window);
/**
* Text input type.
@ -453,8 +414,8 @@ typedef enum SDL_Capitalization
*
* \param window the window to enable text input.
* \param props the 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.
*
@ -463,7 +424,7 @@ typedef enum SDL_Capitalization
* \sa SDL_StopTextInput
* \sa SDL_TextInputActive
*/
extern SDL_DECLSPEC int SDLCALL SDL_StartTextInputWithProperties(SDL_Window *window, SDL_PropertiesID props);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_StartTextInputWithProperties(SDL_Window *window, SDL_PropertiesID props);
#define SDL_PROP_TEXTINPUT_TYPE_NUMBER "SDL.textinput.type"
#define SDL_PROP_TEXTINPUT_CAPITALIZATION_NUMBER "SDL.textinput.capitalization"
@ -490,28 +451,28 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_TextInputActive(SDL_Window *window);
* it.
*
* \param window the window to disable text input.
* \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_StartTextInput
*/
extern SDL_DECLSPEC int SDLCALL SDL_StopTextInput(SDL_Window *window);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_StopTextInput(SDL_Window *window);
/**
* Dismiss the composition window/IME without disabling the subsystem.
*
* \param window the window to affect.
* \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_StartTextInput
* \sa SDL_StopTextInput
*/
extern SDL_DECLSPEC int SDLCALL SDL_ClearComposition(SDL_Window *window);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_ClearComposition(SDL_Window *window);
/**
* Set the area used to type Unicode text input.
@ -524,15 +485,15 @@ extern SDL_DECLSPEC int SDLCALL SDL_ClearComposition(SDL_Window *window);
* coordinates, or NULL to clear it.
* \param cursor the offset of the current cursor location relative to
* `rect->x`, in window coordinates.
* \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_GetTextInputArea
* \sa SDL_StartTextInput
*/
extern SDL_DECLSPEC int SDLCALL SDL_SetTextInputArea(SDL_Window *window, const SDL_Rect *rect, int cursor);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetTextInputArea(SDL_Window *window, const SDL_Rect *rect, int cursor);
/**
* Get the area used to type Unicode text input.
@ -544,14 +505,14 @@ extern SDL_DECLSPEC int SDLCALL SDL_SetTextInputArea(SDL_Window *window, const S
* may be NULL.
* \param cursor a pointer to the offset of the current cursor location
* relative to `rect->x`, may be NULL.
* \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_SetTextInputArea
*/
extern SDL_DECLSPEC int SDLCALL SDL_GetTextInputArea(SDL_Window *window, SDL_Rect *rect, int *cursor);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetTextInputArea(SDL_Window *window, SDL_Rect *rect, int *cursor);
/**
* Check whether the platform has screen keyboard support.

View File

@ -29,9 +29,27 @@
* it will only be sent out if it has that minimum priority or higher.
*
* SDL's own logs are sent below the default priority threshold, so they are
* quiet by default. If you're debugging SDL you might want:
* quiet by default.
*
* SDL_SetLogPriorities(SDL_LOG_PRIORITY_WARN);
* You can change the log verbosity programmatically using
* SDL_SetLogPriority() or with SDL_SetHint(SDL_HINT_LOGGING, ...), or with
* the "SDL_LOGGING" environment variable. This variable is a comma separated
* set of category=level tokens that define the default logging levels for SDL
* applications.
*
* The category can be a numeric category, one of "app", "error", "assert",
* "system", "audio", "video", "render", "input", "test", or `*` for any
* unspecified category.
*
* The level can be a numeric level, one of "verbose", "debug", "info",
* "warn", "error", "critical", or "quiet" to disable that category.
*
* You can omit the category if you want to set the logging level for all
* categories.
*
* If this hint isn't set, the default log levels are equivalent to:
*
* `app=info,assert=warn,test=verbose,*=error`
*
* Here's where the messages go on different platforms:
*
@ -54,9 +72,9 @@ extern "C" {
/**
* The predefined log categories
*
* By default the application category is enabled at the INFO level, the
* assert category is enabled at the WARN level, test is enabled at the
* VERBOSE level and all other categories are enabled at the ERROR level.
* By default the application and gpu categories are enabled at the INFO
* level, the assert category is enabled at the WARN level, test is enabled at
* the VERBOSE level and all other categories are enabled at the ERROR level.
*
* \since This enum is available since SDL 3.0.0.
*/
@ -69,6 +87,7 @@ typedef enum SDL_LogCategory
SDL_LOG_CATEGORY_AUDIO,
SDL_LOG_CATEGORY_VIDEO,
SDL_LOG_CATEGORY_RENDER,
SDL_LOG_CATEGORY_GPU,
SDL_LOG_CATEGORY_INPUT,
SDL_LOG_CATEGORY_TEST,
@ -163,6 +182,26 @@ extern SDL_DECLSPEC SDL_LogPriority SDLCALL SDL_GetLogPriority(int category);
*/
extern SDL_DECLSPEC void SDLCALL SDL_ResetLogPriorities(void);
/**
* Set the text prepended to log messages of a given priority.
*
* By default SDL_LOG_PRIORITY_INFO and below have no prefix, and
* SDL_LOG_PRIORITY_WARN and higher have a prefix showing their priority, e.g.
* "WARNING: ".
*
* \param priority the SDL_LogPriority to modify.
* \param prefix the prefix to use for that log priority, or NULL to use no
* prefix.
* \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_SetLogPriorities
* \sa SDL_SetLogPriority
*/
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetLogPriorityPrefix(SDL_LogPriority priority, const char *prefix);
/**
* Log a message with SDL_LOG_CATEGORY_APPLICATION and SDL_LOG_PRIORITY_INFO.
*

View File

@ -188,16 +188,12 @@
#define main SDL_main
#endif
#include <SDL3/SDL_init.h>
#include <SDL3/SDL_begin_code.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef int (SDLCALL *SDL_AppInit_func)(void **appstate, int argc, char *argv[]);
typedef int (SDLCALL *SDL_AppIterate_func)(void *appstate);
typedef int (SDLCALL *SDL_AppEvent_func)(void *appstate, const SDL_Event *event);
typedef void (SDLCALL *SDL_AppQuit_func)(void *appstate);
/*
* You can (optionally!) define SDL_MAIN_USE_CALLBACKS before including
* SDL_main.h, and then your application will _not_ have a standard
@ -224,49 +220,6 @@ typedef void (SDLCALL *SDL_AppQuit_func)(void *appstate);
*/
#ifdef SDL_MAIN_USE_CALLBACKS
/**
* Value that requests that the app continue from the main callbacks.
*
* If SDL_AppInit, SDL_AppEvent, or SDL_AppIterate returns this value, the
* program will continue to run. This is the normal return value case.
*
* This is always 0; using this macro may be clearer, but is not required.
*
* \since This macro is available since SDL 3.0.0.
*/
#define SDL_APP_CONTINUE 0
/**
* Value that requests termination with error from the main callbacks.
*
* If SDL_AppInit, SDL_AppEvent, or SDL_AppIterate returns this value, the
* program will terminate and report failure to the operating system.
*
* What that failure looks like is platform-dependent. On Unix, for example,
* the process error code will be non-zero.
*
* This is always -1; using this macro may be clearer, but is not required.
*
* \since This macro is available since SDL 3.0.0.
*/
#define SDL_APP_FAILURE -1
/**
* Value that requests termination with success from the main callbacks.
*
* If SDL_AppInit, SDL_AppEvent, or SDL_AppIterate returns this value, the
* program will terminate and report success to the operating system.
*
* What that success looks like is platform-dependent. On Unix, for example,
* the process error code will be zero.
*
* This is always 1; using this macro may be clearer, but is not required.
*
* \since This macro is available since SDL 3.0.0.
*/
#define SDL_APP_SUCCESS 1
/**
* App-implemented initial entry point for SDL_MAIN_USE_CALLBACKS apps.
*
@ -311,7 +264,7 @@ typedef void (SDLCALL *SDL_AppQuit_func)(void *appstate);
* \sa SDL_AppEvent
* \sa SDL_AppQuit
*/
extern SDLMAIN_DECLSPEC int SDLCALL SDL_AppInit(void **appstate, int argc, char *argv[]);
extern SDLMAIN_DECLSPEC SDL_AppResult SDLCALL SDL_AppInit(void **appstate, int argc, char *argv[]);
/**
* App-implemented iteration entry point for SDL_MAIN_USE_CALLBACKS apps.
@ -359,7 +312,7 @@ extern SDLMAIN_DECLSPEC int SDLCALL SDL_AppInit(void **appstate, int argc, char
* \sa SDL_AppInit
* \sa SDL_AppEvent
*/
extern SDLMAIN_DECLSPEC int SDLCALL SDL_AppIterate(void *appstate);
extern SDLMAIN_DECLSPEC SDL_AppResult SDLCALL SDL_AppIterate(void *appstate);
/**
* App-implemented event entry point for SDL_MAIN_USE_CALLBACKS apps.
@ -406,7 +359,7 @@ extern SDLMAIN_DECLSPEC int SDLCALL SDL_AppIterate(void *appstate);
* \sa SDL_AppInit
* \sa SDL_AppIterate
*/
extern SDLMAIN_DECLSPEC int SDLCALL SDL_AppEvent(void *appstate, const SDL_Event *event);
extern SDLMAIN_DECLSPEC SDL_AppResult SDLCALL SDL_AppEvent(void *appstate, const SDL_Event *event);
/**
* App-implemented deinit entry point for SDL_MAIN_USE_CALLBACKS apps.
@ -525,8 +478,9 @@ extern SDL_DECLSPEC void SDLCALL SDL_SetMainReady(void);
* literally have to be `main`.
* \param reserved should be NULL (reserved for future use, will probably be
* platform-specific then).
* \returns the return value from mainFunction: 0 on success, -1 on failure;
* SDL_GetError() might have more information on the failure.
* \returns the return value from mainFunction: 0 on success, otherwise
* failure; SDL_GetError() might have more information on the
* failure.
*
* \threadsafety Generally this is called once, near startup, from the
* process's initial thread.
@ -584,12 +538,12 @@ extern SDL_DECLSPEC int SDLCALL SDL_EnterAppMainCallbacks(int argc, char *argv[]
* what is specified here.
* \param hInst the HINSTANCE to use in WNDCLASSEX::hInstance. If zero, SDL
* will use `GetModuleHandle(NULL)` instead.
* \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.
*/
extern SDL_DECLSPEC int SDLCALL SDL_RegisterApp(const char *name, Uint32 style, void *hInst);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_RegisterApp(const char *name, Uint32 style, void *hInst);
/**
* Deregister the win32 window class from an SDL_RegisterApp call.
@ -631,7 +585,8 @@ extern SDL_DECLSPEC void SDLCALL SDL_GDKSuspendComplete(void);
/* include header-only SDL_main implementations */
#if defined(SDL_MAIN_USE_CALLBACKS) \
|| defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_GDK) || defined(SDL_PLATFORM_IOS) || defined(SDL_PLATFORM_TVOS) \
|| defined(SDL_PLATFORM_3DS) || defined(SDL_PLATFORM_NGAGE) || defined(SDL_PLATFORM_PS2) || defined(SDL_PLATFORM_PSP)
|| defined(SDL_PLATFORM_3DS) || defined(SDL_PLATFORM_NGAGE) || defined(SDL_PLATFORM_PS2) || defined(SDL_PLATFORM_PSP) \
|| defined(SDL_PLATFORM_EMSCRIPTEN)
/* platforms which main (-equivalent) can be implemented in plain C */
#include <SDL3/SDL_main_impl.h>

View File

@ -154,14 +154,14 @@ typedef struct SDL_MessageBoxData
* other options.
* \param buttonid the pointer to which user id of hit button should be
* copied.
* \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_ShowSimpleMessageBox
*/
extern SDL_DECLSPEC int SDLCALL SDL_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid);
/**
* Display a simple modal message box.
@ -196,14 +196,14 @@ extern SDL_DECLSPEC int SDLCALL SDL_ShowMessageBox(const SDL_MessageBoxData *mes
* \param title uTF-8 title text.
* \param message uTF-8 message text.
* \param window the parent window, or NULL for no parent.
* \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_ShowMessageBox
*/
extern SDL_DECLSPEC int SDLCALL SDL_ShowSimpleMessageBox(SDL_MessageBoxFlags flags, const char *title, const char *message, SDL_Window *window);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_ShowSimpleMessageBox(SDL_MessageBoxFlags flags, const char *title, const char *message, SDL_Window *window);
/* Ends C function definitions when using C++ */

View File

@ -62,12 +62,12 @@ extern "C" {
*
* \param url a valid URL/URI to open. Use `file:///full/path/to/file` for
* local files, if supported.
* \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.
*/
extern SDL_DECLSPEC int SDLCALL SDL_OpenURL(const char *url);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_OpenURL(const char *url);
/* Ends C function definitions when using C++ */
#ifdef __cplusplus

View File

@ -38,9 +38,26 @@
extern "C" {
#endif
/**
* This is a unique ID for a mouse for the time it is connected to the system,
* and is never reused for the lifetime of the application.
*
* If the mouse is disconnected and reconnected, it will get a new ID.
*
* The value 0 is an invalid ID.
*
* \since This datatype is available since SDL 3.0.0.
*/
typedef Uint32 SDL_MouseID;
typedef struct SDL_Cursor SDL_Cursor; /**< Implementation dependent */
/**
* The structure used to identify an SDL cursor.
*
* This is opaque data.
*
* \since This struct is available since SDL 3.0.0.
*/
typedef struct SDL_Cursor SDL_Cursor;
/**
* Cursor types for SDL_CreateSystemCursor().
@ -278,33 +295,48 @@ extern SDL_DECLSPEC void SDLCALL SDL_WarpMouseInWindow(SDL_Window * window,
*
* \param x the x coordinate.
* \param y the y coordinate.
* \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_WarpMouseInWindow
*/
extern SDL_DECLSPEC int SDLCALL SDL_WarpMouseGlobal(float x, float y);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_WarpMouseGlobal(float x, float y);
/**
* Set relative mouse mode.
* Set relative mouse mode for a window.
*
* While the mouse is in relative mode, the cursor is hidden, the mouse
* position is constrained to the window, and SDL will report continuous
* relative mouse motion even if the mouse is at the edge of the window.
* While the window has focus and relative mouse mode is enabled, the cursor
* is hidden, the mouse position is constrained to the window, and SDL will
* report continuous relative mouse motion even if the mouse is at the edge of
* the window.
*
* This function will flush any pending mouse motion.
* This function will flush any pending mouse motion for this window.
*
* \param window the window to change.
* \param enabled SDL_TRUE to enable relative mode, SDL_FALSE to disable.
* \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_GetRelativeMouseMode
* \sa SDL_GetWindowRelativeMouseMode
*/
extern SDL_DECLSPEC int SDLCALL SDL_SetRelativeMouseMode(SDL_bool enabled);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetWindowRelativeMouseMode(SDL_Window *window, SDL_bool enabled);
/**
* Query whether relative mouse mode is enabled for a window.
*
* \param window the window to query.
* \returns SDL_TRUE if relative mode is enabled for a window or SDL_FALSE
* otherwise.
*
* \since This function is available since SDL 3.0.0.
*
* \sa SDL_SetWindowRelativeMouseMode
*/
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetWindowRelativeMouseMode(SDL_Window *window);
/**
* Capture the mouse and to track input outside an SDL window.
@ -321,7 +353,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_SetRelativeMouseMode(SDL_bool enabled);
* mouse while the user is dragging something, until the user releases a mouse
* button. It is not recommended that you capture the mouse for long periods
* of time, such as the entire time your app is running. For that, you should
* probably use SDL_SetRelativeMouseMode() or SDL_SetWindowMouseGrab(),
* probably use SDL_SetWindowRelativeMouseMode() or SDL_SetWindowMouseGrab(),
* depending on your goals.
*
* While captured, mouse events still report coordinates relative to the
@ -343,25 +375,14 @@ extern SDL_DECLSPEC int SDLCALL SDL_SetRelativeMouseMode(SDL_bool enabled);
* `SDL_HINT_MOUSE_AUTO_CAPTURE` hint to zero.
*
* \param enabled SDL_TRUE to enable capturing, SDL_FALSE to disable.
* \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_GetGlobalMouseState
*/
extern SDL_DECLSPEC int SDLCALL SDL_CaptureMouse(SDL_bool enabled);
/**
* Query whether relative mouse mode is enabled.
*
* \returns SDL_TRUE if relative mode is enabled or SDL_FALSE otherwise.
*
* \since This function is available since SDL 3.0.0.
*
* \sa SDL_SetRelativeMouseMode
*/
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetRelativeMouseMode(void);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_CaptureMouse(SDL_bool enabled);
/**
* Create a cursor using the specified bitmap data and mask (in MSB format).
@ -419,8 +440,9 @@ extern SDL_DECLSPEC SDL_Cursor * SDLCALL SDL_CreateCursor(const Uint8 * data,
* situations. For example, if the original surface is 32x32, then on a 2x
* macOS display or 200% display scale on Windows, a 64x64 version of the
* image will be used, if available. If a matching version of the image isn't
* available, the closest size image will be scaled to the appropriate size
* and be used instead.
* available, the closest larger size image will be downscaled to the
* appropriate size and be used instead, if available. Otherwise, the closest
* smaller image will be upscaled and be used instead.
*
* \param surface an SDL_Surface structure representing the cursor image.
* \param hot_x the x position of the cursor hot spot.
@ -461,14 +483,14 @@ extern SDL_DECLSPEC SDL_Cursor * SDLCALL SDL_CreateSystemCursor(SDL_SystemCursor
* this is desired for any reason.
*
* \param cursor a cursor to make active.
* \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_GetCursor
*/
extern SDL_DECLSPEC int SDLCALL SDL_SetCursor(SDL_Cursor *cursor);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetCursor(SDL_Cursor *cursor);
/**
* Get the active cursor.
@ -516,28 +538,28 @@ extern SDL_DECLSPEC void SDLCALL SDL_DestroyCursor(SDL_Cursor *cursor);
/**
* Show the cursor.
*
* \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_CursorVisible
* \sa SDL_HideCursor
*/
extern SDL_DECLSPEC int SDLCALL SDL_ShowCursor(void);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_ShowCursor(void);
/**
* Hide the cursor.
*
* \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_CursorVisible
* \sa SDL_ShowCursor
*/
extern SDL_DECLSPEC int SDLCALL SDL_HideCursor(void);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_HideCursor(void);
/**
* Return whether the cursor is currently being shown.

View File

@ -115,16 +115,6 @@
extern "C" {
#endif
/**
* Synchronization functions return this value if they time out.
*
* Not all functions _can_ time out; some will block indefinitely.
*
* \since This macro is available since SDL 3.0.0.
*/
#define SDL_MUTEX_TIMEDOUT 1
/**
* \name Mutex functions
*/
@ -194,25 +184,22 @@ extern SDL_DECLSPEC void SDLCALL SDL_LockMutex(SDL_Mutex *mutex) SDL_ACQUIRE(mut
* Try to lock a mutex without blocking.
*
* This works just like SDL_LockMutex(), but if the mutex is not available,
* this function returns `SDL_MUTEX_TIMEDOUT` immediately.
* this function returns SDL_FALSE immediately.
*
* This technique is useful if you need exclusive access to a resource but
* don't want to wait for it, and will return to it to try again later.
*
* This function does not fail; if mutex is NULL, it will return 0 immediately
* having locked nothing. If the mutex is valid, this function will always
* either lock the mutex and return 0, or return SDL_MUTEX_TIMEOUT and lock
* nothing.
* This function returns SDL_TRUE if passed a NULL mutex.
*
* \param mutex the mutex to try to lock.
* \returns 0 or `SDL_MUTEX_TIMEDOUT`.
* \returns SDL_TRUE on success, SDL_FALSE if the mutex would block.
*
* \since This function is available since SDL 3.0.0.
*
* \sa SDL_LockMutex
* \sa SDL_UnlockMutex
*/
extern SDL_DECLSPEC int SDLCALL SDL_TryLockMutex(SDL_Mutex *mutex) SDL_TRY_ACQUIRE(0, mutex);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_TryLockMutex(SDL_Mutex *mutex) SDL_TRY_ACQUIRE(0, mutex);
/**
* Unlock the mutex.
@ -278,19 +265,6 @@ extern SDL_DECLSPEC void SDLCALL SDL_DestroyMutex(SDL_Mutex *mutex);
*/
typedef struct SDL_RWLock SDL_RWLock;
/*
* Synchronization functions return this value if they time out.
*
* Not all functions _can_ time out; some will block indefinitely.
*
* This symbol is just for clarity when dealing with SDL_RWLock
* functions; its value is equivalent to SDL_MUTEX_TIMEOUT.
*
* \since This macro is available since SDL 3.0.0.
*/
#define SDL_RWLOCK_TIMEDOUT SDL_MUTEX_TIMEDOUT
/**
* Create a new read/write lock.
*
@ -405,7 +379,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_LockRWLockForWriting(SDL_RWLock *rwlock) SD
* Try to lock a read/write lock _for reading_ without blocking.
*
* This works just like SDL_LockRWLockForReading(), but if the rwlock is not
* available, then this function returns `SDL_RWLOCK_TIMEDOUT` immediately.
* available, then this function returns SDL_FALSE immediately.
*
* This technique is useful if you need access to a resource but don't want to
* wait for it, and will return to it to try again later.
@ -413,13 +387,10 @@ extern SDL_DECLSPEC void SDLCALL SDL_LockRWLockForWriting(SDL_RWLock *rwlock) SD
* Trying to lock for read-only access can succeed if other threads are
* holding read-only locks, as this won't prevent access.
*
* This function does not fail; if rwlock is NULL, it will return 0
* immediately having locked nothing. If rwlock is valid, this function will
* always either lock the rwlock and return 0, or return SDL_RWLOCK_TIMEOUT
* and lock nothing.
* This function returns SDL_TRUE if passed a NULL rwlock.
*
* \param rwlock the rwlock to try to lock.
* \returns 0 or `SDL_RWLOCK_TIMEDOUT`.
* \returns SDL_TRUE on success, SDL_FALSE if the lock would block.
*
* \since This function is available since SDL 3.0.0.
*
@ -427,13 +398,13 @@ extern SDL_DECLSPEC void SDLCALL SDL_LockRWLockForWriting(SDL_RWLock *rwlock) SD
* \sa SDL_TryLockRWLockForWriting
* \sa SDL_UnlockRWLock
*/
extern SDL_DECLSPEC int SDLCALL SDL_TryLockRWLockForReading(SDL_RWLock *rwlock) SDL_TRY_ACQUIRE_SHARED(0, rwlock);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_TryLockRWLockForReading(SDL_RWLock *rwlock) SDL_TRY_ACQUIRE_SHARED(0, rwlock);
/**
* Try to lock a read/write lock _for writing_ without blocking.
*
* This works just like SDL_LockRWLockForWriting(), but if the rwlock is not
* available, this function returns `SDL_RWLOCK_TIMEDOUT` immediately.
* available, then this function returns SDL_FALSE immediately.
*
* This technique is useful if you need exclusive access to a resource but
* don't want to wait for it, and will return to it to try again later.
@ -446,13 +417,10 @@ extern SDL_DECLSPEC int SDLCALL SDL_TryLockRWLockForReading(SDL_RWLock *rwlock)
* read-only lock. Doing so results in undefined behavior. Unlock the
* read-only lock before requesting a write lock.
*
* This function does not fail; if rwlock is NULL, it will return 0
* immediately having locked nothing. If rwlock is valid, this function will
* always either lock the rwlock and return 0, or return SDL_RWLOCK_TIMEOUT
* and lock nothing.
* This function returns SDL_TRUE if passed a NULL rwlock.
*
* \param rwlock the rwlock to try to lock.
* \returns 0 or `SDL_RWLOCK_TIMEDOUT`.
* \returns SDL_TRUE on success, SDL_FALSE if the lock would block.
*
* \since This function is available since SDL 3.0.0.
*
@ -460,7 +428,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_TryLockRWLockForReading(SDL_RWLock *rwlock)
* \sa SDL_TryLockRWLockForReading
* \sa SDL_UnlockRWLock
*/
extern SDL_DECLSPEC int SDLCALL SDL_TryLockRWLockForWriting(SDL_RWLock *rwlock) SDL_TRY_ACQUIRE(0, rwlock);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_TryLockRWLockForWriting(SDL_RWLock *rwlock) SDL_TRY_ACQUIRE(0, rwlock);
/**
* Unlock the read/write lock.
@ -569,17 +537,14 @@ extern SDL_DECLSPEC void SDLCALL SDL_DestroySemaphore(SDL_Semaphore *sem);
/**
* Wait until a semaphore has a positive value and then decrements it.
*
* This function suspends the calling thread until either the semaphore
* pointed to by `sem` has a positive value or the call is interrupted by a
* signal or error. If the call is successful it will atomically decrement the
* semaphore value.
* This function suspends the calling thread until the semaphore pointed to by
* `sem` has a positive value, and then atomically decrement the semaphore
* value.
*
* This function is the equivalent of calling SDL_WaitSemaphoreTimeout() with
* a time length of -1.
*
* \param sem the semaphore wait on.
* \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information.
*
* \since This function is available since SDL 3.0.0.
*
@ -587,7 +552,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_DestroySemaphore(SDL_Semaphore *sem);
* \sa SDL_TryWaitSemaphore
* \sa SDL_WaitSemaphoreTimeout
*/
extern SDL_DECLSPEC int SDLCALL SDL_WaitSemaphore(SDL_Semaphore *sem);
extern SDL_DECLSPEC void SDLCALL SDL_WaitSemaphore(SDL_Semaphore *sem);
/**
* See if a semaphore has a positive value and decrement it if it does.
@ -595,12 +560,10 @@ extern SDL_DECLSPEC int SDLCALL SDL_WaitSemaphore(SDL_Semaphore *sem);
* This function checks to see if the semaphore pointed to by `sem` has a
* positive value and atomically decrements the semaphore value if it does. If
* the semaphore doesn't have a positive value, the function immediately
* returns SDL_MUTEX_TIMEDOUT.
* returns SDL_FALSE.
*
* \param sem the semaphore to wait on.
* \returns 0 if the wait succeeds, `SDL_MUTEX_TIMEDOUT` if the wait would
* block, or a negative error code on failure; call SDL_GetError()
* for more information.
* \returns SDL_TRUE if the wait succeeds, SDL_FALSE if the wait would block.
*
* \since This function is available since SDL 3.0.0.
*
@ -608,21 +571,19 @@ extern SDL_DECLSPEC int SDLCALL SDL_WaitSemaphore(SDL_Semaphore *sem);
* \sa SDL_WaitSemaphore
* \sa SDL_WaitSemaphoreTimeout
*/
extern SDL_DECLSPEC int SDLCALL SDL_TryWaitSemaphore(SDL_Semaphore *sem);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_TryWaitSemaphore(SDL_Semaphore *sem);
/**
* Wait until a semaphore has a positive value and then decrements it.
*
* This function suspends the calling thread until either the semaphore
* pointed to by `sem` has a positive value, the call is interrupted by a
* signal or error, or the specified time has elapsed. If the call is
* successful it will atomically decrement the semaphore value.
* pointed to by `sem` has a positive value or the specified time has elapsed.
* If the call is successful it will atomically decrement the semaphore value.
*
* \param sem the semaphore to wait on.
* \param timeoutMS the length of the timeout, in milliseconds.
* \returns 0 if the wait succeeds, `SDL_MUTEX_TIMEDOUT` if the wait does not
* succeed in the allotted time, or a negative error code on failure;
* call SDL_GetError() for more information.
* \param timeoutMS the length of the timeout, in milliseconds, or -1 to wait
* indefinitely.
* \returns SDL_TRUE if the wait succeeds or SDL_FALSE if the wait times out.
*
* \since This function is available since SDL 3.0.0.
*
@ -630,14 +591,12 @@ extern SDL_DECLSPEC int SDLCALL SDL_TryWaitSemaphore(SDL_Semaphore *sem);
* \sa SDL_TryWaitSemaphore
* \sa SDL_WaitSemaphore
*/
extern SDL_DECLSPEC int SDLCALL SDL_WaitSemaphoreTimeout(SDL_Semaphore *sem, Sint32 timeoutMS);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_WaitSemaphoreTimeout(SDL_Semaphore *sem, Sint32 timeoutMS);
/**
* Atomically increment a semaphore's value and wake waiting threads.
*
* \param sem the semaphore to increment.
* \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information.
*
* \since This function is available since SDL 3.0.0.
*
@ -645,7 +604,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_WaitSemaphoreTimeout(SDL_Semaphore *sem, Sin
* \sa SDL_WaitSemaphore
* \sa SDL_WaitSemaphoreTimeout
*/
extern SDL_DECLSPEC int SDLCALL SDL_SignalSemaphore(SDL_Semaphore *sem);
extern SDL_DECLSPEC void SDLCALL SDL_SignalSemaphore(SDL_Semaphore *sem);
/**
* Get the current value of a semaphore.
@ -711,8 +670,6 @@ extern SDL_DECLSPEC void SDLCALL SDL_DestroyCondition(SDL_Condition *cond);
* Restart one of the threads that are waiting on the condition variable.
*
* \param cond the condition variable to signal.
* \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information.
*
* \threadsafety It is safe to call this function from any thread.
*
@ -722,14 +679,12 @@ extern SDL_DECLSPEC void SDLCALL SDL_DestroyCondition(SDL_Condition *cond);
* \sa SDL_WaitCondition
* \sa SDL_WaitConditionTimeout
*/
extern SDL_DECLSPEC int SDLCALL SDL_SignalCondition(SDL_Condition *cond);
extern SDL_DECLSPEC void SDLCALL SDL_SignalCondition(SDL_Condition *cond);
/**
* Restart all threads that are waiting on the condition variable.
*
* \param cond the condition variable to signal.
* \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information.
*
* \threadsafety It is safe to call this function from any thread.
*
@ -739,7 +694,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_SignalCondition(SDL_Condition *cond);
* \sa SDL_WaitCondition
* \sa SDL_WaitConditionTimeout
*/
extern SDL_DECLSPEC int SDLCALL SDL_BroadcastCondition(SDL_Condition *cond);
extern SDL_DECLSPEC void SDLCALL SDL_BroadcastCondition(SDL_Condition *cond);
/**
* Wait until a condition variable is signaled.
@ -758,8 +713,6 @@ extern SDL_DECLSPEC int SDLCALL SDL_BroadcastCondition(SDL_Condition *cond);
*
* \param cond the condition variable to wait on.
* \param mutex the mutex used to coordinate thread access.
* \returns 0 when it is signaled or a negative error code on failure; call
* SDL_GetError() for more information.
*
* \threadsafety It is safe to call this function from any thread.
*
@ -769,7 +722,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_BroadcastCondition(SDL_Condition *cond);
* \sa SDL_SignalCondition
* \sa SDL_WaitConditionTimeout
*/
extern SDL_DECLSPEC int SDLCALL SDL_WaitCondition(SDL_Condition *cond, SDL_Mutex *mutex);
extern SDL_DECLSPEC void SDLCALL SDL_WaitCondition(SDL_Condition *cond, SDL_Mutex *mutex);
/**
* Wait until a condition variable is signaled or a certain time has passed.
@ -788,9 +741,8 @@ extern SDL_DECLSPEC int SDLCALL SDL_WaitCondition(SDL_Condition *cond, SDL_Mutex
* \param mutex the mutex used to coordinate thread access.
* \param timeoutMS the maximum time to wait, in milliseconds, or -1 to wait
* indefinitely.
* \returns 0 if the condition variable is signaled, `SDL_MUTEX_TIMEDOUT` if
* the condition is not signaled in the allotted time, or a negative
* error code on failure; call SDL_GetError() for more information.
* \returns SDL_TRUE if the condition variable is signaled, SDL_FALSE if the
* condition is not signaled in the allotted time.
*
* \threadsafety It is safe to call this function from any thread.
*
@ -800,7 +752,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_WaitCondition(SDL_Condition *cond, SDL_Mutex
* \sa SDL_SignalCondition
* \sa SDL_WaitCondition
*/
extern SDL_DECLSPEC int SDLCALL SDL_WaitConditionTimeout(SDL_Condition *cond,
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_WaitConditionTimeout(SDL_Condition *cond,
SDL_Mutex *mutex, Sint32 timeoutMS);
/* @} *//* Condition variable functions */

View File

@ -40,7 +40,9 @@
/* ##SDL_atomic.h */
#define SDL_AtomicCAS SDL_AtomicCompareAndSwap
#define SDL_AtomicCASPtr SDL_AtomicCompareAndSwapPointer
#define SDL_AtomicGetPtr SDL_AtomicGetPointer
#define SDL_AtomicLock SDL_LockSpinlock
#define SDL_AtomicSetPtr SDL_AtomicSetPointer
#define SDL_AtomicTryLock SDL_TryLockSpinlock
#define SDL_AtomicUnlock SDL_UnlockSpinlock
#define SDL_atomic_t SDL_AtomicInt
@ -116,6 +118,7 @@
#define SDL_DROPCOMPLETE SDL_EVENT_DROP_COMPLETE
#define SDL_DROPFILE SDL_EVENT_DROP_FILE
#define SDL_DROPTEXT SDL_EVENT_DROP_TEXT
#define SDL_DelEventWatch SDL_RemoveEventWatch
#define SDL_FINGERDOWN SDL_EVENT_FINGER_DOWN
#define SDL_FINGERMOTION SDL_EVENT_FINGER_MOTION
#define SDL_FINGERUP SDL_EVENT_FINGER_UP
@ -296,6 +299,7 @@
#define SDL_MouseIsHaptic SDL_IsMouseHaptic
/* ##SDL_hints.h */
#define SDL_DelHintCallback SDL_RemoveHintCallback
#define SDL_HINT_ALLOW_TOPMOST SDL_HINT_WINDOW_ALLOW_TOPMOST
#define SDL_HINT_DIRECTINPUT_ENABLED SDL_HINT_JOYSTICK_DIRECTINPUT
#define SDL_HINT_GDK_TEXTINPUT_DEFAULT SDL_HINT_GDK_TEXTINPUT_DEFAULT_TEXT
@ -523,7 +527,6 @@
#define SDL_RenderSetVSync SDL_SetRenderVSync
#define SDL_RenderSetViewport SDL_SetRenderViewport
#define SDL_RenderWindowToLogical SDL_RenderCoordinatesFromWindow
#define SDL_ScaleModeBest SDL_SCALEMODE_BEST
#define SDL_ScaleModeLinear SDL_SCALEMODE_LINEAR
#define SDL_ScaleModeNearest SDL_SCALEMODE_NEAREST
@ -660,7 +663,9 @@
/* ##SDL_atomic.h */
#define SDL_AtomicCAS SDL_AtomicCAS_renamed_SDL_AtomicCompareAndSwap
#define SDL_AtomicCASPtr SDL_AtomicCASPtr_renamed_SDL_AtomicCompareAndSwapPointer
#define SDL_AtomicGetPtr SDL_AtomicGetPtr_renamed_SDL_AtomicGetPointer
#define SDL_AtomicLock SDL_AtomicLock_renamed_SDL_LockSpinlock
#define SDL_AtomicSetPtr SDL_AtomicSetPtr_renamed_SDL_AtomicSetPointer
#define SDL_AtomicTryLock SDL_AtomicTryLock_renamed_SDL_TryLockSpinlock
#define SDL_AtomicUnlock SDL_AtomicUnlock_renamed_SDL_UnlockSpinlock
#define SDL_atomic_t SDL_atomic_t_renamed_SDL_AtomicInt
@ -736,6 +741,7 @@
#define SDL_DROPCOMPLETE SDL_DROPCOMPLETE_renamed_SDL_EVENT_DROP_COMPLETE
#define SDL_DROPFILE SDL_DROPFILE_renamed_SDL_EVENT_DROP_FILE
#define SDL_DROPTEXT SDL_DROPTEXT_renamed_SDL_EVENT_DROP_TEXT
#define SDL_DelEventWatch SDL_DelEventWatch_renamed_SDL_RemoveEventWatch
#define SDL_FINGERDOWN SDL_FINGERDOWN_renamed_SDL_EVENT_FINGER_DOWN
#define SDL_FINGERMOTION SDL_FINGERMOTION_renamed_SDL_EVENT_FINGER_MOTION
#define SDL_FINGERUP SDL_FINGERUP_renamed_SDL_EVENT_FINGER_UP
@ -917,6 +923,7 @@
#define SDL_MouseIsHaptic SDL_MouseIsHaptic_renamed_SDL_IsMouseHaptic
/* ##SDL_hints.h */
#define SDL_DelHintCallback SDL_DelHintCallback_renamed_SDL_RemoveHintCallback
#define SDL_HINT_ALLOW_TOPMOST SDL_HINT_ALLOW_TOPMOST_renamed_SDL_HINT_WINDOW_ALLOW_TOPMOST
#define SDL_HINT_DIRECTINPUT_ENABLED SDL_HINT_DIRECTINPUT_ENABLED_renamed_SDL_HINT_JOYSTICK_DIRECTINPUT
#define SDL_HINT_GDK_TEXTINPUT_DEFAULT SDL_HINT_GDK_TEXTINPUT_DEFAULT_renamed_SDL_HINT_GDK_TEXTINPUT_DEFAULT_TEXT
@ -1144,7 +1151,6 @@
#define SDL_RenderSetVSync SDL_RenderSetVSync_renamed_SDL_SetRenderVSync
#define SDL_RenderSetViewport SDL_RenderSetViewport_renamed_SDL_SetRenderViewport
#define SDL_RenderWindowToLogical SDL_RenderWindowToLogical_renamed_SDL_RenderCoordinatesFromWindow
#define SDL_ScaleModeBest SDL_ScaleModeBest_renamed_SDL_SCALEMODE_BEST
#define SDL_ScaleModeLinear SDL_ScaleModeLinear_renamed_SDL_SCALEMODE_LINEAR
#define SDL_ScaleModeNearest SDL_ScaleModeNearest_renamed_SDL_SCALEMODE_NEAREST

View File

@ -9807,15 +9807,15 @@ typedef void (APIENTRYP PFNGLUPLOADGPUMASKNVXPROC) (GLbitfield mask);
typedef void (APIENTRYP PFNGLMULTICASTVIEWPORTARRAYVNVXPROC) (GLuint gpu, GLuint first, GLsizei count, const GLfloat *v);
typedef void (APIENTRYP PFNGLMULTICASTVIEWPORTPOSITIONWSCALENVXPROC) (GLuint gpu, GLuint index, GLfloat xcoeff, GLfloat ycoeff);
typedef void (APIENTRYP PFNGLMULTICASTSCISSORARRAYVNVXPROC) (GLuint gpu, GLuint first, GLsizei count, const GLint *v);
typedef GLuint (APIENTRYP PFNGLASYNCCOPYBUFFERSUBDATANVXPROC) (GLsizei waitSemaphoreCount, const GLuint *waitSemaphoreArray, const GLuint64 *fenceValueArray, GLuint readGpu, GLbitfield writeGpuMask, GLuint readBuffer, GLuint writeBuffer, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size, GLsizei signalSemaphoreCount, const GLuint *signalSemaphoreArray, const GLuint64 *signalValueArray);
typedef GLuint (APIENTRYP PFNGLASYNCCOPYIMAGESUBDATANVXPROC) (GLsizei waitSemaphoreCount, const GLuint *waitSemaphoreArray, const GLuint64 *waitValueArray, GLuint srcGpu, GLbitfield dstGpuMask, GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei srcWidth, GLsizei srcHeight, GLsizei srcDepth, GLsizei signalSemaphoreCount, const GLuint *signalSemaphoreArray, const GLuint64 *signalValueArray);
typedef GLuint (APIENTRYP PFNGLASYNCCOPYBUFFERSUBDATANVXPROC) (GLsizei waitSemaphoreCount, const GLuint *waitSemaphoreArray, const GLuint64 *fenceValueArray, GLuint readGPU, GLbitfield writeGPUMask, GLuint readBuffer, GLuint writeBuffer, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size, GLsizei signalSemaphoreCount, const GLuint *signalSemaphoreArray, const GLuint64 *signalValueArray);
typedef GLuint (APIENTRYP PFNGLASYNCCOPYIMAGESUBDATANVXPROC) (GLsizei waitSemaphoreCount, const GLuint *waitSemaphoreArray, const GLuint64 *waitValueArray, GLuint srcGPU, GLbitfield dstGPUMask, GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei srcWidth, GLsizei srcHeight, GLsizei srcDepth, GLsizei signalSemaphoreCount, const GLuint *signalSemaphoreArray, const GLuint64 *signalValueArray);
#ifdef GL_GLEXT_PROTOTYPES
GLAPI void APIENTRY glUploadGpuMaskNVX (GLbitfield mask);
GLAPI void APIENTRY glUploadGPUMaskNVX (GLbitfield mask);
GLAPI void APIENTRY glMulticastViewportArrayvNVX (GLuint gpu, GLuint first, GLsizei count, const GLfloat *v);
GLAPI void APIENTRY glMulticastViewportPositionWScaleNVX (GLuint gpu, GLuint index, GLfloat xcoeff, GLfloat ycoeff);
GLAPI void APIENTRY glMulticastScissorArrayvNVX (GLuint gpu, GLuint first, GLsizei count, const GLint *v);
GLAPI GLuint APIENTRY glAsyncCopyBufferSubDataNVX (GLsizei waitSemaphoreCount, const GLuint *waitSemaphoreArray, const GLuint64 *fenceValueArray, GLuint readGpu, GLbitfield writeGpuMask, GLuint readBuffer, GLuint writeBuffer, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size, GLsizei signalSemaphoreCount, const GLuint *signalSemaphoreArray, const GLuint64 *signalValueArray);
GLAPI GLuint APIENTRY glAsyncCopyImageSubDataNVX (GLsizei waitSemaphoreCount, const GLuint *waitSemaphoreArray, const GLuint64 *waitValueArray, GLuint srcGpu, GLbitfield dstGpuMask, GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei srcWidth, GLsizei srcHeight, GLsizei srcDepth, GLsizei signalSemaphoreCount, const GLuint *signalSemaphoreArray, const GLuint64 *signalValueArray);
GLAPI GLuint APIENTRY glAsyncCopyBufferSubDataNVX (GLsizei waitSemaphoreCount, const GLuint *waitSemaphoreArray, const GLuint64 *fenceValueArray, GLuint readGPU, GLbitfield writeGPUMask, GLuint readBuffer, GLuint writeBuffer, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size, GLsizei signalSemaphoreCount, const GLuint *signalSemaphoreArray, const GLuint64 *signalValueArray);
GLAPI GLuint APIENTRY glAsyncCopyImageSubDataNVX (GLsizei waitSemaphoreCount, const GLuint *waitSemaphoreArray, const GLuint64 *waitValueArray, GLuint srcGPU, GLbitfield dstGPUMask, GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei srcWidth, GLsizei srcHeight, GLsizei srcDepth, GLsizei signalSemaphoreCount, const GLuint *signalSemaphoreArray, const GLuint64 *signalValueArray);
#endif
#endif /* GL_NVX_gpu_multicast2 */
@ -9824,11 +9824,11 @@ GLAPI GLuint APIENTRY glAsyncCopyImageSubDataNVX (GLsizei waitSemaphoreCount, co
#define GL_LGPU_SEPARATE_STORAGE_BIT_NVX 0x0800
#define GL_MAX_LGPU_GPUS_NVX 0x92BA
typedef void (APIENTRYP PFNGLLGPUNAMEDBUFFERSUBDATANVXPROC) (GLbitfield gpuMask, GLuint buffer, GLintptr offset, GLsizeiptr size, const void *data);
typedef void (APIENTRYP PFNGLLGPUCOPYIMAGESUBDATANVXPROC) (GLuint sourceGpu, GLbitfield destinationGpuMask, GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srxY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei width, GLsizei height, GLsizei depth);
typedef void (APIENTRYP PFNGLLGPUCOPYIMAGESUBDATANVXPROC) (GLuint sourceGPU, GLbitfield destinationGPUMask, GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srxY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei width, GLsizei height, GLsizei depth);
typedef void (APIENTRYP PFNGLLGPUINTERLOCKNVXPROC) (void);
#ifdef GL_GLEXT_PROTOTYPES
GLAPI void APIENTRY glLGPUNamedBufferSubDataNVX (GLbitfield gpuMask, GLuint buffer, GLintptr offset, GLsizeiptr size, const void *data);
GLAPI void APIENTRY glLGPUCopyImageSubDataNVX (GLuint sourceGpu, GLbitfield destinationGpuMask, GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srxY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei width, GLsizei height, GLsizei depth);
GLAPI void APIENTRY glLGPUCopyImageSubDataNVX (GLuint sourceGPU, GLbitfield destinationGPUMask, GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srxY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei width, GLsizei height, GLsizei depth);
GLAPI void APIENTRY glLGPUInterlockNVX (void);
#endif
#endif /* GL_NVX_linked_gpu_multicast */
@ -9836,13 +9836,13 @@ GLAPI void APIENTRY glLGPUInterlockNVX (void);
#ifndef GL_NVX_progress_fence
#define GL_NVX_progress_fence 1
typedef GLuint (APIENTRYP PFNGLCREATEPROGRESSFENCENVXPROC) (void);
typedef void (APIENTRYP PFNGLSIGNALSEMAPHOREUI64NVXPROC) (GLuint signalGpu, GLsizei fenceObjectCount, const GLuint *semaphoreArray, const GLuint64 *fenceValueArray);
typedef void (APIENTRYP PFNGLWAITSEMAPHOREUI64NVXPROC) (GLuint waitGpu, GLsizei fenceObjectCount, const GLuint *semaphoreArray, const GLuint64 *fenceValueArray);
typedef void (APIENTRYP PFNGLSIGNALSEMAPHOREUI64NVXPROC) (GLuint signalGPU, GLsizei fenceObjectCount, const GLuint *semaphoreArray, const GLuint64 *fenceValueArray);
typedef void (APIENTRYP PFNGLWAITSEMAPHOREUI64NVXPROC) (GLuint waitGPU, GLsizei fenceObjectCount, const GLuint *semaphoreArray, const GLuint64 *fenceValueArray);
typedef void (APIENTRYP PFNGLCLIENTWAITSEMAPHOREUI64NVXPROC) (GLsizei fenceObjectCount, const GLuint *semaphoreArray, const GLuint64 *fenceValueArray);
#ifdef GL_GLEXT_PROTOTYPES
GLAPI GLuint APIENTRY glCreateProgressFenceNVX (void);
GLAPI void APIENTRY glSignalSemaphoreui64NVX (GLuint signalGpu, GLsizei fenceObjectCount, const GLuint *semaphoreArray, const GLuint64 *fenceValueArray);
GLAPI void APIENTRY glWaitSemaphoreui64NVX (GLuint waitGpu, GLsizei fenceObjectCount, const GLuint *semaphoreArray, const GLuint64 *fenceValueArray);
GLAPI void APIENTRY glSignalSemaphoreui64NVX (GLuint signalGPU, GLsizei fenceObjectCount, const GLuint *semaphoreArray, const GLuint64 *fenceValueArray);
GLAPI void APIENTRY glWaitSemaphoreui64NVX (GLuint waitGPU, GLsizei fenceObjectCount, const GLuint *semaphoreArray, const GLuint64 *fenceValueArray);
GLAPI void APIENTRY glClientWaitSemaphoreui64NVX (GLsizei fenceObjectCount, const GLuint *semaphoreArray, const GLuint64 *fenceValueArray);
#endif
#endif /* GL_NVX_progress_fence */
@ -10433,25 +10433,25 @@ GLAPI void APIENTRY glFramebufferTextureFaceEXT (GLenum target, GLenum attachmen
#define GL_MULTICAST_PROGRAMMABLE_SAMPLE_LOCATION_NV 0x9549
typedef void (APIENTRYP PFNGLRENDERGPUMASKNVPROC) (GLbitfield mask);
typedef void (APIENTRYP PFNGLMULTICASTBUFFERSUBDATANVPROC) (GLbitfield gpuMask, GLuint buffer, GLintptr offset, GLsizeiptr size, const void *data);
typedef void (APIENTRYP PFNGLMULTICASTCOPYBUFFERSUBDATANVPROC) (GLuint readGpu, GLbitfield writeGpuMask, GLuint readBuffer, GLuint writeBuffer, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size);
typedef void (APIENTRYP PFNGLMULTICASTCOPYIMAGESUBDATANVPROC) (GLuint srcGpu, GLbitfield dstGpuMask, GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei srcWidth, GLsizei srcHeight, GLsizei srcDepth);
typedef void (APIENTRYP PFNGLMULTICASTBLITFRAMEBUFFERNVPROC) (GLuint srcGpu, GLuint dstGpu, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
typedef void (APIENTRYP PFNGLMULTICASTCOPYBUFFERSUBDATANVPROC) (GLuint readGPU, GLbitfield writeGPUMask, GLuint readBuffer, GLuint writeBuffer, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size);
typedef void (APIENTRYP PFNGLMULTICASTCOPYIMAGESUBDATANVPROC) (GLuint srcGPU, GLbitfield dstGPUMask, GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei srcWidth, GLsizei srcHeight, GLsizei srcDepth);
typedef void (APIENTRYP PFNGLMULTICASTBLITFRAMEBUFFERNVPROC) (GLuint srcGPU, GLuint dstGPU, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
typedef void (APIENTRYP PFNGLMULTICASTFRAMEBUFFERSAMPLELOCATIONSFVNVPROC) (GLuint gpu, GLuint framebuffer, GLuint start, GLsizei count, const GLfloat *v);
typedef void (APIENTRYP PFNGLMULTICASTBARRIERNVPROC) (void);
typedef void (APIENTRYP PFNGLMULTICASTWAITSYNCNVPROC) (GLuint signalGpu, GLbitfield waitGpuMask);
typedef void (APIENTRYP PFNGLMULTICASTWAITSYNCNVPROC) (GLuint signalGPU, GLbitfield waitGPUMask);
typedef void (APIENTRYP PFNGLMULTICASTGETQUERYOBJECTIVNVPROC) (GLuint gpu, GLuint id, GLenum pname, GLint *params);
typedef void (APIENTRYP PFNGLMULTICASTGETQUERYOBJECTUIVNVPROC) (GLuint gpu, GLuint id, GLenum pname, GLuint *params);
typedef void (APIENTRYP PFNGLMULTICASTGETQUERYOBJECTI64VNVPROC) (GLuint gpu, GLuint id, GLenum pname, GLint64 *params);
typedef void (APIENTRYP PFNGLMULTICASTGETQUERYOBJECTUI64VNVPROC) (GLuint gpu, GLuint id, GLenum pname, GLuint64 *params);
#ifdef GL_GLEXT_PROTOTYPES
GLAPI void APIENTRY glRenderGpuMaskNV (GLbitfield mask);
GLAPI void APIENTRY glRenderGPUMaskNV (GLbitfield mask);
GLAPI void APIENTRY glMulticastBufferSubDataNV (GLbitfield gpuMask, GLuint buffer, GLintptr offset, GLsizeiptr size, const void *data);
GLAPI void APIENTRY glMulticastCopyBufferSubDataNV (GLuint readGpu, GLbitfield writeGpuMask, GLuint readBuffer, GLuint writeBuffer, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size);
GLAPI void APIENTRY glMulticastCopyImageSubDataNV (GLuint srcGpu, GLbitfield dstGpuMask, GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei srcWidth, GLsizei srcHeight, GLsizei srcDepth);
GLAPI void APIENTRY glMulticastBlitFramebufferNV (GLuint srcGpu, GLuint dstGpu, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
GLAPI void APIENTRY glMulticastCopyBufferSubDataNV (GLuint readGPU, GLbitfield writeGPUMask, GLuint readBuffer, GLuint writeBuffer, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size);
GLAPI void APIENTRY glMulticastCopyImageSubDataNV (GLuint srcGPU, GLbitfield dstGPUMask, GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei srcWidth, GLsizei srcHeight, GLsizei srcDepth);
GLAPI void APIENTRY glMulticastBlitFramebufferNV (GLuint srcGPU, GLuint dstGPU, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
GLAPI void APIENTRY glMulticastFramebufferSampleLocationsfvNV (GLuint gpu, GLuint framebuffer, GLuint start, GLsizei count, const GLfloat *v);
GLAPI void APIENTRY glMulticastBarrierNV (void);
GLAPI void APIENTRY glMulticastWaitSyncNV (GLuint signalGpu, GLbitfield waitGpuMask);
GLAPI void APIENTRY glMulticastWaitSyncNV (GLuint signalGPU, GLbitfield waitGPUMask);
GLAPI void APIENTRY glMulticastGetQueryObjectivNV (GLuint gpu, GLuint id, GLenum pname, GLint *params);
GLAPI void APIENTRY glMulticastGetQueryObjectuivNV (GLuint gpu, GLuint id, GLenum pname, GLuint *params);
GLAPI void APIENTRY glMulticastGetQueryObjecti64vNV (GLuint gpu, GLuint id, GLenum pname, GLint64 *params);

View File

@ -22,56 +22,65 @@
/**
* # CategoryPen
*
* Include file for SDL pen event handling.
* SDL pen event handling.
*
* This file describes operations for pressure-sensitive pen (stylus and/or
* eraser) handling, e.g., for input and drawing tablets or suitably equipped
* mobile / tablet devices.
* SDL provides an API for pressure-sensitive pen (stylus and/or eraser)
* handling, e.g., for input and drawing tablets or suitably equipped mobile /
* tablet devices.
*
* To get started with pens:
* To get started with pens, simply handle SDL_EVENT_PEN_* events. When a pen
* starts providing input, SDL will assign it a unique SDL_PenID, which will
* remain for the life of the process, as long as the pen stays connected.
*
* - Listen to SDL_PenMotionEvent and SDL_PenButtonEvent
* - To avoid treating pen events as mouse events, ignore SDL_MouseMotionEvent
* and SDL_MouseButtonEvent whenever `which` == SDL_PEN_MOUSEID.
*
* We primarily identify pens by SDL_PenID. The implementation makes a best
* effort to relate each SDL_PenID to the same physical device during a
* session. Formerly valid SDL_PenID values remain valid even if a device
* disappears.
*
* For identifying pens across sessions, the API provides the type SDL_GUID .
* Pens may provide more than simple touch input; they might have other axes,
* such as pressure, tilt, rotation, etc.
*/
#ifndef SDL_pen_h_
#define SDL_pen_h_
#include <SDL3/SDL_error.h>
#include <SDL3/SDL_guid.h>
#include <SDL3/SDL_mouse.h>
#include <SDL3/SDL_stdinc.h>
/* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus
extern "C" {
#endif
typedef Uint32 SDL_PenID; /**< SDL_PenIDs identify pens uniquely within a session */
/**
* SDL pen instance IDs.
*
* Zero is used to signify an invalid/null device.
*
* These show up in pen events when SDL sees input from them. They remain
* consistent as long as SDL can recognize a tool to be the same pen; but if a
* pen physically leaves the area and returns, it might get a new ID.
*
* \since This datatype is available since SDL 3.0.0.
*/
typedef Uint32 SDL_PenID;
#define SDL_PEN_INVALID ((SDL_PenID)0) /**< Reserved invalid SDL_PenID is valid */
#define SDL_PEN_MOUSEID ((SDL_MouseID)-2) /**< Device ID for mouse events triggered by pen events */
#define SDL_PEN_INFO_UNKNOWN (-1) /**< Marks unknown information when querying the pen */
/**
* Pen axis indices
* Pen input flags, as reported by various pen events' `pen_state` field.
*
* Below are the valid indices to the "axis" array from SDL_PenMotionEvent and
* SDL_PenButtonEvent. The axis indices form a contiguous range of ints from 0
* to SDL_PEN_AXIS_LAST, inclusive. All "axis[]" entries are either normalised
* to 0..1 or report a (positive or negative) angle in degrees, with 0.0
* representing the centre. Not all pens/backends support all axes:
* unsupported entries are always "0.0f".
* \since This datatype is available since SDL 3.0.0.
*/
typedef Uint32 SDL_PenInputFlags;
#define SDL_PEN_INPUT_DOWN (1u << 0) /**< & to see if pen is pressed down */
#define SDL_PEN_INPUT_BUTTON_1 (1u << 1) /**< & to see if button 1 is pressed */
#define SDL_PEN_INPUT_BUTTON_2 (1u << 2) /**< & to see if button 2 is pressed */
#define SDL_PEN_INPUT_BUTTON_3 (1u << 3) /**< & to see if button 3 is pressed */
#define SDL_PEN_INPUT_BUTTON_4 (1u << 4) /**< & to see if button 4 is pressed */
#define SDL_PEN_INPUT_BUTTON_5 (1u << 5) /**< & to see if button 5 is pressed */
#define SDL_PEN_INPUT_ERASER_TIP (1u << 30) /**< & to see if eraser tip is used */
/**
* Pen axis indices.
*
* These are the valid values for the `axis` field in SDL_PenAxisEvent. All
* axes are either normalised to 0..1 or report a (positive or negative) angle
* in degrees, with 0.0 representing the centre. Not all pens/backends support
* all axes: unsupported axes are always zero.
*
* To convert angles for tilt and rotation into vector representation, use
* SDL_sinf on the XTILT, YTILT, or ROTATION component, for example:
@ -82,200 +91,18 @@ typedef Uint32 SDL_PenID; /**< SDL_PenIDs identify pens uniquely within a sessio
*/
typedef enum SDL_PenAxis
{
SDL_PEN_AXIS_PRESSURE = 0, /**< Pen pressure. Unidirectional: 0..1.0 */
SDL_PEN_AXIS_XTILT, /**< Pen horizontal tilt angle. Bidirectional: -90.0..90.0 (left-to-right).
The physical max/min tilt may be smaller than -90.0 / 90.0, cf. SDL_PenCapabilityInfo */
SDL_PEN_AXIS_YTILT, /**< Pen vertical tilt angle. Bidirectional: -90.0..90.0 (top-to-down).
The physical max/min tilt may be smaller than -90.0 / 90.0, cf. SDL_PenCapabilityInfo */
SDL_PEN_AXIS_DISTANCE, /**< Pen distance to drawing surface. Unidirectional: 0.0..1.0 */
SDL_PEN_AXIS_ROTATION, /**< Pen barrel rotation. Bidirectional: -180..179.9 (clockwise, 0 is facing up, -180.0 is facing down). */
SDL_PEN_AXIS_SLIDER, /**< Pen finger wheel or slider (e.g., Airbrush Pen). Unidirectional: 0..1.0 */
SDL_PEN_NUM_AXES, /**< Last valid axis index */
SDL_PEN_AXIS_LAST = SDL_PEN_NUM_AXES - 1 /**< Last axis index plus 1 */
SDL_PEN_AXIS_PRESSURE, /**< Pen pressure. Unidirectional: 0 to 1.0 */
SDL_PEN_AXIS_XTILT, /**< Pen horizontal tilt angle. Bidirectional: -90.0 to 90.0 (left-to-right).
The physical max/min tilt may be smaller than -90.0 / 90.0, check SDL_PenCapabilityInfo */
SDL_PEN_AXIS_YTILT, /**< Pen vertical tilt angle. Bidirectional: -90.0 to 90.0 (top-to-down).
The physical max/min tilt may be smaller than -90.0 / 90.0 check SDL_PenCapabilityInfo */
SDL_PEN_AXIS_DISTANCE, /**< Pen distance to drawing surface. Unidirectional: 0.0 to 1.0 */
SDL_PEN_AXIS_ROTATION, /**< Pen barrel rotation. Bidirectional: -180 to 179.9 (clockwise, 0 is facing up, -180.0 is facing down). */
SDL_PEN_AXIS_SLIDER, /**< Pen finger wheel or slider (e.g., Airbrush Pen). Unidirectional: 0 to 1.0 */
SDL_PEN_AXIS_TANGENTIAL_PRESSURE, /**< Pressure from squeezing the pen ("barrel pressure"). */
SDL_PEN_NUM_AXES /**< Total known pen axis types in this version of SDL. This number may grow in future releases! */
} SDL_PenAxis;
/* Pen flags. These share a bitmask space with SDL_BUTTON_LEFT and friends. */
#define SDL_PEN_FLAG_DOWN_BIT_INDEX 13 /* Bit for storing that pen is touching the surface */
#define SDL_PEN_FLAG_INK_BIT_INDEX 14 /* Bit for storing has-non-eraser-capability status */
#define SDL_PEN_FLAG_ERASER_BIT_INDEX 15 /* Bit for storing is-eraser or has-eraser-capability property */
#define SDL_PEN_FLAG_AXIS_BIT_OFFSET 16 /* Bit for storing has-axis-0 property */
#define SDL_PEN_CAPABILITY(capbit) (1ul << (capbit))
#define SDL_PEN_AXIS_CAPABILITY(axis) SDL_PEN_CAPABILITY((axis) + SDL_PEN_FLAG_AXIS_BIT_OFFSET)
/* Pen tips */
#define SDL_PEN_TIP_INK SDL_PEN_FLAG_INK_BIT_INDEX /**< Regular pen tip (for drawing) touched the surface */
#define SDL_PEN_TIP_ERASER SDL_PEN_FLAG_ERASER_BIT_INDEX /**< Eraser pen tip touched the surface */
/**
* Pen capabilities reported by SDL_GetPenCapabilities.
*
* \since This datatype is available since SDL 3.0.0.
*/
typedef Uint32 SDL_PenCapabilityFlags;
#define SDL_PEN_DOWN_MASK SDL_PEN_CAPABILITY(SDL_PEN_FLAG_DOWN_BIT_INDEX) /**< Pen tip is currently touching the drawing surface. */
#define SDL_PEN_INK_MASK SDL_PEN_CAPABILITY(SDL_PEN_FLAG_INK_BIT_INDEX) /**< Pen has a regular drawing tip (SDL_GetPenCapabilities). For events (SDL_PenButtonEvent, SDL_PenMotionEvent, SDL_GetPenStatus) this flag is mutually exclusive with SDL_PEN_ERASER_MASK . */
#define SDL_PEN_ERASER_MASK SDL_PEN_CAPABILITY(SDL_PEN_FLAG_ERASER_BIT_INDEX) /**< Pen has an eraser tip (SDL_GetPenCapabilities) or is being used as eraser (SDL_PenButtonEvent , SDL_PenMotionEvent , SDL_GetPenStatus) */
#define SDL_PEN_AXIS_PRESSURE_MASK SDL_PEN_AXIS_CAPABILITY(SDL_PEN_AXIS_PRESSURE) /**< Pen provides pressure information in axis SDL_PEN_AXIS_PRESSURE */
#define SDL_PEN_AXIS_XTILT_MASK SDL_PEN_AXIS_CAPABILITY(SDL_PEN_AXIS_XTILT) /**< Pen provides horizontal tilt information in axis SDL_PEN_AXIS_XTILT */
#define SDL_PEN_AXIS_YTILT_MASK SDL_PEN_AXIS_CAPABILITY(SDL_PEN_AXIS_YTILT) /**< Pen provides vertical tilt information in axis SDL_PEN_AXIS_YTILT */
#define SDL_PEN_AXIS_DISTANCE_MASK SDL_PEN_AXIS_CAPABILITY(SDL_PEN_AXIS_DISTANCE) /**< Pen provides distance to drawing tablet in SDL_PEN_AXIS_DISTANCE */
#define SDL_PEN_AXIS_ROTATION_MASK SDL_PEN_AXIS_CAPABILITY(SDL_PEN_AXIS_ROTATION) /**< Pen provides barrel rotation information in axis SDL_PEN_AXIS_ROTATION */
#define SDL_PEN_AXIS_SLIDER_MASK SDL_PEN_AXIS_CAPABILITY(SDL_PEN_AXIS_SLIDER) /**< Pen provides slider / finger wheel or similar in axis SDL_PEN_AXIS_SLIDER */
#define SDL_PEN_AXIS_BIDIRECTIONAL_MASKS (SDL_PEN_AXIS_XTILT_MASK | SDL_PEN_AXIS_YTILT_MASK)
/**
* Pen types
*
* Some pens identify as a particular type of drawing device (e.g., an
* airbrush or a pencil).
*
* \since This enum is available since SDL 3.0.0
*/
typedef enum SDL_PenSubtype
{
SDL_PEN_TYPE_UNKNOWN = 0,
SDL_PEN_TYPE_ERASER = 1, /**< Eraser */
SDL_PEN_TYPE_PEN, /**< Generic pen; this is the default. */
SDL_PEN_TYPE_PENCIL, /**< Pencil */
SDL_PEN_TYPE_BRUSH, /**< Brush-like device */
SDL_PEN_TYPE_AIRBRUSH, /**< Airbrush device that "sprays" ink */
SDL_PEN_TYPE_LAST = SDL_PEN_TYPE_AIRBRUSH /**< Last valid pen type */
} SDL_PenSubtype;
/* Function prototypes */
/**
* Retrieves all pens that are connected to the system.
*
* Yields an array of SDL_PenID values. These identify and track pens
* throughout a session. To track pens across sessions (program restart), use
* SDL_GUID .
*
* \param count the number of pens in the array (number of array elements
* minus 1, i.e., not counting the terminator 0).
* \returns a 0 terminated array of SDL_PenID values, or NULL on failure. The
* array must be freed with SDL_free(). On a NULL return,
* SDL_GetError() is set.
*
* \since This function is available since SDL 3.0.0.
*/
extern SDL_DECLSPEC SDL_PenID * SDLCALL SDL_GetPens(int *count);
/**
* Retrieves the pen's current status.
*
* If the pen is detached (cf. SDL_PenConnected), this operation may return
* default values.
*
* \param instance_id the pen to query.
* \param x out-mode parameter for pen x coordinate. May be NULL.
* \param y out-mode parameter for pen y coordinate. May be NULL.
* \param axes out-mode parameter for axis information. May be null. The axes
* are in the same order as SDL_PenAxis.
* \param num_axes maximum number of axes to write to "axes".
* \returns a bit mask with the current pen button states (SDL_BUTTON_LMASK
* etc.), possibly SDL_PEN_DOWN_MASK, and exactly one of
* SDL_PEN_INK_MASK or SDL_PEN_ERASER_MASK , or 0 on error (see
* SDL_GetError()).
*
* \since This function is available since SDL 3.0.0.
*/
extern SDL_DECLSPEC Uint32 SDLCALL SDL_GetPenStatus(SDL_PenID instance_id, float *x, float *y, float *axes, size_t num_axes);
/**
* Retrieves an SDL_PenID for the given SDL_GUID.
*
* \param guid a pen GUID.
* \returns a valid SDL_PenID, or SDL_PEN_INVALID if there is no matching
* SDL_PenID.
*
* \since This function is available since SDL 3.0.0.
*/
extern SDL_DECLSPEC SDL_PenID SDLCALL SDL_GetPenFromGUID(SDL_GUID guid);
/**
* Retrieves the SDL_GUID for a given SDL_PenID.
*
* \param instance_id the pen to query.
* \returns the corresponding pen GUID; persistent across multiple sessions.
* If "instance_id" is SDL_PEN_INVALID, returns an all-zeroes GUID.
*
* \since This function is available since SDL 3.0.0.
*/
extern SDL_DECLSPEC SDL_GUID SDLCALL SDL_GetPenGUID(SDL_PenID instance_id);
/**
* Checks whether a pen is still attached.
*
* If a pen is detached, it will not show up for SDL_GetPens(). Other
* operations will still be available but may return default values.
*
* \param instance_id a pen ID.
* \returns SDL_TRUE if "instance_id" is valid and the corresponding pen is
* attached, or SDL_FALSE otherwise.
*
* \since This function is available since SDL 3.0.0.
*/
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_PenConnected(SDL_PenID instance_id);
/**
* Retrieves a human-readable description for a SDL_PenID.
*
* \param instance_id the pen to query.
* \returns a string that contains the name of the pen, intended for human
* consumption. The string might or might not be localised, depending
* on platform settings. It is not guaranteed to be unique; use
* SDL_GetPenGUID() for (best-effort) unique identifiers. The pointer
* is managed by the SDL pen subsystem and must not be deallocated.
* The pointer remains valid until SDL is shut down. Returns NULL on
* error (cf. SDL_GetError()).
*
* \since This function is available since SDL 3.0.0.
*/
extern SDL_DECLSPEC const char * SDLCALL SDL_GetPenName(SDL_PenID instance_id);
/**
* Pen capabilities, as reported by SDL_GetPenCapabilities()
*
* \since This struct is available since SDL 3.0.0.
*/
typedef struct SDL_PenCapabilityInfo
{
float max_tilt; /**< Physical maximum tilt angle, for XTILT and YTILT, or SDL_PEN_INFO_UNKNOWN . Pens cannot typically tilt all the way to 90 degrees, so this value is usually less than 90.0. */
Uint32 wacom_id; /**< For Wacom devices: wacom tool type ID, otherwise 0 (useful e.g. with libwacom) */
Sint8 num_buttons; /**< Number of pen buttons (not counting the pen tip), or SDL_PEN_INFO_UNKNOWN */
} SDL_PenCapabilityInfo;
/**
* Retrieves capability flags for a given SDL_PenID.
*
* \param instance_id the pen to query.
* \param capabilities detail information about pen capabilities, such as the
* number of buttons.
* \returns a set of capability flags, cf. SDL_PEN_CAPABILITIES.
*
* \since This function is available since SDL 3.0.0.
*/
extern SDL_DECLSPEC SDL_PenCapabilityFlags SDLCALL SDL_GetPenCapabilities(SDL_PenID instance_id, SDL_PenCapabilityInfo *capabilities);
/**
* Retrieves the pen type for a given SDL_PenID.
*
* \param instance_id the pen to query.
* \returns the corresponding pen type (cf. SDL_PenSubtype) or 0 on error.
* Note that the pen type does not dictate whether the pen tip is
* SDL_PEN_TIP_INK or SDL_PEN_TIP_ERASER; to determine whether a pen
* is being used for drawing or in eraser mode, check either the pen
* tip on SDL_EVENT_PEN_DOWN, or the flag SDL_PEN_ERASER_MASK in the
* pen state.
*
* \since This function is available since SDL 3.0.0.
*/
extern SDL_DECLSPEC SDL_PenSubtype SDLCALL SDL_GetPenType(SDL_PenID instance_id);
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
}

View File

@ -742,8 +742,8 @@ extern SDL_DECLSPEC const char * SDLCALL SDL_GetPixelFormatName(SDL_PixelFormat
* \param Gmask a pointer filled in with the green mask for the format.
* \param Bmask a pointer filled in with the blue mask for the format.
* \param Amask a pointer filled in with the alpha mask for the format.
* \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.
*
* \threadsafety It is safe to call this function from any thread.
*
@ -751,7 +751,7 @@ extern SDL_DECLSPEC const char * SDLCALL SDL_GetPixelFormatName(SDL_PixelFormat
*
* \sa SDL_GetPixelFormatForMasks
*/
extern SDL_DECLSPEC int SDLCALL SDL_GetMasksForPixelFormat(SDL_PixelFormat format, int *bpp, Uint32 *Rmask, Uint32 *Gmask, Uint32 *Bmask, Uint32 *Amask);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetMasksForPixelFormat(SDL_PixelFormat format, int *bpp, Uint32 *Rmask, Uint32 *Gmask, Uint32 *Bmask, Uint32 *Amask);
/**
* Convert a bpp value and RGBA masks to an enumerated pixel format.
@ -819,15 +819,15 @@ extern SDL_DECLSPEC SDL_Palette * SDLCALL SDL_CreatePalette(int ncolors);
* \param colors an array of SDL_Color structures to copy into the palette.
* \param firstcolor the index of the first palette entry to modify.
* \param ncolors the number of entries to modify.
* \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.
*
* \threadsafety It is safe to call this function from any thread, as long as
* the palette is not modified or destroyed in another thread.
*
* \since This function is available since SDL 3.0.0.
*/
extern SDL_DECLSPEC int SDLCALL SDL_SetPaletteColors(SDL_Palette *palette, const SDL_Color *colors, int firstcolor, int ncolors);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetPaletteColors(SDL_Palette *palette, const SDL_Color *colors, int firstcolor, int ncolors);
/**
* Free a palette created with SDL_CreatePalette().
@ -874,6 +874,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_DestroyPalette(SDL_Palette *palette);
*
* \since This function is available since SDL 3.0.0.
*
* \sa SDL_GetPixelFormatDetails
* \sa SDL_GetRGB
* \sa SDL_MapRGBA
* \sa SDL_MapSurfaceRGB
@ -912,6 +913,7 @@ extern SDL_DECLSPEC Uint32 SDLCALL SDL_MapRGB(const SDL_PixelFormatDetails *form
*
* \since This function is available since SDL 3.0.0.
*
* \sa SDL_GetPixelFormatDetails
* \sa SDL_GetRGBA
* \sa SDL_MapRGB
* \sa SDL_MapSurfaceRGBA
@ -939,6 +941,7 @@ extern SDL_DECLSPEC Uint32 SDLCALL SDL_MapRGBA(const SDL_PixelFormatDetails *for
*
* \since This function is available since SDL 3.0.0.
*
* \sa SDL_GetPixelFormatDetails
* \sa SDL_GetRGBA
* \sa SDL_MapRGB
* \sa SDL_MapRGBA
@ -970,6 +973,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_GetRGB(Uint32 pixel, const SDL_PixelFormatD
*
* \since This function is available since SDL 3.0.0.
*
* \sa SDL_GetPixelFormatDetails
* \sa SDL_GetRGB
* \sa SDL_MapRGB
* \sa SDL_MapRGBA

View File

@ -116,14 +116,14 @@ extern SDL_DECLSPEC SDL_PropertiesID SDLCALL SDL_CreateProperties(void);
*
* \param src the properties to copy.
* \param dst the destination properties.
* \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.
*
* \threadsafety It is safe to call this function from any thread.
*
* \since This function is available since SDL 3.0.0.
*/
extern SDL_DECLSPEC int SDLCALL SDL_CopyProperties(SDL_PropertiesID src, SDL_PropertiesID dst);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_CopyProperties(SDL_PropertiesID src, SDL_PropertiesID dst);
/**
* Lock a group of properties.
@ -138,8 +138,8 @@ extern SDL_DECLSPEC int SDLCALL SDL_CopyProperties(SDL_PropertiesID src, SDL_Pro
* thread.
*
* \param props the properties to lock.
* \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.
*
* \threadsafety It is safe to call this function from any thread.
*
@ -147,7 +147,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_CopyProperties(SDL_PropertiesID src, SDL_Pro
*
* \sa SDL_UnlockProperties
*/
extern SDL_DECLSPEC int SDLCALL SDL_LockProperties(SDL_PropertiesID props);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_LockProperties(SDL_PropertiesID props);
/**
* Unlock a group of properties.
@ -204,8 +204,8 @@ typedef void (SDLCALL *SDL_CleanupPropertyCallback)(void *userdata, void *value)
* \param cleanup the function to call when this property is deleted, or NULL
* if no cleanup is necessary.
* \param userdata a pointer that is passed to the cleanup function.
* \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.
*
* \threadsafety It is safe to call this function from any thread.
*
@ -215,7 +215,7 @@ typedef void (SDLCALL *SDL_CleanupPropertyCallback)(void *userdata, void *value)
* \sa SDL_SetPointerProperty
* \sa SDL_CleanupPropertyCallback
*/
extern SDL_DECLSPEC int SDLCALL SDL_SetPointerPropertyWithCleanup(SDL_PropertiesID props, const char *name, void *value, SDL_CleanupPropertyCallback cleanup, void *userdata);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetPointerPropertyWithCleanup(SDL_PropertiesID props, const char *name, void *value, SDL_CleanupPropertyCallback cleanup, void *userdata);
/**
* Set a pointer property in a group of properties.
@ -223,8 +223,8 @@ extern SDL_DECLSPEC int SDLCALL SDL_SetPointerPropertyWithCleanup(SDL_Properties
* \param props the properties to modify.
* \param name the name of the property to modify.
* \param value the new value of the property, or NULL to delete the property.
* \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.
*
* \threadsafety It is safe to call this function from any thread.
*
@ -238,7 +238,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_SetPointerPropertyWithCleanup(SDL_Properties
* \sa SDL_SetPointerPropertyWithCleanup
* \sa SDL_SetStringProperty
*/
extern SDL_DECLSPEC int SDLCALL SDL_SetPointerProperty(SDL_PropertiesID props, const char *name, void *value);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetPointerProperty(SDL_PropertiesID props, const char *name, void *value);
/**
* Set a string property in a group of properties.
@ -249,8 +249,8 @@ extern SDL_DECLSPEC int SDLCALL SDL_SetPointerProperty(SDL_PropertiesID props, c
* \param props the properties to modify.
* \param name the name of the property to modify.
* \param value the new value of the property, or NULL to delete the property.
* \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.
*
* \threadsafety It is safe to call this function from any thread.
*
@ -258,7 +258,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_SetPointerProperty(SDL_PropertiesID props, c
*
* \sa SDL_GetStringProperty
*/
extern SDL_DECLSPEC int SDLCALL SDL_SetStringProperty(SDL_PropertiesID props, const char *name, const char *value);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetStringProperty(SDL_PropertiesID props, const char *name, const char *value);
/**
* Set an integer property in a group of properties.
@ -266,8 +266,8 @@ extern SDL_DECLSPEC int SDLCALL SDL_SetStringProperty(SDL_PropertiesID props, co
* \param props the properties to modify.
* \param name the name of the property to modify.
* \param value the new value of the property.
* \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.
*
* \threadsafety It is safe to call this function from any thread.
*
@ -275,7 +275,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_SetStringProperty(SDL_PropertiesID props, co
*
* \sa SDL_GetNumberProperty
*/
extern SDL_DECLSPEC int SDLCALL SDL_SetNumberProperty(SDL_PropertiesID props, const char *name, Sint64 value);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetNumberProperty(SDL_PropertiesID props, const char *name, Sint64 value);
/**
* Set a floating point property in a group of properties.
@ -283,8 +283,8 @@ extern SDL_DECLSPEC int SDLCALL SDL_SetNumberProperty(SDL_PropertiesID props, co
* \param props the properties to modify.
* \param name the name of the property to modify.
* \param value the new value of the property.
* \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.
*
* \threadsafety It is safe to call this function from any thread.
*
@ -292,7 +292,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_SetNumberProperty(SDL_PropertiesID props, co
*
* \sa SDL_GetFloatProperty
*/
extern SDL_DECLSPEC int SDLCALL SDL_SetFloatProperty(SDL_PropertiesID props, const char *name, float value);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetFloatProperty(SDL_PropertiesID props, const char *name, float value);
/**
* Set a boolean property in a group of properties.
@ -300,8 +300,8 @@ extern SDL_DECLSPEC int SDLCALL SDL_SetFloatProperty(SDL_PropertiesID props, con
* \param props the properties to modify.
* \param name the name of the property to modify.
* \param value the new value of the property.
* \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.
*
* \threadsafety It is safe to call this function from any thread.
*
@ -309,7 +309,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_SetFloatProperty(SDL_PropertiesID props, con
*
* \sa SDL_GetBooleanProperty
*/
extern SDL_DECLSPEC int SDLCALL SDL_SetBooleanProperty(SDL_PropertiesID props, const char *name, SDL_bool value);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetBooleanProperty(SDL_PropertiesID props, const char *name, SDL_bool value);
/**
* Return whether a property exists in a group of properties.
@ -470,14 +470,14 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetBooleanProperty(SDL_PropertiesID pro
*
* \param props the properties to modify.
* \param name the name of the property to clear.
* \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.
*
* \threadsafety It is safe to call this function from any thread.
*
* \since This function is available since SDL 3.0.0.
*/
extern SDL_DECLSPEC int SDLCALL SDL_ClearProperty(SDL_PropertiesID props, const char *name);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_ClearProperty(SDL_PropertiesID props, const char *name);
/**
* A callback used to enumerate all the properties in a group of properties.
@ -507,14 +507,14 @@ typedef void (SDLCALL *SDL_EnumeratePropertiesCallback)(void *userdata, SDL_Prop
* \param props the properties to query.
* \param callback the function to call for each property.
* \param userdata a pointer that is passed to `callback`.
* \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.
*
* \threadsafety It is safe to call this function from any thread.
*
* \since This function is available since SDL 3.0.0.
*/
extern SDL_DECLSPEC int SDLCALL SDL_EnumerateProperties(SDL_PropertiesID props, SDL_EnumeratePropertiesCallback callback, void *userdata);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_EnumerateProperties(SDL_PropertiesID props, SDL_EnumeratePropertiesCallback callback, void *userdata);
/**
* Destroy a group of properties.

View File

@ -221,8 +221,7 @@ SDL_FORCE_INLINE SDL_bool SDL_RectsEqual(const SDL_Rect *a, const SDL_Rect *b)
*
* \sa SDL_GetRectIntersection
*/
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_HasRectIntersection(const SDL_Rect * A,
const SDL_Rect * B);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_HasRectIntersection(const SDL_Rect *A, const SDL_Rect *B);
/**
* Calculate the intersection of two rectangles.
@ -239,9 +238,7 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_HasRectIntersection(const SDL_Rect * A,
*
* \sa SDL_HasRectIntersection
*/
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetRectIntersection(const SDL_Rect * A,
const SDL_Rect * B,
SDL_Rect * result);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetRectIntersection(const SDL_Rect *A, const SDL_Rect *B, SDL_Rect *result);
/**
* Calculate the union of two rectangles.
@ -250,14 +247,12 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetRectIntersection(const SDL_Rect * A,
* \param B an SDL_Rect structure representing the second rectangle.
* \param result an SDL_Rect structure filled in with the union of rectangles
* `A` and `B`.
* \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.
*/
extern SDL_DECLSPEC int SDLCALL SDL_GetRectUnion(const SDL_Rect * A,
const SDL_Rect * B,
SDL_Rect * result);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetRectUnion(const SDL_Rect *A, const SDL_Rect *B, SDL_Rect *result);
/**
* Calculate a minimal rectangle enclosing a set of points.
@ -276,10 +271,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_GetRectUnion(const SDL_Rect * A,
*
* \since This function is available since SDL 3.0.0.
*/
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetRectEnclosingPoints(const SDL_Point * points,
int count,
const SDL_Rect * clip,
SDL_Rect * result);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetRectEnclosingPoints(const SDL_Point *points, int count, const SDL_Rect *clip, SDL_Rect *result);
/**
* Calculate the intersection of a rectangle and line segment.
@ -299,10 +291,7 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetRectEnclosingPoints(const SDL_Point
*
* \since This function is available since SDL 3.0.0.
*/
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetRectAndLineIntersection(const SDL_Rect *
rect, int *X1,
int *Y1, int *X2,
int *Y2);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetRectAndLineIntersection(const SDL_Rect *rect, int *X1, int *Y1, int *X2, int *Y2);
/* SDL_FRect versions... */
@ -435,8 +424,7 @@ SDL_FORCE_INLINE SDL_bool SDL_RectsEqualFloat(const SDL_FRect *a, const SDL_FRec
*
* \sa SDL_GetRectIntersection
*/
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_HasRectIntersectionFloat(const SDL_FRect * A,
const SDL_FRect * B);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_HasRectIntersectionFloat(const SDL_FRect *A, const SDL_FRect *B);
/**
* Calculate the intersection of two rectangles with float precision.
@ -453,9 +441,7 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_HasRectIntersectionFloat(const SDL_FRec
*
* \sa SDL_HasRectIntersectionFloat
*/
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetRectIntersectionFloat(const SDL_FRect * A,
const SDL_FRect * B,
SDL_FRect * result);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetRectIntersectionFloat(const SDL_FRect *A, const SDL_FRect *B, SDL_FRect *result);
/**
* Calculate the union of two rectangles with float precision.
@ -464,14 +450,12 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetRectIntersectionFloat(const SDL_FRec
* \param B an SDL_FRect structure representing the second rectangle.
* \param result an SDL_FRect structure filled in with the union of rectangles
* `A` and `B`.
* \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.
*/
extern SDL_DECLSPEC int SDLCALL SDL_GetRectUnionFloat(const SDL_FRect * A,
const SDL_FRect * B,
SDL_FRect * result);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetRectUnionFloat(const SDL_FRect *A, const SDL_FRect *B, SDL_FRect *result);
/**
* Calculate a minimal rectangle enclosing a set of points with float
@ -491,10 +475,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_GetRectUnionFloat(const SDL_FRect * A,
*
* \since This function is available since SDL 3.0.0.
*/
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetRectEnclosingPointsFloat(const SDL_FPoint * points,
int count,
const SDL_FRect * clip,
SDL_FRect * result);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetRectEnclosingPointsFloat(const SDL_FPoint *points, int count, const SDL_FRect *clip, SDL_FRect *result);
/**
* Calculate the intersection of a rectangle and line segment with float
@ -515,10 +496,7 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetRectEnclosingPointsFloat(const SDL_F
*
* \since This function is available since SDL 3.0.0.
*/
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetRectAndLineIntersectionFloat(const SDL_FRect *
rect, float *X1,
float *Y1, float *X2,
float *Y2);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetRectAndLineIntersectionFloat(const SDL_FRect *rect, float *X1, float *Y1, float *X2, float *Y2);
/* Ends C function definitions when using C++ */
#ifdef __cplusplus

File diff suppressed because it is too large Load Diff

View File

@ -55,8 +55,7 @@ typedef struct SDL_Sensor SDL_Sensor;
* This is a unique ID for a sensor for the time it is connected to the
* system, and is never reused for the lifetime of the application.
*
* 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.
*/
@ -278,12 +277,12 @@ extern SDL_DECLSPEC SDL_SensorID SDLCALL SDL_GetSensorID(SDL_Sensor *sensor);
* \param sensor the SDL_Sensor object to query.
* \param data a pointer filled with the current sensor state.
* \param num_values the number of values to write to data.
* \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.
*/
extern SDL_DECLSPEC int SDLCALL SDL_GetSensorData(SDL_Sensor *sensor, float *data, int num_values);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetSensorData(SDL_Sensor *sensor, float *data, int num_values);
/**
* Close a sensor previously opened with SDL_OpenSensor().

View File

@ -36,6 +36,9 @@
#include <inttypes.h>
#endif
#include <stdarg.h>
#ifndef __cplusplus
#include <stdbool.h>
#endif
#include <stdint.h>
#include <string.h>
#include <wchar.h>
@ -191,7 +194,7 @@ void *alloca(size_t);
*
* \sa SDL_bool
*/
#define SDL_FALSE 0
#define SDL_FALSE false
/**
* A boolean true.
@ -200,7 +203,7 @@ void *alloca(size_t);
*
* \sa SDL_bool
*/
#define SDL_TRUE 1
#define SDL_TRUE true
/**
* A boolean type: true or false.
@ -210,7 +213,7 @@ void *alloca(size_t);
* \sa SDL_TRUE
* \sa SDL_FALSE
*/
typedef int SDL_bool;
typedef bool SDL_bool;
/**
* A signed 8-bit integer type.
@ -482,6 +485,7 @@ typedef Sint64 SDL_Time;
/** \cond */
#ifndef DOXYGEN_SHOULD_IGNORE_THIS
SDL_COMPILE_TIME_ASSERT(bool, sizeof(SDL_bool) == 1);
SDL_COMPILE_TIME_ASSERT(uint8, sizeof(Uint8) == 1);
SDL_COMPILE_TIME_ASSERT(sint8, sizeof(Sint8) == 1);
SDL_COMPILE_TIME_ASSERT(uint16, sizeof(Uint16) == 2);
@ -595,8 +599,8 @@ extern SDL_DECLSPEC void SDLCALL SDL_GetMemoryFunctions(SDL_malloc_func *malloc_
* \param calloc_func custom calloc function.
* \param realloc_func custom realloc function.
* \param free_func custom free function.
* \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.
*
* \threadsafety It is safe to call this function from any thread, but one
* should not replace the memory functions once any allocations
@ -607,10 +611,10 @@ extern SDL_DECLSPEC void SDLCALL SDL_GetMemoryFunctions(SDL_malloc_func *malloc_
* \sa SDL_GetMemoryFunctions
* \sa SDL_GetOriginalMemoryFunctions
*/
extern SDL_DECLSPEC int SDLCALL SDL_SetMemoryFunctions(SDL_malloc_func malloc_func,
SDL_calloc_func calloc_func,
SDL_realloc_func realloc_func,
SDL_free_func free_func);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetMemoryFunctions(SDL_malloc_func malloc_func,
SDL_calloc_func calloc_func,
SDL_realloc_func realloc_func,
SDL_free_func free_func);
/**
* Allocate memory aligned to a specific value.
@ -2899,14 +2903,78 @@ extern SDL_DECLSPEC float SDLCALL SDL_tanf(float x);
#define SDL_ICONV_EILSEQ (size_t)-3
#define SDL_ICONV_EINVAL (size_t)-4
/* SDL_iconv_* are now always real symbols/types, not macros or inlined. */
typedef struct SDL_iconv_data_t *SDL_iconv_t;
/**
* This function allocates a context for the specified character set
* conversion.
*
* \param tocode The target character encoding, must not be NULL.
* \param fromcode The source character encoding, must not be NULL.
* \returns a handle that must be freed with SDL_iconv_close, or
* SDL_ICONV_ERROR on failure.
*
* \since This function is available since SDL 3.0.0.
*
* \sa SDL_iconv
* \sa SDL_iconv_close
* \sa SDL_iconv_string
*/
extern SDL_DECLSPEC SDL_iconv_t SDLCALL SDL_iconv_open(const char *tocode,
const char *fromcode);
/**
* This function frees a context used for character set conversion.
*
* \param cd The character set conversion handle.
* \returns 0 on success, or -1 on failure.
*
* \since This function is available since SDL 3.0.0.
*
* \sa SDL_iconv
* \sa SDL_iconv_open
* \sa SDL_iconv_string
*/
extern SDL_DECLSPEC int SDLCALL SDL_iconv_close(SDL_iconv_t cd);
/**
* This function converts text between encodings, reading from and writing to
* a buffer.
*
* It returns the number of succesful conversions.
*
* \param cd The character set conversion context, created in
* SDL_iconv_open().
* \param inbuf Address of variable that points to the first character of the
* input sequence.
* \param inbytesleft The number of bytes in the input buffer.
* \param outbuf Address of variable that points to the output buffer.
* \param outbytesleft The number of bytes in the output buffer.
* \returns the number of conversions on success, else SDL_ICONV_E2BIG is
* returned when the output buffer is too small, or SDL_ICONV_EILSEQ
* is returned when an invalid input sequence is encountered, or
* SDL_ICONV_EINVAL is returned when an incomplete input sequence is
* encountered.
*
* On exit:
*
* - inbuf will point to the beginning of the next multibyte
* sequence. On error, this is the location of the problematic
* input sequence. On success, this is the end of the input
* sequence. - inbytesleft will be set to the number of bytes left
* to convert, which will be 0 on success. - outbuf will point to
* the location where to store the next output byte. - outbytesleft
* will be set to the number of bytes left in the output buffer.
*
* \since This function is available since SDL 3.0.0.
*
* \sa SDL_iconv_open
* \sa SDL_iconv_close
* \sa SDL_iconv_string
*/
extern SDL_DECLSPEC size_t SDLCALL SDL_iconv(SDL_iconv_t cd, const char **inbuf,
size_t * inbytesleft, char **outbuf,
size_t * outbytesleft);
size_t *inbytesleft, char **outbuf,
size_t *outbytesleft);
/**
* Helper function to convert a string's encoding in one call.
@ -2928,6 +2996,10 @@ extern SDL_DECLSPEC size_t SDLCALL SDL_iconv(SDL_iconv_t cd, const char **inbuf,
* \returns a new string, converted to the new encoding, or NULL on error.
*
* \since This function is available since SDL 3.0.0.
*
* \sa SDL_iconv_open
* \sa SDL_iconv_close
* \sa SDL_iconv
*/
extern SDL_DECLSPEC char * SDLCALL SDL_iconv_string(const char *tocode,
const char *fromcode,

View File

@ -57,34 +57,34 @@ extern "C" {
typedef struct SDL_StorageInterface
{
/* Called when the storage is closed */
int (SDLCALL *close)(void *userdata);
SDL_bool (SDLCALL *close)(void *userdata);
/* Optional, returns whether the storage is currently ready for access */
SDL_bool (SDLCALL *ready)(void *userdata);
/* Enumerate a directory, optional for write-only storage */
int (SDLCALL *enumerate)(void *userdata, const char *path, SDL_EnumerateDirectoryCallback callback, void *callback_userdata);
SDL_bool (SDLCALL *enumerate)(void *userdata, const char *path, SDL_EnumerateDirectoryCallback callback, void *callback_userdata);
/* Get path information, optional for write-only storage */
int (SDLCALL *info)(void *userdata, const char *path, SDL_PathInfo *info);
SDL_bool (SDLCALL *info)(void *userdata, const char *path, SDL_PathInfo *info);
/* Read a file from storage, optional for write-only storage */
int (SDLCALL *read_file)(void *userdata, const char *path, void *destination, Uint64 length);
SDL_bool (SDLCALL *read_file)(void *userdata, const char *path, void *destination, Uint64 length);
/* Write a file to storage, optional for read-only storage */
int (SDLCALL *write_file)(void *userdata, const char *path, const void *source, Uint64 length);
SDL_bool (SDLCALL *write_file)(void *userdata, const char *path, const void *source, Uint64 length);
/* Create a directory, optional for read-only storage */
int (SDLCALL *mkdir)(void *userdata, const char *path);
SDL_bool (SDLCALL *mkdir)(void *userdata, const char *path);
/* Remove a file or empty directory, optional for read-only storage */
int (SDLCALL *remove)(void *userdata, const char *path);
SDL_bool (SDLCALL *remove)(void *userdata, const char *path);
/* Rename a path, optional for read-only storage */
int (SDLCALL *rename)(void *userdata, const char *oldpath, const char *newpath);
SDL_bool (SDLCALL *rename)(void *userdata, const char *oldpath, const char *newpath);
/* Copy a file, optional for read-only storage */
int (SDLCALL *copy)(void *userdata, const char *oldpath, const char *newpath);
SDL_bool (SDLCALL *copy)(void *userdata, const char *oldpath, const char *newpath);
/* Get the space remaining, optional for read-only storage */
Uint64 (SDLCALL *space_remaining)(void *userdata);
@ -196,7 +196,7 @@ extern SDL_DECLSPEC SDL_Storage * SDLCALL SDL_OpenStorage(const SDL_StorageInter
* Closes and frees a storage container.
*
* \param storage a storage container to close.
* \returns 0 if the container was freed with no errors, a negative value
* \returns SDL_TRUE if the container was freed with no errors, SDL_FALSE
* otherwise; call SDL_GetError() for more information. Even if the
* function returns an error, the container data will be freed; the
* error is only for informational purposes.
@ -208,7 +208,7 @@ extern SDL_DECLSPEC SDL_Storage * SDLCALL SDL_OpenStorage(const SDL_StorageInter
* \sa SDL_OpenTitleStorage
* \sa SDL_OpenUserStorage
*/
extern SDL_DECLSPEC int SDLCALL SDL_CloseStorage(SDL_Storage *storage);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_CloseStorage(SDL_Storage *storage);
/**
* Checks if the storage container is ready to use.
@ -230,15 +230,15 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_StorageReady(SDL_Storage *storage);
* \param storage a storage container to query.
* \param path the relative path of the file to query.
* \param length a pointer to be filled with the file's length.
* \returns 0 if the file could be queried or a negative error code on
* failure; call SDL_GetError() for more information.
* \returns SDL_TRUE if the file could be queried or SDL_FALSE on failure;
* call SDL_GetError() for more information.
*
* \since This function is available since SDL 3.0.0.
*
* \sa SDL_ReadStorageFile
* \sa SDL_StorageReady
*/
extern SDL_DECLSPEC int SDLCALL SDL_GetStorageFileSize(SDL_Storage *storage, const char *path, Uint64 *length);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetStorageFileSize(SDL_Storage *storage, const char *path, Uint64 *length);
/**
* Synchronously read a file from a storage container into a client-provided
@ -248,7 +248,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_GetStorageFileSize(SDL_Storage *storage, con
* \param path the relative path of the file to read.
* \param destination a client-provided buffer to read the file into.
* \param length the length of the destination buffer.
* \returns 0 if the file was read or a negative error code on failure; call
* \returns SDL_TRUE if the file was read or SDL_FALSE on failure; call
* SDL_GetError() for more information.
*
* \since This function is available since SDL 3.0.0.
@ -257,7 +257,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_GetStorageFileSize(SDL_Storage *storage, con
* \sa SDL_StorageReady
* \sa SDL_WriteStorageFile
*/
extern SDL_DECLSPEC int SDLCALL SDL_ReadStorageFile(SDL_Storage *storage, const char *path, void *destination, Uint64 length);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_ReadStorageFile(SDL_Storage *storage, const char *path, void *destination, Uint64 length);
/**
* Synchronously write a file from client memory into a storage container.
@ -266,8 +266,8 @@ extern SDL_DECLSPEC int SDLCALL SDL_ReadStorageFile(SDL_Storage *storage, const
* \param path the relative path of the file to write.
* \param source a client-provided buffer to write from.
* \param length the length of the source buffer.
* \returns 0 if the file was written or a negative error code on failure;
* call SDL_GetError() for more information.
* \returns SDL_TRUE if the file was written or SDL_FALSE on failure; call
* SDL_GetError() for more information.
*
* \since This function is available since SDL 3.0.0.
*
@ -275,21 +275,21 @@ extern SDL_DECLSPEC int SDLCALL SDL_ReadStorageFile(SDL_Storage *storage, const
* \sa SDL_ReadStorageFile
* \sa SDL_StorageReady
*/
extern SDL_DECLSPEC int SDLCALL SDL_WriteStorageFile(SDL_Storage *storage, const char *path, const void *source, Uint64 length);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_WriteStorageFile(SDL_Storage *storage, const char *path, const void *source, Uint64 length);
/**
* Create a directory in a writable storage container.
*
* \param storage a storage container.
* \param path the path of the directory to create.
* \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_StorageReady
*/
extern SDL_DECLSPEC int SDLCALL SDL_CreateStorageDirectory(SDL_Storage *storage, const char *path);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_CreateStorageDirectory(SDL_Storage *storage, const char *path);
/**
* Enumerate a directory in a storage container through a callback function.
@ -302,28 +302,28 @@ extern SDL_DECLSPEC int SDLCALL SDL_CreateStorageDirectory(SDL_Storage *storage,
* \param path the path of the directory to enumerate.
* \param callback a function that is called for each entry in the directory.
* \param userdata a pointer that is passed to `callback`.
* \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_StorageReady
*/
extern SDL_DECLSPEC int SDLCALL SDL_EnumerateStorageDirectory(SDL_Storage *storage, const char *path, SDL_EnumerateDirectoryCallback callback, void *userdata);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_EnumerateStorageDirectory(SDL_Storage *storage, const char *path, SDL_EnumerateDirectoryCallback callback, void *userdata);
/**
* Remove a file or an empty directory in a writable storage container.
*
* \param storage a storage container.
* \param path the path of the directory to enumerate.
* \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_StorageReady
*/
extern SDL_DECLSPEC int SDLCALL SDL_RemoveStoragePath(SDL_Storage *storage, const char *path);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_RemoveStoragePath(SDL_Storage *storage, const char *path);
/**
* Rename a file or directory in a writable storage container.
@ -331,14 +331,14 @@ extern SDL_DECLSPEC int SDLCALL SDL_RemoveStoragePath(SDL_Storage *storage, cons
* \param storage a storage container.
* \param oldpath the old path.
* \param newpath the new path.
* \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_StorageReady
*/
extern SDL_DECLSPEC int SDLCALL SDL_RenameStoragePath(SDL_Storage *storage, const char *oldpath, const char *newpath);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_RenameStoragePath(SDL_Storage *storage, const char *oldpath, const char *newpath);
/**
* Copy a file in a writable storage container.
@ -346,14 +346,14 @@ extern SDL_DECLSPEC int SDLCALL SDL_RenameStoragePath(SDL_Storage *storage, cons
* \param storage a storage container.
* \param oldpath the old path.
* \param newpath the new path.
* \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_StorageReady
*/
extern SDL_DECLSPEC int SDLCALL SDL_CopyStorageFile(SDL_Storage *storage, const char *oldpath, const char *newpath);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_CopyStorageFile(SDL_Storage *storage, const char *oldpath, const char *newpath);
/**
* Get information about a filesystem path in a storage container.
@ -362,14 +362,14 @@ extern SDL_DECLSPEC int SDLCALL SDL_CopyStorageFile(SDL_Storage *storage, const
* \param path the path to query.
* \param info a pointer filled in with information about the path, or NULL to
* check for the existence of a file.
* \returns 0 on success or a negative error code if the file doesn't exist,
* or another failure; call SDL_GetError() for more information.
* \returns SDL_TRUE on success or SDL_FALSE if the file doesn't exist, or
* another failure; call SDL_GetError() for more information.
*
* \since This function is available since SDL 3.0.0.
*
* \sa SDL_StorageReady
*/
extern SDL_DECLSPEC int SDLCALL SDL_GetStoragePathInfo(SDL_Storage *storage, const char *path, SDL_PathInfo *info);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetStoragePathInfo(SDL_Storage *storage, const char *path, SDL_PathInfo *info);
/**
* Queries the remaining space in a storage container.

View File

@ -71,8 +71,7 @@ typedef Uint32 SDL_SurfaceFlags;
typedef enum SDL_ScaleMode
{
SDL_SCALEMODE_NEAREST, /**< nearest pixel sampling */
SDL_SCALEMODE_LINEAR, /**< linear filtering */
SDL_SCALEMODE_BEST /**< anisotropic filtering */
SDL_SCALEMODE_LINEAR /**< linear filtering */
} SDL_ScaleMode;
/**
@ -125,6 +124,8 @@ typedef struct SDL_Surface
/**
* Allocate a new surface with a specific pixel format.
*
* The pixels of the new surface are initialized to zero.
*
* \param width the width of the surface.
* \param height the height of the surface.
* \param format the SDL_PixelFormat for the new surface's pixel format.
@ -222,14 +223,14 @@ extern SDL_DECLSPEC SDL_PropertiesID SDLCALL SDL_GetSurfaceProperties(SDL_Surfac
* \param surface the SDL_Surface structure to update.
* \param colorspace an SDL_ColorSpace value describing the surface
* colorspace.
* \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_GetSurfaceColorspace
*/
extern SDL_DECLSPEC int SDLCALL SDL_SetSurfaceColorspace(SDL_Surface *surface, SDL_Colorspace colorspace);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetSurfaceColorspace(SDL_Surface *surface, SDL_Colorspace colorspace);
/**
* Get the colorspace used by a surface.
@ -283,15 +284,15 @@ extern SDL_DECLSPEC SDL_Palette * SDLCALL SDL_CreateSurfacePalette(SDL_Surface *
*
* \param surface the SDL_Surface structure to update.
* \param palette the SDL_Palette structure 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_CreatePalette
* \sa SDL_GetSurfacePalette
*/
extern SDL_DECLSPEC int SDLCALL SDL_SetSurfacePalette(SDL_Surface *surface, SDL_Palette *palette);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetSurfacePalette(SDL_Surface *surface, SDL_Palette *palette);
/**
* Get the palette used by a surface.
@ -320,8 +321,8 @@ extern SDL_DECLSPEC SDL_Palette * SDLCALL SDL_GetSurfacePalette(SDL_Surface *sur
* \param surface the SDL_Surface structure to update.
* \param image a pointer to an alternate SDL_Surface to associate with this
* surface.
* \returns SDL_TRUE if alternate versions are available or SDL_TRUE
* otherwise.
* \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.
*
@ -329,7 +330,7 @@ extern SDL_DECLSPEC SDL_Palette * SDLCALL SDL_GetSurfacePalette(SDL_Surface *sur
* \sa SDL_GetSurfaceImages
* \sa SDL_SurfaceHasAlternateImages
*/
extern SDL_DECLSPEC int SDLCALL SDL_AddSurfaceAlternateImage(SDL_Surface *surface, SDL_Surface *image);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_AddSurfaceAlternateImage(SDL_Surface *surface, SDL_Surface *image);
/**
* Return whether a surface has alternate versions available.
@ -400,15 +401,15 @@ extern SDL_DECLSPEC void SDLCALL SDL_RemoveSurfaceAlternateImages(SDL_Surface *s
* format of the surface will not change.
*
* \param surface the SDL_Surface structure to be locked.
* \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_MUSTLOCK
* \sa SDL_UnlockSurface
*/
extern SDL_DECLSPEC int SDLCALL SDL_LockSurface(SDL_Surface *surface);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_LockSurface(SDL_Surface *surface);
/**
* Release a surface after directly accessing the pixels.
@ -472,15 +473,15 @@ extern SDL_DECLSPEC SDL_Surface * SDLCALL SDL_LoadBMP(const char *file);
* \param dst a data stream to save to.
* \param closeio if SDL_TRUE, calls SDL_CloseIO() on `dst` before returning,
* even in the case of an error.
* \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_LoadBMP_IO
* \sa SDL_SaveBMP
*/
extern SDL_DECLSPEC int SDLCALL SDL_SaveBMP_IO(SDL_Surface *surface, SDL_IOStream *dst, SDL_bool closeio);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SaveBMP_IO(SDL_Surface *surface, SDL_IOStream *dst, SDL_bool closeio);
/**
* Save a surface to a file.
@ -493,15 +494,15 @@ extern SDL_DECLSPEC int SDLCALL SDL_SaveBMP_IO(SDL_Surface *surface, SDL_IOStrea
*
* \param surface the SDL_Surface structure containing the image to be saved.
* \param file a file to save to.
* \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_LoadBMP
* \sa SDL_SaveBMP_IO
*/
extern SDL_DECLSPEC int SDLCALL SDL_SaveBMP(SDL_Surface *surface, const char *file);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SaveBMP(SDL_Surface *surface, const char *file);
/**
* Set the RLE acceleration hint for a surface.
@ -512,8 +513,8 @@ extern SDL_DECLSPEC int SDLCALL SDL_SaveBMP(SDL_Surface *surface, const char *fi
* \param surface the SDL_Surface structure to optimize.
* \param enabled SDL_TRUE to enable RLE acceleration, SDL_FALSE to disable
* it.
* \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.
*
@ -521,7 +522,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_SaveBMP(SDL_Surface *surface, const char *fi
* \sa SDL_LockSurface
* \sa SDL_UnlockSurface
*/
extern SDL_DECLSPEC int SDLCALL SDL_SetSurfaceRLE(SDL_Surface *surface, SDL_bool enabled);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetSurfaceRLE(SDL_Surface *surface, SDL_bool enabled);
/**
* Returns whether the surface is RLE enabled.
@ -551,8 +552,8 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SurfaceHasRLE(SDL_Surface *surface);
* \param enabled SDL_TRUE to enable color key, SDL_FALSE to disable color
* key.
* \param key the transparent pixel.
* \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.
*
@ -560,7 +561,7 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SurfaceHasRLE(SDL_Surface *surface);
* \sa SDL_SetSurfaceRLE
* \sa SDL_SurfaceHasColorKey
*/
extern SDL_DECLSPEC int SDLCALL SDL_SetSurfaceColorKey(SDL_Surface *surface, SDL_bool enabled, Uint32 key);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetSurfaceColorKey(SDL_Surface *surface, SDL_bool enabled, Uint32 key);
/**
* Returns whether the surface has a color key.
@ -587,15 +588,15 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SurfaceHasColorKey(SDL_Surface *surface
*
* \param surface the SDL_Surface structure to query.
* \param key a pointer filled in with the transparent pixel.
* \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_SetSurfaceColorKey
* \sa SDL_SurfaceHasColorKey
*/
extern SDL_DECLSPEC int SDLCALL SDL_GetSurfaceColorKey(SDL_Surface *surface, Uint32 *key);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetSurfaceColorKey(SDL_Surface *surface, Uint32 *key);
/**
* Set an additional color value multiplied into blit operations.
@ -610,15 +611,15 @@ extern SDL_DECLSPEC int SDLCALL SDL_GetSurfaceColorKey(SDL_Surface *surface, Uin
* \param r the red color value multiplied into blit operations.
* \param g the green color value multiplied into blit operations.
* \param b the blue color value multiplied into blit operations.
* \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_GetSurfaceColorMod
* \sa SDL_SetSurfaceAlphaMod
*/
extern SDL_DECLSPEC int SDLCALL SDL_SetSurfaceColorMod(SDL_Surface *surface, Uint8 r, Uint8 g, Uint8 b);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetSurfaceColorMod(SDL_Surface *surface, Uint8 r, Uint8 g, Uint8 b);
/**
@ -628,15 +629,15 @@ extern SDL_DECLSPEC int SDLCALL SDL_SetSurfaceColorMod(SDL_Surface *surface, Uin
* \param r a pointer filled in with the current red color value.
* \param g a pointer filled in with the current green color value.
* \param b a pointer filled in with the current blue color value.
* \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_GetSurfaceAlphaMod
* \sa SDL_SetSurfaceColorMod
*/
extern SDL_DECLSPEC int SDLCALL SDL_GetSurfaceColorMod(SDL_Surface *surface, Uint8 *r, Uint8 *g, Uint8 *b);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetSurfaceColorMod(SDL_Surface *surface, Uint8 *r, Uint8 *g, Uint8 *b);
/**
* Set an additional alpha value used in blit operations.
@ -648,30 +649,30 @@ extern SDL_DECLSPEC int SDLCALL SDL_GetSurfaceColorMod(SDL_Surface *surface, Uin
*
* \param surface the SDL_Surface structure to update.
* \param alpha the alpha value multiplied into blit operations.
* \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_GetSurfaceAlphaMod
* \sa SDL_SetSurfaceColorMod
*/
extern SDL_DECLSPEC int SDLCALL SDL_SetSurfaceAlphaMod(SDL_Surface *surface, Uint8 alpha);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetSurfaceAlphaMod(SDL_Surface *surface, Uint8 alpha);
/**
* Get the additional alpha value used in blit operations.
*
* \param surface the SDL_Surface structure to query.
* \param alpha a pointer filled in with the current alpha value.
* \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_GetSurfaceColorMod
* \sa SDL_SetSurfaceAlphaMod
*/
extern SDL_DECLSPEC int SDLCALL SDL_GetSurfaceAlphaMod(SDL_Surface *surface, Uint8 *alpha);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetSurfaceAlphaMod(SDL_Surface *surface, Uint8 *alpha);
/**
* Set the blend mode used for blit operations.
@ -682,28 +683,28 @@ extern SDL_DECLSPEC int SDLCALL SDL_GetSurfaceAlphaMod(SDL_Surface *surface, Uin
*
* \param surface the SDL_Surface structure to update.
* \param blendMode the SDL_BlendMode to use for blit blending.
* \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_GetSurfaceBlendMode
*/
extern SDL_DECLSPEC int SDLCALL SDL_SetSurfaceBlendMode(SDL_Surface *surface, SDL_BlendMode blendMode);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetSurfaceBlendMode(SDL_Surface *surface, SDL_BlendMode blendMode);
/**
* Get the blend mode used for blit operations.
*
* \param surface the SDL_Surface structure to query.
* \param blendMode a pointer filled in with the current SDL_BlendMode.
* \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_SetSurfaceBlendMode
*/
extern SDL_DECLSPEC int SDLCALL SDL_GetSurfaceBlendMode(SDL_Surface *surface, SDL_BlendMode *blendMode);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetSurfaceBlendMode(SDL_Surface *surface, SDL_BlendMode *blendMode);
/**
* Set the clipping rectangle for a surface.
@ -736,26 +737,26 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetSurfaceClipRect(SDL_Surface *surface
* clipped.
* \param rect an SDL_Rect structure filled in with the clipping rectangle for
* the surface.
* \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_SetSurfaceClipRect
*/
extern SDL_DECLSPEC int SDLCALL SDL_GetSurfaceClipRect(SDL_Surface *surface, SDL_Rect *rect);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetSurfaceClipRect(SDL_Surface *surface, SDL_Rect *rect);
/**
* Flip a surface vertically or horizontally.
*
* \param surface the surface to flip.
* \param flip the direction to flip.
* \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.
*/
extern SDL_DECLSPEC int SDLCALL SDL_FlipSurface(SDL_Surface *surface, SDL_FlipMode flip);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_FlipSurface(SDL_Surface *surface, SDL_FlipMode flip);
/**
* Creates a new surface identical to the existing surface.
@ -858,14 +859,14 @@ extern SDL_DECLSPEC SDL_Surface * SDLCALL SDL_ConvertSurfaceAndColorspace(SDL_Su
* \param dst_format an SDL_PixelFormat value of the `dst` pixels format.
* \param dst a pointer to be filled in with new pixel data.
* \param dst_pitch the pitch of the destination pixels, in bytes.
* \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information.
* \returns SDL_FALSE 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_ConvertPixelsAndColorspace
*/
extern SDL_DECLSPEC int SDLCALL SDL_ConvertPixels(int width, int height, SDL_PixelFormat src_format, const void *src, int src_pitch, SDL_PixelFormat dst_format, void *dst, int dst_pitch);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_ConvertPixels(int width, int height, SDL_PixelFormat src_format, const void *src, int src_pitch, SDL_PixelFormat dst_format, void *dst, int dst_pitch);
/**
* Copy a block of pixels of one format and colorspace to another format and
@ -887,14 +888,14 @@ extern SDL_DECLSPEC int SDLCALL SDL_ConvertPixels(int width, int height, SDL_Pix
* properties, or 0.
* \param dst a pointer to be filled in with new pixel data.
* \param dst_pitch the pitch of the destination pixels, in bytes.
* \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information.
* \returns SDL_FALSE 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_ConvertPixels
*/
extern SDL_DECLSPEC int SDLCALL SDL_ConvertPixelsAndColorspace(int width, int height, SDL_PixelFormat src_format, SDL_Colorspace src_colorspace, SDL_PropertiesID src_properties, const void *src, int src_pitch, SDL_PixelFormat dst_format, SDL_Colorspace dst_colorspace, SDL_PropertiesID dst_properties, void *dst, int dst_pitch);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_ConvertPixelsAndColorspace(int width, int height, SDL_PixelFormat src_format, SDL_Colorspace src_colorspace, SDL_PropertiesID src_properties, const void *src, int src_pitch, SDL_PixelFormat dst_format, SDL_Colorspace dst_colorspace, SDL_PropertiesID dst_properties, void *dst, int dst_pitch);
/**
* Premultiply the alpha on a block of pixels.
@ -911,12 +912,12 @@ extern SDL_DECLSPEC int SDLCALL SDL_ConvertPixelsAndColorspace(int width, int he
* \param dst_pitch the pitch of the destination pixels, in bytes.
* \param linear SDL_TRUE to convert from sRGB to linear space for the alpha
* multiplication, SDL_FALSE to do multiplication in sRGB space.
* \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.
*/
extern SDL_DECLSPEC int SDLCALL SDL_PremultiplyAlpha(int width, int height, SDL_PixelFormat src_format, const void *src, int src_pitch, SDL_PixelFormat dst_format, void *dst, int dst_pitch, SDL_bool linear);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_PremultiplyAlpha(int width, int height, SDL_PixelFormat src_format, const void *src, int src_pitch, SDL_PixelFormat dst_format, void *dst, int dst_pitch, SDL_bool linear);
/**
* Premultiply the alpha in a surface.
@ -926,12 +927,12 @@ extern SDL_DECLSPEC int SDLCALL SDL_PremultiplyAlpha(int width, int height, SDL_
* \param surface the surface to modify.
* \param linear SDL_TRUE to convert from sRGB to linear space for the alpha
* multiplication, SDL_FALSE to do multiplication in sRGB space.
* \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.
*/
extern SDL_DECLSPEC int SDLCALL SDL_PremultiplySurfaceAlpha(SDL_Surface *surface, SDL_bool linear);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_PremultiplySurfaceAlpha(SDL_Surface *surface, SDL_bool linear);
/**
* Clear a surface with a specific color, with floating point precision.
@ -946,12 +947,12 @@ extern SDL_DECLSPEC int SDLCALL SDL_PremultiplySurfaceAlpha(SDL_Surface *surface
* \param g the green component of the pixel, normally in the range 0-1.
* \param b the blue component of the pixel, normally in the range 0-1.
* \param a the alpha component of the pixel, normally in the range 0-1.
* \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.
*/
extern SDL_DECLSPEC int SDLCALL SDL_ClearSurface(SDL_Surface *surface, float r, float g, float b, float a);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_ClearSurface(SDL_Surface *surface, float r, float g, float b, float a);
/**
* Perform a fast fill of a rectangle with a specific color.
@ -969,14 +970,14 @@ extern SDL_DECLSPEC int SDLCALL SDL_ClearSurface(SDL_Surface *surface, float r,
* \param rect the SDL_Rect structure representing the rectangle to fill, or
* NULL to fill the entire surface.
* \param color the color to fill with.
* \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_FillSurfaceRects
*/
extern SDL_DECLSPEC int SDLCALL SDL_FillSurfaceRect(SDL_Surface *dst, const SDL_Rect *rect, Uint32 color);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_FillSurfaceRect(SDL_Surface *dst, const SDL_Rect *rect, Uint32 color);
/**
* Perform a fast fill of a set of rectangles with a specific color.
@ -994,14 +995,14 @@ extern SDL_DECLSPEC int SDLCALL SDL_FillSurfaceRect(SDL_Surface *dst, const SDL_
* \param rects an array of SDL_Rects representing the rectangles to fill.
* \param count the number of rectangles in the array.
* \param color the color to fill with.
* \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_FillSurfaceRect
*/
extern SDL_DECLSPEC int SDLCALL SDL_FillSurfaceRects(SDL_Surface *dst, const SDL_Rect *rects, int count, Uint32 color);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_FillSurfaceRects(SDL_Surface *dst, const SDL_Rect *rects, int count, Uint32 color);
/**
* Performs a fast blit from the source surface to the destination surface.
@ -1065,8 +1066,8 @@ extern SDL_DECLSPEC int SDLCALL SDL_FillSurfaceRects(SDL_Surface *dst, const SDL
* height are ignored, and are copied from `srcrect`. If you
* want a specific width and height, you should use
* SDL_BlitSurfaceScaled().
* \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.
*
* \threadsafety The same destination surface should not be used from two
* threads at once. It is safe to use the same source surface
@ -1076,7 +1077,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_FillSurfaceRects(SDL_Surface *dst, const SDL
*
* \sa SDL_BlitSurfaceScaled
*/
extern SDL_DECLSPEC int SDLCALL SDL_BlitSurface(SDL_Surface *src, const SDL_Rect *srcrect, SDL_Surface *dst, const SDL_Rect *dstrect);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_BlitSurface(SDL_Surface *src, const SDL_Rect *srcrect, SDL_Surface *dst, const SDL_Rect *dstrect);
/**
* Perform low-level surface blitting only.
@ -1090,8 +1091,8 @@ extern SDL_DECLSPEC int SDLCALL SDL_BlitSurface(SDL_Surface *src, const SDL_Rect
* \param dst the SDL_Surface structure that is the blit target.
* \param dstrect the SDL_Rect structure representing the target rectangle in
* the destination surface, may not be NULL.
* \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.
*
* \threadsafety The same destination surface should not be used from two
* threads at once. It is safe to use the same source surface
@ -1101,7 +1102,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_BlitSurface(SDL_Surface *src, const SDL_Rect
*
* \sa SDL_BlitSurface
*/
extern SDL_DECLSPEC int SDLCALL SDL_BlitSurfaceUnchecked(SDL_Surface *src, const SDL_Rect *srcrect, SDL_Surface *dst, const SDL_Rect *dstrect);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_BlitSurfaceUnchecked(SDL_Surface *src, const SDL_Rect *srcrect, SDL_Surface *dst, const SDL_Rect *dstrect);
/**
* Perform a scaled blit to a destination surface, which may be of a different
@ -1115,8 +1116,8 @@ extern SDL_DECLSPEC int SDLCALL SDL_BlitSurfaceUnchecked(SDL_Surface *src, const
* the destination surface, or NULL to fill the entire
* destination surface.
* \param scaleMode the SDL_ScaleMode to be used.
* \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.
*
* \threadsafety The same destination surface should not be used from two
* threads at once. It is safe to use the same source surface
@ -1126,7 +1127,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_BlitSurfaceUnchecked(SDL_Surface *src, const
*
* \sa SDL_BlitSurface
*/
extern SDL_DECLSPEC int SDLCALL SDL_BlitSurfaceScaled(SDL_Surface *src, const SDL_Rect *srcrect, SDL_Surface *dst, const SDL_Rect *dstrect, SDL_ScaleMode scaleMode);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_BlitSurfaceScaled(SDL_Surface *src, const SDL_Rect *srcrect, SDL_Surface *dst, const SDL_Rect *dstrect, SDL_ScaleMode scaleMode);
/**
* Perform low-level surface scaled blitting only.
@ -1141,8 +1142,8 @@ extern SDL_DECLSPEC int SDLCALL SDL_BlitSurfaceScaled(SDL_Surface *src, const SD
* \param dstrect the SDL_Rect structure representing the target rectangle in
* the destination surface, may not be NULL.
* \param scaleMode the SDL_ScaleMode to be used.
* \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.
*
* \threadsafety The same destination surface should not be used from two
* threads at once. It is safe to use the same source surface
@ -1152,7 +1153,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_BlitSurfaceScaled(SDL_Surface *src, const SD
*
* \sa SDL_BlitSurfaceScaled
*/
extern SDL_DECLSPEC int SDLCALL SDL_BlitSurfaceUncheckedScaled(SDL_Surface *src, const SDL_Rect *srcrect, SDL_Surface *dst, const SDL_Rect *dstrect, SDL_ScaleMode scaleMode);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_BlitSurfaceUncheckedScaled(SDL_Surface *src, const SDL_Rect *srcrect, SDL_Surface *dst, const SDL_Rect *dstrect, SDL_ScaleMode scaleMode);
/**
* Perform a tiled blit to a destination surface, which may be of a different
@ -1167,8 +1168,8 @@ extern SDL_DECLSPEC int SDLCALL SDL_BlitSurfaceUncheckedScaled(SDL_Surface *src,
* \param dst the SDL_Surface structure that is the blit target.
* \param dstrect the SDL_Rect structure representing the target rectangle in
* the destination surface, or NULL to fill the entire surface.
* \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.
*
* \threadsafety The same destination surface should not be used from two
* threads at once. It is safe to use the same source surface
@ -1178,7 +1179,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_BlitSurfaceUncheckedScaled(SDL_Surface *src,
*
* \sa SDL_BlitSurface
*/
extern SDL_DECLSPEC int SDLCALL SDL_BlitSurfaceTiled(SDL_Surface *src, const SDL_Rect *srcrect, SDL_Surface *dst, const SDL_Rect *dstrect);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_BlitSurfaceTiled(SDL_Surface *src, const SDL_Rect *srcrect, SDL_Surface *dst, const SDL_Rect *dstrect);
/**
* Perform a scaled and tiled blit to a destination surface, which may be of a
@ -1197,8 +1198,8 @@ extern SDL_DECLSPEC int SDLCALL SDL_BlitSurfaceTiled(SDL_Surface *src, const SDL
* \param dst the SDL_Surface structure that is the blit target.
* \param dstrect the SDL_Rect structure representing the target rectangle in
* the destination surface, or NULL to fill the entire surface.
* \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.
*
* \threadsafety The same destination surface should not be used from two
* threads at once. It is safe to use the same source surface
@ -1208,7 +1209,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_BlitSurfaceTiled(SDL_Surface *src, const SDL
*
* \sa SDL_BlitSurface
*/
extern SDL_DECLSPEC int SDLCALL SDL_BlitSurfaceTiledWithScale(SDL_Surface *src, const SDL_Rect *srcrect, float scale, SDL_ScaleMode scaleMode, SDL_Surface *dst, const SDL_Rect *dstrect);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_BlitSurfaceTiledWithScale(SDL_Surface *src, const SDL_Rect *srcrect, float scale, SDL_ScaleMode scaleMode, SDL_Surface *dst, const SDL_Rect *dstrect);
/**
* Perform a scaled blit using the 9-grid algorithm to a destination surface,
@ -1234,8 +1235,8 @@ extern SDL_DECLSPEC int SDLCALL SDL_BlitSurfaceTiledWithScale(SDL_Surface *src,
* \param dst the SDL_Surface structure that is the blit target.
* \param dstrect the SDL_Rect structure representing the target rectangle in
* the destination surface, or NULL to fill the entire surface.
* \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.
*
* \threadsafety The same destination surface should not be used from two
* threads at once. It is safe to use the same source surface
@ -1245,7 +1246,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_BlitSurfaceTiledWithScale(SDL_Surface *src,
*
* \sa SDL_BlitSurface
*/
extern SDL_DECLSPEC int SDLCALL SDL_BlitSurface9Grid(SDL_Surface *src, const SDL_Rect *srcrect, int left_width, int right_width, int top_height, int bottom_height, float scale, SDL_ScaleMode scaleMode, SDL_Surface *dst, const SDL_Rect *dstrect);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_BlitSurface9Grid(SDL_Surface *src, const SDL_Rect *srcrect, int left_width, int right_width, int top_height, int bottom_height, float scale, SDL_ScaleMode scaleMode, SDL_Surface *dst, const SDL_Rect *dstrect);
/**
* Map an RGB triple to an opaque pixel value for a surface.
@ -1328,12 +1329,12 @@ extern SDL_DECLSPEC Uint32 SDLCALL SDL_MapSurfaceRGBA(SDL_Surface *surface, Uint
* ignore this channel.
* \param a a pointer filled in with the alpha channel, 0-255, or NULL to
* ignore this channel.
* \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.
*/
extern SDL_DECLSPEC int SDLCALL SDL_ReadSurfacePixel(SDL_Surface *surface, int x, int y, Uint8 *r, Uint8 *g, Uint8 *b, Uint8 *a);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_ReadSurfacePixel(SDL_Surface *surface, int x, int y, Uint8 *r, Uint8 *g, Uint8 *b, Uint8 *a);
/**
* Retrieves a single pixel from a surface.
@ -1352,12 +1353,12 @@ extern SDL_DECLSPEC int SDLCALL SDL_ReadSurfacePixel(SDL_Surface *surface, int x
* 0-1, or NULL to ignore this channel.
* \param a a pointer filled in with the alpha channel, normally in the range
* 0-1, or NULL to ignore this channel.
* \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.
*/
extern SDL_DECLSPEC int SDLCALL SDL_ReadSurfacePixelFloat(SDL_Surface *surface, int x, int y, float *r, float *g, float *b, float *a);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_ReadSurfacePixelFloat(SDL_Surface *surface, int x, int y, float *r, float *g, float *b, float *a);
/**
* Writes a single pixel to a surface.
@ -1375,12 +1376,12 @@ extern SDL_DECLSPEC int SDLCALL SDL_ReadSurfacePixelFloat(SDL_Surface *surface,
* \param g the green channel value, 0-255.
* \param b the blue channel value, 0-255.
* \param a the alpha channel value, 0-255.
* \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.
*/
extern SDL_DECLSPEC int SDLCALL SDL_WriteSurfacePixel(SDL_Surface *surface, int x, int y, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_WriteSurfacePixel(SDL_Surface *surface, int x, int y, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
/**
* Writes a single pixel to a surface.
@ -1395,12 +1396,12 @@ extern SDL_DECLSPEC int SDLCALL SDL_WriteSurfacePixel(SDL_Surface *surface, int
* \param g the green channel value, normally in the range 0-1.
* \param b the blue channel value, normally in the range 0-1.
* \param a the alpha channel value, normally in the range 0-1.
* \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.
*/
extern SDL_DECLSPEC int SDLCALL SDL_WriteSurfacePixelFloat(SDL_Surface *surface, int x, int y, float r, float g, float b, float a);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_WriteSurfacePixelFloat(SDL_Surface *surface, int x, int y, float r, float g, float b, float a);
/* Ends C function definitions when using C++ */
#ifdef __cplusplus

View File

@ -101,8 +101,8 @@ extern SDL_DECLSPEC void SDLCALL SDL_SetWindowsMessageHook(SDL_WindowsMessageHoo
* controls on which monitor a full screen application will appear.
*
* \param displayID the instance of the display to query.
* \returns the D3D9 adapter index on success or a negative error code on
* failure; call SDL_GetError() for more information.
* \returns the D3D9 adapter index on success or -1 on failure; call
* SDL_GetError() for more information.
*
* \since This function is available since SDL 3.0.0.
*/
@ -122,12 +122,12 @@ extern SDL_DECLSPEC int SDLCALL SDL_GetDirect3D9AdapterIndex(SDL_DisplayID displ
* \param displayID the instance of the display to query.
* \param adapterIndex a pointer to be filled in with the adapter index.
* \param outputIndex a pointer to be filled in with the output index.
* \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.
*/
extern SDL_DECLSPEC int SDLCALL SDL_GetDXGIOutputInfo(SDL_DisplayID displayID, int *adapterIndex, int *outputIndex);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetDXGIOutputInfo(SDL_DisplayID displayID, int *adapterIndex, int *outputIndex);
#endif /* defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_WINGDK) */
@ -162,12 +162,12 @@ extern SDL_DECLSPEC void SDLCALL SDL_SetX11EventHook(SDL_X11EventHook callback,
*
* \param threadID the Unix thread ID to change priority of.
* \param priority the new, Unix-specific, priority value.
* \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.
*/
extern SDL_DECLSPEC int SDLCALL SDL_SetLinuxThreadPriority(Sint64 threadID, int priority);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetLinuxThreadPriority(Sint64 threadID, int priority);
/**
* Sets the priority (not nice level) and scheduling policy for a thread.
@ -178,12 +178,12 @@ extern SDL_DECLSPEC int SDLCALL SDL_SetLinuxThreadPriority(Sint64 threadID, int
* \param sdlPriority the new SDL_ThreadPriority value.
* \param schedPolicy the new scheduling policy (SCHED_FIFO, SCHED_RR,
* SCHED_OTHER, etc...).
* \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.
*/
extern SDL_DECLSPEC int SDLCALL SDL_SetLinuxThreadPriorityAndPolicy(Sint64 threadID, int sdlPriority, int schedPolicy);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetLinuxThreadPriorityAndPolicy(Sint64 threadID, int sdlPriority, int schedPolicy);
#endif /* SDL_PLATFORM_LINUX */
@ -240,14 +240,14 @@ typedef void (SDLCALL *SDL_iOSAnimationCallback)(void *userdata);
* called.
* \param callback the function to call for every frame.
* \param callbackParam a pointer that is passed to `callback`.
* \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_SetiOSEventPump
*/
extern SDL_DECLSPEC int SDLCALL SDL_SetiOSAnimationCallback(SDL_Window *window, int interval, SDL_iOSAnimationCallback callback, void *callbackParam);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetiOSAnimationCallback(SDL_Window *window, int interval, SDL_iOSAnimationCallback callback, void *callbackParam);
/**
* Use this function to enable or disable the SDL event pump on Apple iOS.
@ -503,15 +503,15 @@ typedef void (SDLCALL *SDL_RequestAndroidPermissionCallback)(void *userdata, con
* \param permission the permission to request.
* \param cb the callback to trigger when the request has a response.
* \param userdata an app-controlled pointer that is passed to the callback.
* \returns zero if the request was submitted, -1 if there was an error
* submitting. The result of the request is only ever reported
* \returns SDL_TRUE if the request was submitted, SDL_FALSE if there was an
* error submitting. The result of the request is only ever reported
* through the callback, not this return value.
*
* \threadsafety It is safe to call this function from any thread.
*
* \since This function is available since SDL 3.0.0.
*/
extern SDL_DECLSPEC int SDLCALL SDL_RequestAndroidPermission(const char *permission, SDL_RequestAndroidPermissionCallback cb, void *userdata);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_RequestAndroidPermission(const char *permission, SDL_RequestAndroidPermissionCallback cb, void *userdata);
/**
* Shows an Android toast notification.
@ -532,14 +532,14 @@ extern SDL_DECLSPEC int SDLCALL SDL_RequestAndroidPermission(const char *permiss
* \param gravity where the notification should appear on the screen.
* \param xoffset set this parameter only when gravity >=0.
* \param yoffset set this parameter only when gravity >=0.
* \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.
*
* \threadsafety It is safe to call this function from any thread.
*
* \since This function is available since SDL 3.0.0.
*/
extern SDL_DECLSPEC int SDLCALL SDL_ShowAndroidToast(const char *message, int duration, int gravity, int xoffset, int yoffset);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_ShowAndroidToast(const char *message, int duration, int gravity, int xoffset, int yoffset);
/**
* Send a user command to SDLActivity.
@ -548,14 +548,14 @@ extern SDL_DECLSPEC int SDLCALL SDL_ShowAndroidToast(const char *message, int du
*
* \param command user command that must be greater or equal to 0x8000.
* \param param user parameter.
* \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.
*
* \threadsafety It is safe to call this function from any thread.
*
* \since This function is available since SDL 3.0.0.
*/
extern SDL_DECLSPEC int SDLCALL SDL_SendAndroidMessage(Uint32 command, int param);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SendAndroidMessage(Uint32 command, int param);
#endif /* SDL_PLATFORM_ANDROID */
@ -794,12 +794,12 @@ typedef struct XUser *XUserHandle;
* leak.
*
* \param outTaskQueue a pointer to be filled in with task queue handle.
* \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.
*/
extern SDL_DECLSPEC int SDLCALL SDL_GetGDKTaskQueue(XTaskQueueHandle *outTaskQueue);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetGDKTaskQueue(XTaskQueueHandle *outTaskQueue);
/**
* Gets a reference to the default user handle for GDK.
@ -809,12 +809,12 @@ extern SDL_DECLSPEC int SDLCALL SDL_GetGDKTaskQueue(XTaskQueueHandle *outTaskQue
*
* \param outUserHandle a pointer to be filled in with the default user
* handle.
* \returns 0 if success or a negative error code on failure; call
* SDL_GetError() for more information.
* \returns SDL_TRUE if success or SDL_FALSE on failure; call SDL_GetError()
* for more information.
*
* \since This function is available since SDL 3.0.0.
*/
extern SDL_DECLSPEC int SDLCALL SDL_GetGDKDefaultUser(XUserHandle *outUserHandle);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetGDKDefaultUser(XUserHandle *outUserHandle);
#endif

View File

@ -252,10 +252,10 @@ extern SDL_DECLSPEC SDL_Thread * SDLCALL SDL_CreateThread(SDL_ThreadFunction fn,
*/
extern SDL_DECLSPEC SDL_Thread * SDLCALL SDL_CreateThreadWithProperties(SDL_PropertiesID props);
#define SDL_PROP_THREAD_CREATE_ENTRY_FUNCTION_POINTER "entry_function"
#define SDL_PROP_THREAD_CREATE_NAME_STRING "name"
#define SDL_PROP_THREAD_CREATE_USERDATA_POINTER "userdata"
#define SDL_PROP_THREAD_CREATE_STACKSIZE_NUMBER "stacksize"
#define SDL_PROP_THREAD_CREATE_ENTRY_FUNCTION_POINTER "SDL.thread.create.entry_function"
#define SDL_PROP_THREAD_CREATE_NAME_STRING "SDL.thread.create.name"
#define SDL_PROP_THREAD_CREATE_USERDATA_POINTER "SDL.thread.create.userdata"
#define SDL_PROP_THREAD_CREATE_STACKSIZE_NUMBER "SDL.thread.create.stacksize"
/* end wiki documentation for macros that are meant to look like functions. */
#endif
@ -320,10 +320,10 @@ extern SDL_DECLSPEC SDL_Thread * SDLCALL SDL_CreateThreadWithPropertiesRuntime(S
#define SDL_CreateThread(fn, name, data) SDL_CreateThreadRuntime((fn), (name), (data), (SDL_FunctionPointer) (SDL_BeginThreadFunction), (SDL_FunctionPointer) (SDL_EndThreadFunction))
#define SDL_CreateThreadWithProperties(props) SDL_CreateThreadWithPropertiesRuntime((props), (SDL_FunctionPointer) (SDL_BeginThreadFunction), (SDL_FunctionPointer) (SDL_EndThreadFunction))
#define SDL_PROP_THREAD_CREATE_ENTRY_FUNCTION_POINTER "entry_function"
#define SDL_PROP_THREAD_CREATE_NAME_STRING "name"
#define SDL_PROP_THREAD_CREATE_USERDATA_POINTER "userdata"
#define SDL_PROP_THREAD_CREATE_STACKSIZE_NUMBER "stacksize"
#define SDL_PROP_THREAD_CREATE_ENTRY_FUNCTION_POINTER "SDL.thread.create.entry_function"
#define SDL_PROP_THREAD_CREATE_NAME_STRING "SDL.thread.create.name"
#define SDL_PROP_THREAD_CREATE_USERDATA_POINTER "SDL.thread.create.userdata"
#define SDL_PROP_THREAD_CREATE_STACKSIZE_NUMBER "SDL.thread.create.stacksize"
#endif
@ -381,12 +381,12 @@ extern SDL_DECLSPEC SDL_ThreadID SDLCALL SDL_GetThreadID(SDL_Thread *thread);
* an administrator account. Be prepared for this to fail.
*
* \param priority the SDL_ThreadPriority to set.
* \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.
*/
extern SDL_DECLSPEC int SDLCALL SDL_SetThreadPriority(SDL_ThreadPriority priority);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetThreadPriority(SDL_ThreadPriority priority);
/**
* Wait for a thread to finish.
@ -504,8 +504,8 @@ typedef void (SDLCALL *SDL_TLSDestructorCallback)(void *value);
* \param value the value to associate with the ID for the current thread.
* \param destructor a function called when the thread exits, to free the
* value, may be NULL.
* \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.
*
* \threadsafety It is safe to call this function from any thread.
*
@ -513,7 +513,7 @@ typedef void (SDLCALL *SDL_TLSDestructorCallback)(void *value);
*
* \sa SDL_GetTLS
*/
extern SDL_DECLSPEC int SDLCALL SDL_SetTLS(SDL_TLSID *id, const void *value, SDL_TLSDestructorCallback destructor);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetTLS(SDL_TLSID *id, const void *value, SDL_TLSDestructorCallback destructor);
/**
* Cleanup all TLS data for this thread.

View File

@ -95,24 +95,24 @@ typedef enum SDL_TimeFormat
* format, may be NULL.
* \param timeFormat a pointer to the SDL_TimeFormat to hold the returned time
* format, may be NULL.
* \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.
*/
extern SDL_DECLSPEC int SDLCALL SDL_GetDateTimeLocalePreferences(SDL_DateFormat *dateFormat, SDL_TimeFormat *timeFormat);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetDateTimeLocalePreferences(SDL_DateFormat *dateFormat, SDL_TimeFormat *timeFormat);
/**
* Gets the current value of the system realtime clock in nanoseconds since
* Jan 1, 1970 in Universal Coordinated Time (UTC).
*
* \param ticks the SDL_Time to hold the returned tick count.
* \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.
*/
extern SDL_DECLSPEC int SDLCALL SDL_GetCurrentTime(SDL_Time *ticks);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetCurrentTime(SDL_Time *ticks);
/**
* Converts an SDL_Time in nanoseconds since the epoch to a calendar time in
@ -123,12 +123,12 @@ extern SDL_DECLSPEC int SDLCALL SDL_GetCurrentTime(SDL_Time *ticks);
* \param localTime the resulting SDL_DateTime will be expressed in local time
* if true, otherwise it will be in Universal Coordinated
* Time (UTC).
* \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.
*/
extern SDL_DECLSPEC int SDLCALL SDL_TimeToDateTime(SDL_Time ticks, SDL_DateTime *dt, SDL_bool localTime);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_TimeToDateTime(SDL_Time ticks, SDL_DateTime *dt, SDL_bool localTime);
/**
* Converts a calendar time to an SDL_Time in nanoseconds since the epoch.
@ -138,12 +138,12 @@ extern SDL_DECLSPEC int SDLCALL SDL_TimeToDateTime(SDL_Time ticks, SDL_DateTime
*
* \param dt the source SDL_DateTime.
* \param ticks the resulting SDL_Time.
* \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.
*/
extern SDL_DECLSPEC int SDLCALL SDL_DateTimeToTime(const SDL_DateTime *dt, SDL_Time *ticks);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_DateTimeToTime(const SDL_DateTime *dt, SDL_Time *ticks);
/**
* Converts an SDL time into a Windows FILETIME (100-nanosecond intervals
@ -181,8 +181,8 @@ extern SDL_DECLSPEC SDL_Time SDLCALL SDL_TimeFromWindows(Uint32 dwLowDateTime, U
*
* \param year the year.
* \param month the month [1-12].
* \returns the number of days in the requested month or a negative error code
* on failure; call SDL_GetError() for more information.
* \returns the number of days in the requested month or -1 on failure; call
* SDL_GetError() for more information.
*
* \since This function is available since SDL 3.0.0.
*/
@ -194,8 +194,8 @@ extern SDL_DECLSPEC int SDLCALL SDL_GetDaysInMonth(int year, int month);
* \param year the year component of the date.
* \param month the month component of the date.
* \param day the day component of the date.
* \returns the day of year [0-365] if the date is valid or a negative error
* code on failure; call SDL_GetError() for more information.
* \returns the day of year [0-365] if the date is valid or -1 on failure;
* call SDL_GetError() for more information.
*
* \since This function is available since SDL 3.0.0.
*/
@ -207,9 +207,8 @@ extern SDL_DECLSPEC int SDLCALL SDL_GetDayOfYear(int year, int month, int day);
* \param year the year component of the date.
* \param month the month component of the date.
* \param day the day component of the date.
* \returns a value between 0 and 6 (0 being Sunday) if the date is valid or a
* negative error code on failure; call SDL_GetError() for more
* information.
* \returns a value between 0 and 6 (0 being Sunday) if the date is valid or
* -1 on failure; call SDL_GetError() for more information.
*
* \since This function is available since SDL 3.0.0.
*/

View File

@ -137,7 +137,8 @@ typedef Uint32 SDL_TimerID;
* The callback function is passed the current timer interval and returns the
* next timer interval, in milliseconds. If the returned value is the same as
* the one passed in, the periodic alarm continues, otherwise a new alarm is
* scheduled. If the callback returns 0, the periodic alarm is cancelled.
* scheduled. If the callback returns 0, the periodic alarm is canceled and
* will be removed.
*
* \param userdata an arbitrary pointer provided by the app through
* SDL_AddTimer, for its own use.
@ -164,7 +165,7 @@ typedef Uint32 (SDLCALL *SDL_TimerCallback)(void *userdata, SDL_TimerID timerID,
* The callback function is passed the current timer interval and the user
* supplied parameter from the SDL_AddTimer() call and should return the next
* timer interval. If the value returned from the callback is 0, the timer is
* canceled.
* canceled and will be removed.
*
* The callback is run on a separate thread, and for short timeouts can
* potentially be called before this function returns.
@ -200,7 +201,8 @@ extern SDL_DECLSPEC SDL_TimerID SDLCALL SDL_AddTimer(Uint32 interval, SDL_TimerC
* The callback function is passed the current timer interval and returns the
* next timer interval, in nanoseconds. If the returned value is the same as
* the one passed in, the periodic alarm continues, otherwise a new alarm is
* scheduled. If the callback returns 0, the periodic alarm is cancelled.
* scheduled. If the callback returns 0, the periodic alarm is canceled and
* will be removed.
*
* \param userdata an arbitrary pointer provided by the app through
* SDL_AddTimer, for its own use.
@ -227,7 +229,7 @@ typedef Uint64 (SDLCALL *SDL_NSTimerCallback)(void *userdata, SDL_TimerID timerI
* The callback function is passed the current timer interval and the user
* supplied parameter from the SDL_AddTimerNS() call and should return the
* next timer interval. If the value returned from the callback is 0, the
* timer is canceled.
* timer is canceled and will be removed.
*
* The callback is run on a separate thread, and for short timeouts can
* potentially be called before this function returns.
@ -261,14 +263,14 @@ extern SDL_DECLSPEC SDL_TimerID SDLCALL SDL_AddTimerNS(Uint64 interval, SDL_NSTi
* Remove a timer created with SDL_AddTimer().
*
* \param id the ID of the timer to remove.
* \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_AddTimer
*/
extern SDL_DECLSPEC int SDLCALL SDL_RemoveTimer(SDL_TimerID id);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_RemoveTimer(SDL_TimerID id);
/* Ends C function definitions when using C++ */

File diff suppressed because it is too large Load Diff

View File

@ -95,15 +95,15 @@ struct VkAllocationCallbacks;
* library version.
*
* \param path the platform dependent Vulkan loader library name or NULL.
* \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_Vulkan_GetVkGetInstanceProcAddr
* \sa SDL_Vulkan_UnloadLibrary
*/
extern SDL_DECLSPEC int SDLCALL SDL_Vulkan_LoadLibrary(const char *path);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_Vulkan_LoadLibrary(const char *path);
/**
* Get the address of the `vkGetInstanceProcAddr` function.
@ -175,18 +175,18 @@ extern SDL_DECLSPEC char const * const * SDLCALL SDL_Vulkan_GetInstanceExtension
* allocator that creates the surface. Can be NULL.
* \param surface a pointer to a VkSurfaceKHR handle to output the newly
* created surface.
* \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_Vulkan_GetInstanceExtensions
* \sa SDL_Vulkan_DestroySurface
*/
extern SDL_DECLSPEC int SDLCALL SDL_Vulkan_CreateSurface(SDL_Window *window,
VkInstance instance,
const struct VkAllocationCallbacks *allocator,
VkSurfaceKHR* surface);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_Vulkan_CreateSurface(SDL_Window *window,
VkInstance instance,
const struct VkAllocationCallbacks *allocator,
VkSurfaceKHR* surface);
/**
* Destroy the Vulkan rendering surface of a window.

View File

@ -0,0 +1,68 @@
#!/bin/bash
set -x
set -e
cd `dirname "$0"`
shadernames=(FullscreenVert BlitFrom2D BlitFrom2DArray BlitFrom3D BlitFromCube)
generate_shaders()
{
fileplatform=$1
compileplatform=$2
sdkplatform=$3
minversion=$4
for shadername in "${shadernames[@]}"; do
xcrun -sdk $sdkplatform metal -c -std=$compileplatform-metal1.1 -m$sdkplatform-version-min=$minversion -Wall -O3 -D COMPILE_$shadername -o ./$shadername.air ./Metal_Blit.metal || exit $?
xcrun -sdk $sdkplatform metallib -o $shadername.metallib $shadername.air || exit $?
xxd -i $shadername.metallib | perl -w -p -e 's/\Aunsigned /const unsigned /;' >./${shadername}_$fileplatform.h
rm -f $shadername.air $shadername.metallib
done
}
generate_shaders macos macos macosx 10.11
generate_shaders ios ios iphoneos 8.0
generate_shaders iphonesimulator ios iphonesimulator 8.0
generate_shaders tvos ios appletvos 9.0
generate_shaders tvsimulator ios appletvsimulator 9.0
# Bundle together one mega-header
catShaders()
{
target=$1
for shadername in "${shadernames[@]}"; do
cat ${shadername}_$target.h >> Metal_Blit.h
done
}
rm -f Metal_Blit.h
echo "#if defined(SDL_PLATFORM_IOS)" >> Metal_Blit.h
echo "#if TARGET_OS_SIMULATOR" >> Metal_Blit.h
catShaders iphonesimulator
echo "#else" >> Metal_Blit.h
catShaders ios
echo "#endif" >> Metal_Blit.h
echo "#elif defined(SDL_PLATFORM_TVOS)" >> Metal_Blit.h
echo "#if TARGET_OS_SIMULATOR" >> Metal_Blit.h
catShaders tvsimulator
echo "#else" >> Metal_Blit.h
catShaders tvos
echo "#endif" >> Metal_Blit.h
echo "#else" >> Metal_Blit.h
catShaders macos
echo "#endif" >> Metal_Blit.h
# Clean up
cleanupShaders()
{
target=$1
for shadername in "${shadernames[@]}"; do
rm -f ${shadername}_$target.h
done
}
cleanupShaders iphonesimulator
cleanupShaders ios
cleanupShaders tvsimulator
cleanupShaders tvos
cleanupShaders macos

View File

@ -43,6 +43,7 @@
#include <SDL3/SDL_events.h>
#include <SDL3/SDL_filesystem.h>
#include <SDL3/SDL_gamepad.h>
#include <SDL3/SDL_gpu.h>
#include <SDL3/SDL_guid.h>
#include <SDL3/SDL_haptic.h>
#include <SDL3/SDL_hidapi.h>

View File

@ -303,9 +303,6 @@ extern SDL_DECLSPEC SDL_AssertState SDLCALL SDL_ReportAssertion(SDL_AssertData *
* "break" so that your debugger takes control as soon as assert is triggered,
* instead of risking a bad UI interaction (deadlock, etc) in the application.
*
* Note that SDL_ASSERT is an _environment variable_ and not an SDL hint!
* Please refer to your platform's documentation for how to set it!
*
* \param condition boolean value to test.
*
* \since This macro is available since SDL 3.0.0.
@ -335,9 +332,7 @@ extern SDL_DECLSPEC SDL_AssertState SDLCALL SDL_ReportAssertion(SDL_AssertData *
* an assertion in a background thread, it might be desirable to set this to
* "break" so that your debugger takes control as soon as assert is triggered,
* instead of risking a bad UI interaction (deadlock, etc) in the application.
*
* Note that SDL_ASSERT is an _environment variable_ and not an SDL hint!
* Please refer to your platform's documentation for how to set it!
* *
*
* \param condition boolean value to test.
*
@ -366,18 +361,14 @@ extern SDL_DECLSPEC SDL_AssertState SDLCALL SDL_ReportAssertion(SDL_AssertData *
* "break" so that your debugger takes control as soon as assert is triggered,
* instead of risking a bad UI interaction (deadlock, etc) in the application.
*
* Note that SDL_ASSERT is an _environment variable_ and not an SDL hint!
* Please refer to your platform's documentation for how to set it!
*
* \param condition boolean value to test.
*
* \since This macro is available since SDL 3.0.0.
*/
#define SDL_assert_paranoid(condition) SDL_disabled_assert(condition)
#endif
/* Enable various levels of assertions. */
#if SDL_ASSERT_LEVEL == 0 /* assertions disabled */
#elif SDL_ASSERT_LEVEL == 0 /* assertions disabled */
# define SDL_assert(condition) SDL_disabled_assert(condition)
# define SDL_assert_release(condition) SDL_disabled_assert(condition)
# define SDL_assert_paranoid(condition) SDL_disabled_assert(condition)
@ -412,9 +403,6 @@ extern SDL_DECLSPEC SDL_AssertState SDLCALL SDL_ReportAssertion(SDL_AssertData *
* "break" so that your debugger takes control as soon as assert is triggered,
* instead of risking a bad UI interaction (deadlock, etc) in the application.
*
* Note that SDL_ASSERT is an _environment variable_ and not an SDL hint!
* Please refer to your platform's documentation for how to set it!
*
* \param condition boolean value to test.
*
* \since This macro is available since SDL 3.0.0.

View File

@ -455,8 +455,8 @@ extern SDL_DECLSPEC int SDLCALL SDL_AtomicAdd(SDL_AtomicInt *a, int v);
* \since This function is available since SDL 3.0.0.
*
* \sa SDL_AtomicCompareAndSwap
* \sa SDL_AtomicGetPtr
* \sa SDL_AtomicSetPtr
* \sa SDL_AtomicGetPointer
* \sa SDL_AtomicSetPointer
*/
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_AtomicCompareAndSwapPointer(void **a, void *oldval, void *newval);
@ -475,9 +475,9 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_AtomicCompareAndSwapPointer(void **a, v
* \since This function is available since SDL 3.0.0.
*
* \sa SDL_AtomicCompareAndSwapPointer
* \sa SDL_AtomicGetPtr
* \sa SDL_AtomicGetPointer
*/
extern SDL_DECLSPEC void * SDLCALL SDL_AtomicSetPtr(void **a, void *v);
extern SDL_DECLSPEC void * SDLCALL SDL_AtomicSetPointer(void **a, void *v);
/**
* Get the value of a pointer atomically.
@ -493,9 +493,9 @@ extern SDL_DECLSPEC void * SDLCALL SDL_AtomicSetPtr(void **a, void *v);
* \since This function is available since SDL 3.0.0.
*
* \sa SDL_AtomicCompareAndSwapPointer
* \sa SDL_AtomicSetPtr
* \sa SDL_AtomicSetPointer
*/
extern SDL_DECLSPEC void * SDLCALL SDL_AtomicGetPtr(void **a);
extern SDL_DECLSPEC void * SDLCALL SDL_AtomicGetPointer(void **a);
/* Ends C function definitions when using C++ */
#ifdef __cplusplus

View File

@ -127,6 +127,7 @@ extern "C" {
*/
typedef enum SDL_AudioFormat
{
SDL_AUDIO_UNKNOWN = 0x0000u, /**< Unspecified audio format */
SDL_AUDIO_U8 = 0x0008u, /**< Unsigned 8-bit samples */
/* SDL_DEFINE_AUDIO_FORMAT(0, 0, 0, 8), */
SDL_AUDIO_S8 = 0x8008u, /**< Signed 8-bit samples */
@ -531,14 +532,14 @@ extern SDL_DECLSPEC const char * SDLCALL SDL_GetAudioDeviceName(SDL_AudioDeviceI
* \param spec on return, will be filled with device details.
* \param sample_frames pointer to store device buffer size, in sample frames.
* Can be NULL.
* \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.
*
* \threadsafety It is safe to call this function from any thread.
*
* \since This function is available since SDL 3.0.0.
*/
extern SDL_DECLSPEC int SDLCALL SDL_GetAudioDeviceFormat(SDL_AudioDeviceID devid, SDL_AudioSpec *spec, int *sample_frames);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetAudioDeviceFormat(SDL_AudioDeviceID devid, SDL_AudioSpec *spec, int *sample_frames);
/**
* Get the current channel map of an audio device.
@ -658,8 +659,8 @@ extern SDL_DECLSPEC SDL_AudioDeviceID SDLCALL SDL_OpenAudioDevice(SDL_AudioDevic
* created through SDL_OpenAudioDevice() can be.
*
* \param dev a device opened by SDL_OpenAudioDevice().
* \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.
*
* \threadsafety It is safe to call this function from any thread.
*
@ -668,7 +669,7 @@ extern SDL_DECLSPEC SDL_AudioDeviceID SDLCALL SDL_OpenAudioDevice(SDL_AudioDevic
* \sa SDL_ResumeAudioDevice
* \sa SDL_AudioDevicePaused
*/
extern SDL_DECLSPEC int SDLCALL SDL_PauseAudioDevice(SDL_AudioDeviceID dev);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_PauseAudioDevice(SDL_AudioDeviceID dev);
/**
* Use this function to unpause audio playback on a specified device.
@ -686,8 +687,8 @@ extern SDL_DECLSPEC int SDLCALL SDL_PauseAudioDevice(SDL_AudioDeviceID dev);
* created through SDL_OpenAudioDevice() can be.
*
* \param dev a device opened by SDL_OpenAudioDevice().
* \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.
*
* \threadsafety It is safe to call this function from any thread.
*
@ -696,7 +697,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_PauseAudioDevice(SDL_AudioDeviceID dev);
* \sa SDL_AudioDevicePaused
* \sa SDL_PauseAudioDevice
*/
extern SDL_DECLSPEC int SDLCALL SDL_ResumeAudioDevice(SDL_AudioDeviceID dev);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_ResumeAudioDevice(SDL_AudioDeviceID dev);
/**
* Use this function to query if an audio device is paused.
@ -766,8 +767,8 @@ extern SDL_DECLSPEC float SDLCALL SDL_GetAudioDeviceGain(SDL_AudioDeviceID devid
*
* \param devid the audio device on which to change gain.
* \param gain the gain. 1.0f is no change, 0.0f is silence.
* \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.
*
* \threadsafety It is safe to call this function from any thread, as it holds
* a stream-specific mutex while running.
@ -776,7 +777,7 @@ extern SDL_DECLSPEC float SDLCALL SDL_GetAudioDeviceGain(SDL_AudioDeviceID devid
*
* \sa SDL_GetAudioDeviceGain
*/
extern SDL_DECLSPEC int SDLCALL SDL_SetAudioDeviceGain(SDL_AudioDeviceID devid, float gain);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetAudioDeviceGain(SDL_AudioDeviceID devid, float gain);
/**
* Close a previously-opened audio device.
@ -823,8 +824,8 @@ extern SDL_DECLSPEC void SDLCALL SDL_CloseAudioDevice(SDL_AudioDeviceID devid);
* \param devid an audio device to bind a stream to.
* \param streams an array of audio streams to bind.
* \param num_streams number streams listed in the `streams` array.
* \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.
*
* \threadsafety It is safe to call this function from any thread.
*
@ -834,7 +835,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_CloseAudioDevice(SDL_AudioDeviceID devid);
* \sa SDL_UnbindAudioStream
* \sa SDL_GetAudioStreamDevice
*/
extern SDL_DECLSPEC int SDLCALL SDL_BindAudioStreams(SDL_AudioDeviceID devid, SDL_AudioStream **streams, int num_streams);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_BindAudioStreams(SDL_AudioDeviceID devid, SDL_AudioStream **streams, int num_streams);
/**
* Bind a single audio stream to an audio device.
@ -844,8 +845,8 @@ extern SDL_DECLSPEC int SDLCALL SDL_BindAudioStreams(SDL_AudioDeviceID devid, SD
*
* \param devid an audio device to bind a stream to.
* \param stream an audio stream to bind to a device.
* \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.
*
* \threadsafety It is safe to call this function from any thread.
*
@ -855,7 +856,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_BindAudioStreams(SDL_AudioDeviceID devid, SD
* \sa SDL_UnbindAudioStream
* \sa SDL_GetAudioStreamDevice
*/
extern SDL_DECLSPEC int SDLCALL SDL_BindAudioStream(SDL_AudioDeviceID devid, SDL_AudioStream *stream);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_BindAudioStream(SDL_AudioDeviceID devid, SDL_AudioStream *stream);
/**
* Unbind a list of audio streams from their audio devices.
@ -952,8 +953,8 @@ extern SDL_DECLSPEC SDL_PropertiesID SDLCALL SDL_GetAudioStreamProperties(SDL_Au
* \param stream the SDL_AudioStream to query.
* \param src_spec where to store the input audio format; ignored if NULL.
* \param dst_spec where to store the output audio format; ignored if NULL.
* \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.
*
* \threadsafety It is safe to call this function from any thread, as it holds
* a stream-specific mutex while running.
@ -962,9 +963,7 @@ extern SDL_DECLSPEC SDL_PropertiesID SDLCALL SDL_GetAudioStreamProperties(SDL_Au
*
* \sa SDL_SetAudioStreamFormat
*/
extern SDL_DECLSPEC int SDLCALL SDL_GetAudioStreamFormat(SDL_AudioStream *stream,
SDL_AudioSpec *src_spec,
SDL_AudioSpec *dst_spec);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetAudioStreamFormat(SDL_AudioStream *stream, SDL_AudioSpec *src_spec, SDL_AudioSpec *dst_spec);
/**
* Change the input and output formats of an audio stream.
@ -984,8 +983,8 @@ extern SDL_DECLSPEC int SDLCALL SDL_GetAudioStreamFormat(SDL_AudioStream *stream
* changed.
* \param dst_spec the new format of the audio output; if NULL, it is not
* changed.
* \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.
*
* \threadsafety It is safe to call this function from any thread, as it holds
* a stream-specific mutex while running.
@ -995,9 +994,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_GetAudioStreamFormat(SDL_AudioStream *stream
* \sa SDL_GetAudioStreamFormat
* \sa SDL_SetAudioStreamFrequencyRatio
*/
extern SDL_DECLSPEC int SDLCALL SDL_SetAudioStreamFormat(SDL_AudioStream *stream,
const SDL_AudioSpec *src_spec,
const SDL_AudioSpec *dst_spec);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetAudioStreamFormat(SDL_AudioStream *stream, const SDL_AudioSpec *src_spec, const SDL_AudioSpec *dst_spec);
/**
* Get the frequency ratio of an audio stream.
@ -1030,8 +1027,8 @@ extern SDL_DECLSPEC float SDLCALL SDL_GetAudioStreamFrequencyRatio(SDL_AudioStre
* \param stream the stream the frequency ratio is being changed.
* \param ratio the frequency ratio. 1.0 is normal speed. Must be between 0.01
* and 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.
*
* \threadsafety It is safe to call this function from any thread, as it holds
* a stream-specific mutex while running.
@ -1041,7 +1038,7 @@ extern SDL_DECLSPEC float SDLCALL SDL_GetAudioStreamFrequencyRatio(SDL_AudioStre
* \sa SDL_GetAudioStreamFrequencyRatio
* \sa SDL_SetAudioStreamFormat
*/
extern SDL_DECLSPEC int SDLCALL SDL_SetAudioStreamFrequencyRatio(SDL_AudioStream *stream, float ratio);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetAudioStreamFrequencyRatio(SDL_AudioStream *stream, float ratio);
/**
* Get the gain of an audio stream.
@ -1077,8 +1074,8 @@ extern SDL_DECLSPEC float SDLCALL SDL_GetAudioStreamGain(SDL_AudioStream *stream
*
* \param stream the stream on which the gain is being changed.
* \param gain the gain. 1.0f is no change, 0.0f is silence.
* \returns 0 on successor 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.
*
* \threadsafety It is safe to call this function from any thread, as it holds
* a stream-specific mutex while running.
@ -1087,7 +1084,7 @@ extern SDL_DECLSPEC float SDLCALL SDL_GetAudioStreamGain(SDL_AudioStream *stream
*
* \sa SDL_GetAudioStreamGain
*/
extern SDL_DECLSPEC int SDLCALL SDL_SetAudioStreamGain(SDL_AudioStream *stream, float gain);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetAudioStreamGain(SDL_AudioStream *stream, float gain);
/**
* Get the current input channel map of an audio stream.
@ -1174,8 +1171,8 @@ extern SDL_DECLSPEC int * SDLCALL SDL_GetAudioStreamOutputChannelMap(SDL_AudioSt
* \param stream the SDL_AudioStream to change.
* \param chmap the new channel map, NULL to reset to default.
* \param count The number of channels in the map.
* \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.
*
* \threadsafety It is safe to call this function from any thread, as it holds
* a stream-specific mutex while running. Don't change the
@ -1186,7 +1183,7 @@ extern SDL_DECLSPEC int * SDLCALL SDL_GetAudioStreamOutputChannelMap(SDL_AudioSt
*
* \sa SDL_SetAudioStreamInputChannelMap
*/
extern SDL_DECLSPEC int SDLCALL SDL_SetAudioStreamInputChannelMap(SDL_AudioStream *stream, const int *chmap, int count);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetAudioStreamInputChannelMap(SDL_AudioStream *stream, const int *chmap, int count);
/**
* Set the current output channel map of an audio stream.
@ -1221,8 +1218,8 @@ extern SDL_DECLSPEC int SDLCALL SDL_SetAudioStreamInputChannelMap(SDL_AudioStrea
* \param stream the SDL_AudioStream to change.
* \param chmap the new channel map, NULL to reset to default.
* \param count The number of channels in the map.
* \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.
*
* \threadsafety It is safe to call this function from any thread, as it holds
* a stream-specific mutex while running. Don't change the
@ -1233,7 +1230,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_SetAudioStreamInputChannelMap(SDL_AudioStrea
*
* \sa SDL_SetAudioStreamInputChannelMap
*/
extern SDL_DECLSPEC int SDLCALL SDL_SetAudioStreamOutputChannelMap(SDL_AudioStream *stream, const int *chmap, int count);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetAudioStreamOutputChannelMap(SDL_AudioStream *stream, const int *chmap, int count);
/**
* Add data to the stream.
@ -1249,8 +1246,8 @@ extern SDL_DECLSPEC int SDLCALL SDL_SetAudioStreamOutputChannelMap(SDL_AudioStre
* \param stream the stream the audio data is being added to.
* \param buf a pointer to the audio data to add.
* \param len the number of bytes to write to the stream.
* \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.
*
* \threadsafety It is safe to call this function from any thread, but if the
* stream has a callback set, the caller might need to manage
@ -1263,7 +1260,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_SetAudioStreamOutputChannelMap(SDL_AudioStre
* \sa SDL_GetAudioStreamData
* \sa SDL_GetAudioStreamQueued
*/
extern SDL_DECLSPEC int SDLCALL SDL_PutAudioStreamData(SDL_AudioStream *stream, const void *buf, int len);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_PutAudioStreamData(SDL_AudioStream *stream, const void *buf, int len);
/**
* Get converted/resampled data from the stream.
@ -1280,8 +1277,8 @@ extern SDL_DECLSPEC int SDLCALL SDL_PutAudioStreamData(SDL_AudioStream *stream,
* \param stream the stream the audio is being requested from.
* \param buf a buffer to fill with audio data.
* \param len the maximum number of bytes to fill.
* \returns the number of bytes read from the stream or a negative error code
* on failure; call SDL_GetError() for more information.
* \returns the number of bytes read from the stream or -1 on failure; call
* SDL_GetError() for more information.
*
* \threadsafety It is safe to call this function from any thread, but if the
* stream has a callback set, the caller might need to manage
@ -1309,7 +1306,8 @@ extern SDL_DECLSPEC int SDLCALL SDL_GetAudioStreamData(SDL_AudioStream *stream,
* clamped.
*
* \param stream the audio stream to query.
* \returns the number of converted/resampled bytes available.
* \returns the number of converted/resampled bytes available or -1 on
* failure; call SDL_GetError() for more information.
*
* \threadsafety It is safe to call this function from any thread.
*
@ -1341,7 +1339,8 @@ extern SDL_DECLSPEC int SDLCALL SDL_GetAudioStreamAvailable(SDL_AudioStream *str
* clamped.
*
* \param stream the audio stream to query.
* \returns the number of bytes queued.
* \returns the number of bytes queued or -1 on failure; call SDL_GetError()
* for more information.
*
* \threadsafety It is safe to call this function from any thread.
*
@ -1362,8 +1361,8 @@ extern SDL_DECLSPEC int SDLCALL SDL_GetAudioStreamQueued(SDL_AudioStream *stream
* input, so the complete output becomes available.
*
* \param stream the audio stream to flush.
* \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.
*
* \threadsafety It is safe to call this function from any thread.
*
@ -1371,7 +1370,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_GetAudioStreamQueued(SDL_AudioStream *stream
*
* \sa SDL_PutAudioStreamData
*/
extern SDL_DECLSPEC int SDLCALL SDL_FlushAudioStream(SDL_AudioStream *stream);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_FlushAudioStream(SDL_AudioStream *stream);
/**
* Clear any pending data in the stream.
@ -1380,8 +1379,8 @@ extern SDL_DECLSPEC int SDLCALL SDL_FlushAudioStream(SDL_AudioStream *stream);
* stream until more is added.
*
* \param stream the audio stream to clear.
* \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.
*
* \threadsafety It is safe to call this function from any thread.
*
@ -1392,7 +1391,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_FlushAudioStream(SDL_AudioStream *stream);
* \sa SDL_GetAudioStreamQueued
* \sa SDL_PutAudioStreamData
*/
extern SDL_DECLSPEC int SDLCALL SDL_ClearAudioStream(SDL_AudioStream *stream);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_ClearAudioStream(SDL_AudioStream *stream);
/**
* Use this function to pause audio playback on the audio device associated
@ -1407,8 +1406,8 @@ extern SDL_DECLSPEC int SDLCALL SDL_ClearAudioStream(SDL_AudioStream *stream);
* loading, etc.
*
* \param stream the audio stream associated with the audio 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.
*
* \threadsafety It is safe to call this function from any thread.
*
@ -1416,7 +1415,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_ClearAudioStream(SDL_AudioStream *stream);
*
* \sa SDL_ResumeAudioStreamDevice
*/
extern SDL_DECLSPEC int SDLCALL SDL_PauseAudioStreamDevice(SDL_AudioStream *stream);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_PauseAudioStreamDevice(SDL_AudioStream *stream);
/**
* Use this function to unpause audio playback on the audio device associated
@ -1427,8 +1426,8 @@ extern SDL_DECLSPEC int SDLCALL SDL_PauseAudioStreamDevice(SDL_AudioStream *stre
* to progress again, and audio can be generated.
*
* \param stream the audio stream associated with the audio device to resume.
* \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.
*
* \threadsafety It is safe to call this function from any thread.
*
@ -1436,7 +1435,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_PauseAudioStreamDevice(SDL_AudioStream *stre
*
* \sa SDL_PauseAudioStreamDevice
*/
extern SDL_DECLSPEC int SDLCALL SDL_ResumeAudioStreamDevice(SDL_AudioStream *stream);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_ResumeAudioStreamDevice(SDL_AudioStream *stream);
/**
* Lock an audio stream for serialized access.
@ -1455,8 +1454,8 @@ extern SDL_DECLSPEC int SDLCALL SDL_ResumeAudioStreamDevice(SDL_AudioStream *str
* all the same attributes (recursive locks are allowed, etc).
*
* \param stream the audio stream to lock.
* \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.
*
* \threadsafety It is safe to call this function from any thread.
*
@ -1464,7 +1463,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_ResumeAudioStreamDevice(SDL_AudioStream *str
*
* \sa SDL_UnlockAudioStream
*/
extern SDL_DECLSPEC int SDLCALL SDL_LockAudioStream(SDL_AudioStream *stream);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_LockAudioStream(SDL_AudioStream *stream);
/**
@ -1473,8 +1472,8 @@ extern SDL_DECLSPEC int SDLCALL SDL_LockAudioStream(SDL_AudioStream *stream);
* This unlocks an audio stream after a call to SDL_LockAudioStream.
*
* \param stream the audio stream to unlock.
* \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.
*
* \threadsafety You should only call this from the same thread that
* previously called SDL_LockAudioStream.
@ -1483,7 +1482,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_LockAudioStream(SDL_AudioStream *stream);
*
* \sa SDL_LockAudioStream
*/
extern SDL_DECLSPEC int SDLCALL SDL_UnlockAudioStream(SDL_AudioStream *stream);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_UnlockAudioStream(SDL_AudioStream *stream);
/**
* A callback that fires when data passes through an SDL_AudioStream.
@ -1558,13 +1557,12 @@ typedef void (SDLCALL *SDL_AudioStreamCallback)(void *userdata, SDL_AudioStream
* Setting a NULL function turns off the callback.
*
* \param stream the audio stream to set the new callback on.
* \param callback the new callback function to call when data is added to the
* stream.
* \param callback the new callback function to call when data is requested
* from the stream.
* \param userdata an opaque pointer provided to the callback for its own
* personal use.
* \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information. This only fails if `stream`
* is NULL.
* \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError()
* for more information. This only fails if `stream` is NULL.
*
* \threadsafety It is safe to call this function from any thread.
*
@ -1572,7 +1570,7 @@ typedef void (SDLCALL *SDL_AudioStreamCallback)(void *userdata, SDL_AudioStream
*
* \sa SDL_SetAudioStreamPutCallback
*/
extern SDL_DECLSPEC int SDLCALL SDL_SetAudioStreamGetCallback(SDL_AudioStream *stream, SDL_AudioStreamCallback callback, void *userdata);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetAudioStreamGetCallback(SDL_AudioStream *stream, SDL_AudioStreamCallback callback, void *userdata);
/**
* Set a callback that runs when data is added to an audio stream.
@ -1612,9 +1610,8 @@ extern SDL_DECLSPEC int SDLCALL SDL_SetAudioStreamGetCallback(SDL_AudioStream *s
* stream.
* \param userdata an opaque pointer provided to the callback for its own
* personal use.
* \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information. This only fails if `stream`
* is NULL.
* \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError()
* for more information. This only fails if `stream` is NULL.
*
* \threadsafety It is safe to call this function from any thread.
*
@ -1622,7 +1619,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_SetAudioStreamGetCallback(SDL_AudioStream *s
*
* \sa SDL_SetAudioStreamGetCallback
*/
extern SDL_DECLSPEC int SDLCALL SDL_SetAudioStreamPutCallback(SDL_AudioStream *stream, SDL_AudioStreamCallback callback, void *userdata);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetAudioStreamPutCallback(SDL_AudioStream *stream, SDL_AudioStreamCallback callback, void *userdata);
/**
@ -1791,14 +1788,14 @@ typedef void (SDLCALL *SDL_AudioPostmixCallback)(void *userdata, const SDL_Audio
* \param devid the ID of an opened audio device.
* \param callback a callback function to be called. Can be NULL.
* \param userdata app-controlled pointer passed to callback. Can be NULL.
* \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.
*
* \threadsafety It is safe to call this function from any thread.
*
* \since This function is available since SDL 3.0.0.
*/
extern SDL_DECLSPEC int SDLCALL SDL_SetAudioPostmixCallback(SDL_AudioDeviceID devid, SDL_AudioPostmixCallback callback, void *userdata);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetAudioPostmixCallback(SDL_AudioDeviceID devid, SDL_AudioPostmixCallback callback, void *userdata);
/**
@ -1861,13 +1858,13 @@ extern SDL_DECLSPEC int SDLCALL SDL_SetAudioPostmixCallback(SDL_AudioDeviceID de
* function.
* \param audio_len a pointer filled with the length of the audio data buffer
* in bytes.
* \returns 0 on success. `audio_buf` will be filled with a pointer to an
* allocated buffer containing the audio data, and `audio_len` is
* \returns SDL_TRUE on success. `audio_buf` will be filled with a pointer to
* an allocated buffer containing the audio data, and `audio_len` is
* filled with the length of that audio buffer in bytes.
*
* This function returns -1 if the .WAV file cannot be opened, uses
* an unknown data format, or is corrupt; call SDL_GetError() for
* more information.
* This function returns SDL_FALSE if the .WAV file cannot be opened,
* uses an unknown data format, or is corrupt; call SDL_GetError()
* for more information.
*
* When the application is done with the data returned in
* `audio_buf`, it should call SDL_free() to dispose of it.
@ -1879,9 +1876,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_SetAudioPostmixCallback(SDL_AudioDeviceID de
* \sa SDL_free
* \sa SDL_LoadWAV
*/
extern SDL_DECLSPEC int SDLCALL SDL_LoadWAV_IO(SDL_IOStream * src, SDL_bool closeio,
SDL_AudioSpec * spec, Uint8 ** audio_buf,
Uint32 * audio_len);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_LoadWAV_IO(SDL_IOStream *src, SDL_bool closeio, SDL_AudioSpec *spec, Uint8 **audio_buf, Uint32 *audio_len);
/**
* Loads a WAV from a file path.
@ -1889,7 +1884,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_LoadWAV_IO(SDL_IOStream * src, SDL_bool clos
* This is a convenience function that is effectively the same as:
*
* ```c
* SDL_LoadWAV_IO(SDL_IOFromFile(path, "rb"), 1, spec, audio_buf, audio_len);
* SDL_LoadWAV_IO(SDL_IOFromFile(path, "rb"), SDL_TRUE, spec, audio_buf, audio_len);
* ```
*
* \param path the file path of the WAV file to open.
@ -1899,13 +1894,13 @@ extern SDL_DECLSPEC int SDLCALL SDL_LoadWAV_IO(SDL_IOStream * src, SDL_bool clos
* function.
* \param audio_len a pointer filled with the length of the audio data buffer
* in bytes.
* \returns 0 on success. `audio_buf` will be filled with a pointer to an
* allocated buffer containing the audio data, and `audio_len` is
* \returns SDL_TRUE on success. `audio_buf` will be filled with a pointer to
* an allocated buffer containing the audio data, and `audio_len` is
* filled with the length of that audio buffer in bytes.
*
* This function returns -1 if the .WAV file cannot be opened, uses
* an unknown data format, or is corrupt; call SDL_GetError() for
* more information.
* This function returns SDL_FALSE if the .WAV file cannot be opened,
* uses an unknown data format, or is corrupt; call SDL_GetError()
* for more information.
*
* When the application is done with the data returned in
* `audio_buf`, it should call SDL_free() to dispose of it.
@ -1917,8 +1912,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_LoadWAV_IO(SDL_IOStream * src, SDL_bool clos
* \sa SDL_free
* \sa SDL_LoadWAV_IO
*/
extern SDL_DECLSPEC int SDLCALL SDL_LoadWAV(const char *path, SDL_AudioSpec * spec,
Uint8 ** audio_buf, Uint32 * audio_len);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_LoadWAV(const char *path, SDL_AudioSpec *spec, Uint8 **audio_buf, Uint32 *audio_len);
/**
* Mix audio data in a specified format.
@ -1947,17 +1941,14 @@ extern SDL_DECLSPEC int SDLCALL SDL_LoadWAV(const char *path, SDL_AudioSpec * sp
* \param len the length of the audio buffer in bytes.
* \param volume ranges from 0.0 - 1.0, and should be set to 1.0 for full
* audio volume.
* \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.
*
* \threadsafety It is safe to call this function from any thread.
*
* \since This function is available since SDL 3.0.0.
*/
extern SDL_DECLSPEC int SDLCALL SDL_MixAudio(Uint8 * dst,
const Uint8 * src,
SDL_AudioFormat format,
Uint32 len, float volume);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_MixAudio(Uint8 *dst, const Uint8 *src, SDL_AudioFormat format, Uint32 len, float volume);
/**
* Convert some audio data of one format to another format.
@ -1980,20 +1971,27 @@ extern SDL_DECLSPEC int SDLCALL SDL_MixAudio(Uint8 * dst,
* which should be freed with SDL_free(). On error, it will be
* NULL.
* \param dst_len will be filled with the len of dst_data.
* \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.
*
* \threadsafety It is safe to call this function from any thread.
*
* \since This function is available since SDL 3.0.0.
*/
extern SDL_DECLSPEC int SDLCALL SDL_ConvertAudioSamples(const SDL_AudioSpec *src_spec,
const Uint8 *src_data,
int src_len,
const SDL_AudioSpec *dst_spec,
Uint8 **dst_data,
int *dst_len);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_ConvertAudioSamples(const SDL_AudioSpec *src_spec, const Uint8 *src_data, int src_len, const SDL_AudioSpec *dst_spec, Uint8 **dst_data, int *dst_len);
/**
* Get the human readable name of an audio format.
*
* \param format the audio format to query.
* \returns the human readable name of the specified audio format or
* "SDL_AUDIO_UNKNOWN" if the format isn't recognized.
*
* \threadsafety It is safe to call this function from any thread.
*
* \since This function is available since SDL 3.0.0.
*/
extern SDL_DECLSPEC const char * SDLCALL SDL_GetAudioFormatName(SDL_AudioFormat format);
/**
* Get the appropriate memset value for silencing an audio format.

View File

@ -48,8 +48,7 @@ extern "C" {
*
* If the 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.
*
@ -367,15 +366,15 @@ extern SDL_DECLSPEC SDL_PropertiesID SDLCALL SDL_GetCameraProperties(SDL_Camera
* be converting to this format behind the scenes.
*
* If the system is waiting for the user to approve access to the camera, as
* some platforms require, this will return -1, but this isn't necessarily a
* fatal error; you should either wait for an SDL_EVENT_CAMERA_DEVICE_APPROVED
* (or SDL_EVENT_CAMERA_DEVICE_DENIED) event, or poll SDL_IsCameraApproved()
* occasionally until it returns non-zero.
* some platforms require, this will return SDL_FALSE, but this isn't
* necessarily a fatal error; you should either wait for an
* SDL_EVENT_CAMERA_DEVICE_APPROVED (or SDL_EVENT_CAMERA_DEVICE_DENIED) event,
* or poll SDL_IsCameraApproved() occasionally until it returns non-zero.
*
* \param camera opened camera device.
* \param spec the SDL_CameraSpec to be initialized by this function.
* \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.
*
* \threadsafety It is safe to call this function from any thread.
*
@ -383,7 +382,7 @@ extern SDL_DECLSPEC SDL_PropertiesID SDLCALL SDL_GetCameraProperties(SDL_Camera
*
* \sa SDL_OpenCamera
*/
extern SDL_DECLSPEC int SDLCALL SDL_GetCameraFormat(SDL_Camera *camera, SDL_CameraSpec *spec);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetCameraFormat(SDL_Camera *camera, SDL_CameraSpec *spec);
/**
* Acquire a frame.
@ -447,8 +446,6 @@ extern SDL_DECLSPEC SDL_Surface * SDLCALL SDL_AcquireCameraFrame(SDL_Camera *cam
*
* \param camera opened camera device.
* \param frame the video frame surface to release.
* \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information.
*
* \threadsafety It is safe to call this function from any thread.
*
@ -456,7 +453,7 @@ extern SDL_DECLSPEC SDL_Surface * SDLCALL SDL_AcquireCameraFrame(SDL_Camera *cam
*
* \sa SDL_AcquireCameraFrame
*/
extern SDL_DECLSPEC int SDLCALL SDL_ReleaseCameraFrame(SDL_Camera *camera, SDL_Surface *frame);
extern SDL_DECLSPEC void SDLCALL SDL_ReleaseCameraFrame(SDL_Camera *camera, SDL_Surface *frame);
/**
* Use this function to shut down camera processing and close the camera

View File

@ -46,15 +46,15 @@ extern "C" {
* Put UTF-8 text into the clipboard.
*
* \param text the text to store in the clipboard.
* \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_GetClipboardText
* \sa SDL_HasClipboardText
*/
extern SDL_DECLSPEC int SDLCALL SDL_SetClipboardText(const char *text);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetClipboardText(const char *text);
/**
* Get UTF-8 text from the clipboard.
@ -89,15 +89,15 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_HasClipboardText(void);
* Put UTF-8 text into the primary selection.
*
* \param text the text to store in the primary selection.
* \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_GetPrimarySelectionText
* \sa SDL_HasPrimarySelectionText
*/
extern SDL_DECLSPEC int SDLCALL SDL_SetPrimarySelectionText(const char *text);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetPrimarySelectionText(const char *text);
/**
* Get UTF-8 text from the primary selection.
@ -185,8 +185,8 @@ typedef void (SDLCALL *SDL_ClipboardCleanupCallback)(void *userdata);
* \param userdata an opaque pointer that will be forwarded to the callbacks.
* \param mime_types a list of mime-types that are being offered.
* \param num_mime_types the number of mime-types in the mime_types list.
* \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.
*
@ -194,19 +194,19 @@ typedef void (SDLCALL *SDL_ClipboardCleanupCallback)(void *userdata);
* \sa SDL_GetClipboardData
* \sa SDL_HasClipboardData
*/
extern SDL_DECLSPEC int SDLCALL SDL_SetClipboardData(SDL_ClipboardDataCallback callback, SDL_ClipboardCleanupCallback cleanup, void *userdata, const char **mime_types, size_t num_mime_types);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetClipboardData(SDL_ClipboardDataCallback callback, SDL_ClipboardCleanupCallback cleanup, void *userdata, const char **mime_types, size_t num_mime_types);
/**
* Clear the clipboard data.
*
* \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_SetClipboardData
*/
extern SDL_DECLSPEC int SDLCALL SDL_ClearClipboardData(void);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_ClearClipboardData(void);
/**
* Get the data from clipboard for a given mime type.

View File

@ -56,25 +56,25 @@ extern "C" {
* \param fmt a printf()-style message format string.
* \param ... additional parameters matching % tokens in the `fmt` string, if
* any.
* \returns -1.
* \returns SDL_FALSE.
*
* \since This function is available since SDL 3.0.0.
*
* \sa SDL_ClearError
* \sa SDL_GetError
*/
extern SDL_DECLSPEC int SDLCALL SDL_SetError(SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(1);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetError(SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(1);
/**
* Set an error indicating that memory allocation failed.
*
* This function does not do any memory allocation.
*
* \returns -1.
* \returns SDL_FALSE.
*
* \since This function is available since SDL 3.0.0.
*/
extern SDL_DECLSPEC int SDLCALL SDL_OutOfMemory(void);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_OutOfMemory(void);
/**
* Retrieve a message about the last error that occurred on the current
@ -114,14 +114,14 @@ extern SDL_DECLSPEC const char * SDLCALL SDL_GetError(void);
/**
* Clear any previous error message for this thread.
*
* \returns 0.
* \returns SDL_TRUE.
*
* \since This function is available since SDL 3.0.0.
*
* \sa SDL_GetError
* \sa SDL_SetError
*/
extern SDL_DECLSPEC int SDLCALL SDL_ClearError(void);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_ClearError(void);
/**
* \name Internal error functions

View File

@ -151,8 +151,6 @@ typedef enum SDL_EventType
in an event watcher, the window handle is still valid and can still be used to retrieve any userdata
associated with the window. Otherwise, the handle has already been destroyed and all resources
associated with it are invalid */
SDL_EVENT_WINDOW_PEN_ENTER, /**< Window has gained focus of the pressure-sensitive pen with ID "data1" */
SDL_EVENT_WINDOW_PEN_LEAVE, /**< Window has lost focus of the pressure-sensitive pen with ID "data1" */
SDL_EVENT_WINDOW_HDR_STATE_CHANGED, /**< Window HDR properties have changed */
SDL_EVENT_WINDOW_FIRST = SDL_EVENT_WINDOW_SHOWN,
SDL_EVENT_WINDOW_LAST = SDL_EVENT_WINDOW_HDR_STATE_CHANGED,
@ -227,11 +225,14 @@ typedef enum SDL_EventType
SDL_EVENT_SENSOR_UPDATE = 0x1200, /**< A sensor was updated */
/* Pressure-sensitive pen events */
SDL_EVENT_PEN_DOWN = 0x1300, /**< Pressure-sensitive pen touched drawing surface */
SDL_EVENT_PEN_PROXIMITY_IN = 0x1300, /**< Pressure-sensitive pen has become available */
SDL_EVENT_PEN_PROXIMITY_OUT, /**< Pressure-sensitive pen has become unavailable */
SDL_EVENT_PEN_DOWN, /**< Pressure-sensitive pen touched drawing surface */
SDL_EVENT_PEN_UP, /**< Pressure-sensitive pen stopped touching drawing surface */
SDL_EVENT_PEN_MOTION, /**< Pressure-sensitive pen moved, or angle/pressure changed */
SDL_EVENT_PEN_BUTTON_DOWN, /**< Pressure-sensitive pen button pressed */
SDL_EVENT_PEN_BUTTON_UP, /**< Pressure-sensitive pen button released */
SDL_EVENT_PEN_MOTION, /**< Pressure-sensitive pen is moving on the tablet */
SDL_EVENT_PEN_AXIS, /**< Pressure-sensitive pen angle/pressure/etc changed */
/* Camera hotplug events */
SDL_EVENT_CAMERA_DEVICE_ADDED = 0x1400, /**< A new camera device is available */
@ -426,7 +427,7 @@ typedef struct SDL_MouseMotionEvent
Uint32 reserved;
Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
SDL_WindowID windowID; /**< The window with mouse focus, if any */
SDL_MouseID which; /**< The mouse instance id, SDL_TOUCH_MOUSEID, or SDL_PEN_MOUSEID */
SDL_MouseID which; /**< The mouse instance id or SDL_TOUCH_MOUSEID */
SDL_MouseButtonFlags state; /**< The current button state */
float x; /**< X coordinate, relative to window */
float y; /**< Y coordinate, relative to window */
@ -445,7 +446,7 @@ typedef struct SDL_MouseButtonEvent
Uint32 reserved;
Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
SDL_WindowID windowID; /**< The window with mouse focus, if any */
SDL_MouseID which; /**< The mouse instance id, SDL_TOUCH_MOUSEID, or SDL_PEN_MOUSEID */
SDL_MouseID which; /**< The mouse instance id, SDL_TOUCH_MOUSEID */
Uint8 button; /**< The mouse button index */
Uint8 state; /**< SDL_PRESSED or SDL_RELEASED */
Uint8 clicks; /**< 1 for single-click, 2 for double-click, etc. */
@ -465,7 +466,7 @@ typedef struct SDL_MouseWheelEvent
Uint32 reserved;
Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
SDL_WindowID windowID; /**< The window with mouse focus, if any */
SDL_MouseID which; /**< The mouse instance id, SDL_TOUCH_MOUSEID, or SDL_PEN_MOUSEID */
SDL_MouseID which; /**< The mouse instance id, SDL_TOUCH_MOUSEID */
float x; /**< The amount scrolled horizontally, positive to the right and negative to the left */
float y; /**< The amount scrolled vertically, positive away from the user and negative toward the user */
SDL_MouseWheelDirection direction; /**< Set to one of the SDL_MOUSEWHEEL_* defines. When FLIPPED the values in X and Y will be opposite. Multiply by -1 to change them back */
@ -714,67 +715,118 @@ typedef struct SDL_TouchFingerEvent
SDL_WindowID windowID; /**< The window underneath the finger, if any */
} SDL_TouchFingerEvent;
/**
* Pressure-sensitive pen touched or stopped touching surface (event.ptip.*)
* Pressure-sensitive pen proximity event structure (event.pmotion.*)
*
* When a pen becomes visible to the system (it is close enough to a tablet,
* etc), SDL will send an SDL_EVENT_PEN_PROXIMITY_IN event with the new pen's
* ID. This ID is valid until the pen leaves proximity again (has been removed
* from the tablet's area, the tablet has been unplugged, etc). If the same
* pen reenters proximity again, it will be given a new ID.
*
* Note that "proximity" means "close enough for the tablet to know the tool
* is there." The pen touching and lifting off from the tablet while not
* leaving the area are handled by SDL_EVENT_PEN_DOWN and SDL_EVENT_PEN_UP.
*
* \since This struct is available since SDL 3.0.0.
*/
typedef struct SDL_PenTipEvent
typedef struct SDL_PenProximityEvent
{
SDL_EventType type; /**< SDL_EVENT_PEN_PROXIMITY_IN or SDL_EVENT_PEN_PROXIMITY_OUT */
Uint32 reserved;
Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
SDL_WindowID windowID; /**< The window with mouse focus, if any */
SDL_PenID which; /**< The pen instance id */
} SDL_PenProximityEvent;
/**
* Pressure-sensitive pen motion event structure (event.pmotion.*)
*
* Depending on the hardware, you may get motion events when the pen is not
* touching a tablet, for tracking a pen even when it isn't drawing. You
* should listen for SDL_EVENT_PEN_DOWN and SDL_EVENT_PEN_UP events, or check
* `pen_state & SDL_PEN_INPUT_DOWN` to decide if a pen is "drawing" when
* dealing with pen motion.
*
* \since This struct is available since SDL 3.0.0.
*/
typedef struct SDL_PenMotionEvent
{
SDL_EventType type; /**< SDL_EVENT_PEN_MOTION */
Uint32 reserved;
Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
SDL_WindowID windowID; /**< The window with mouse focus, if any */
SDL_PenID which; /**< The pen instance id */
SDL_PenInputFlags pen_state; /**< Complete pen input state at time of event */
float x; /**< X position of pen on tablet */
float y; /**< Y position of pen on tablet */
} SDL_PenMotionEvent;
/**
* Pressure-sensitive pen touched event structure (event.ptouch.*)
*
* These events come when a pen touches a surface (a tablet, etc), or lifts
* off from one.
*
* \since This struct is available since SDL 3.0.0.
*/
typedef struct SDL_PenTouchEvent
{
SDL_EventType type; /**< SDL_EVENT_PEN_DOWN or SDL_EVENT_PEN_UP */
Uint32 reserved;
Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
SDL_WindowID windowID; /**< The window with pen focus, if any */
SDL_PenID which; /**< The pen instance id */
Uint8 tip; /**< SDL_PEN_TIP_INK when using a regular pen tip, or SDL_PEN_TIP_ERASER if the pen is being used as an eraser (e.g., flipped to use the eraser tip) */
Uint8 state; /**< SDL_PRESSED on SDL_EVENT_PEN_DOWN and SDL_RELEASED on SDL_EVENT_PEN_UP */
Uint16 pen_state; /**< Pen button masks (where SDL_BUTTON(1) is the first button, SDL_BUTTON(2) is the second button etc.), SDL_PEN_DOWN_MASK is set if the pen is touching the surface, and SDL_PEN_ERASER_MASK is set if the pen is (used as) an eraser. */
float x; /**< X coordinate, relative to window */
float y; /**< Y coordinate, relative to window */
float axes[SDL_PEN_NUM_AXES]; /**< Pen axes such as pressure and tilt (ordered as per SDL_PenAxis) */
} SDL_PenTipEvent;
/**
* Pressure-sensitive pen motion / pressure / angle event structure
* (event.pmotion.*)
*
* \since This struct is available since SDL 3.0.0.
*/
typedef struct SDL_PenMotionEvent
{
SDL_EventType type; /**< SDL_EVENT_PEN_MOTION */
Uint32 reserved;
Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
SDL_WindowID windowID; /**< The window with pen focus, if any */
SDL_PenID which; /**< The pen instance id */
Uint8 padding1;
Uint8 padding2;
Uint16 pen_state; /**< Pen button masks (where SDL_BUTTON(1) is the first button, SDL_BUTTON(2) is the second button etc.), SDL_PEN_DOWN_MASK is set if the pen is touching the surface, and SDL_PEN_ERASER_MASK is set if the pen is (used as) an eraser. */
float x; /**< X coordinate, relative to window */
float y; /**< Y coordinate, relative to window */
float axes[SDL_PEN_NUM_AXES]; /**< Pen axes such as pressure and tilt (ordered as per SDL_PenAxis) */
} SDL_PenMotionEvent;
SDL_PenInputFlags pen_state; /**< Complete pen input state at time of event */
float x; /**< X position of pen on tablet */
float y; /**< Y position of pen on tablet */
Uint8 eraser; /**< Non-zero if eraser end is used (not all pens support this). */
Uint8 state; /**< SDL_PRESSED (pen is touching) or SDL_RELEASED (pen is lifted off) */
} SDL_PenTouchEvent;
/**
* Pressure-sensitive pen button event structure (event.pbutton.*)
*
* This is for buttons on the pen itself that the user might click. The pen
* itself pressing down to draw triggers a SDL_EVENT_PEN_DOWN event instead.
*
* \since This struct is available since SDL 3.0.0.
*/
typedef struct SDL_PenButtonEvent
{
SDL_EventType type; /**< SDL_EVENT_PEN_BUTTON_DOWN or SDL_EVENT_PEN_BUTTON_UP */
SDL_EventType type; /**< SDL_EVENT_PEN_BUTTON_DOWN or SDL_EVENT_PEN_BUTTON_UP */
Uint32 reserved;
Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
SDL_WindowID windowID; /**< The window with mouse focus, if any */
SDL_PenID which; /**< The pen instance id */
SDL_PenInputFlags pen_state; /**< Complete pen input state at time of event */
float x; /**< X position of pen on tablet */
float y; /**< Y position of pen on tablet */
Uint8 button; /**< The pen button index (first button is 1). */
Uint8 state; /**< SDL_PRESSED or SDL_RELEASED */
} SDL_PenButtonEvent;
/**
* Pressure-sensitive pen pressure / angle event structure (event.paxis.*)
*
* You might get some of these events even if the pen isn't touching the
* tablet.
*
* \since This struct is available since SDL 3.0.0.
*/
typedef struct SDL_PenAxisEvent
{
SDL_EventType type; /**< SDL_EVENT_PEN_AXIS */
Uint32 reserved;
Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
SDL_WindowID windowID; /**< The window with pen focus, if any */
SDL_PenID which; /**< The pen instance id */
Uint8 button; /**< The pen button index (1 represents the pen tip for compatibility with mouse events) */
Uint8 state; /**< SDL_PRESSED or SDL_RELEASED */
Uint16 pen_state; /**< Pen button masks (where SDL_BUTTON(1) is the first button, SDL_BUTTON(2) is the second button etc.), SDL_PEN_DOWN_MASK is set if the pen is touching the surface, and SDL_PEN_ERASER_MASK is set if the pen is (used as) an eraser. */
float x; /**< X coordinate, relative to window */
float y; /**< Y coordinate, relative to window */
float axes[SDL_PEN_NUM_AXES]; /**< Pen axes such as pressure and tilt (ordered as per SDL_PenAxis) */
} SDL_PenButtonEvent;
SDL_PenInputFlags pen_state; /**< Complete pen input state at time of event */
float x; /**< X position of pen on tablet */
float y; /**< Y position of pen on tablet */
SDL_PenAxis axis; /**< Axis that has changed */
float value; /**< New value of axis */
} SDL_PenAxisEvent;
/**
* An event used to drop text or request a file open by the system
@ -894,9 +946,11 @@ typedef union SDL_Event
SDL_QuitEvent quit; /**< Quit request event data */
SDL_UserEvent user; /**< Custom event data */
SDL_TouchFingerEvent tfinger; /**< Touch finger event data */
SDL_PenTipEvent ptip; /**< Pen tip touching or leaving drawing surface */
SDL_PenMotionEvent pmotion; /**< Pen change in position, pressure, or angle */
SDL_PenButtonEvent pbutton; /**< Pen button press */
SDL_PenProximityEvent pproximity; /**< Pen proximity event data */
SDL_PenTouchEvent ptouch; /**< Pen tip touching event data */
SDL_PenMotionEvent pmotion; /**< Pen motion event data */
SDL_PenButtonEvent pbutton; /**< Pen button event data */
SDL_PenAxisEvent paxis; /**< Pen axis event data */
SDL_DropEvent drop; /**< Drag and drop event data */
SDL_ClipboardEvent clipboard; /**< Clipboard event data */
@ -985,8 +1039,8 @@ typedef enum SDL_EventAction
* SDL_EVENT_FIRST is a safe choice.
* \param maxType maximum value of the event type to be considered;
* SDL_EVENT_LAST is a safe choice.
* \returns the number of events actually stored or a negative error code on
* failure; call SDL_GetError() for more information.
* \returns the number of events actually stored or -1 on failure; call
* SDL_GetError() for more information.
*
* \since This function is available since SDL 3.0.0.
*
@ -1200,9 +1254,9 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_WaitEventTimeout(SDL_Event *event, Sint
* its own custom event types.
*
* \param event the SDL_Event to be added to the queue.
* \returns 1 on success, 0 if the event was filtered, or a negative error
* code on failure; call SDL_GetError() for more information. A
* common reason for error is the event queue being full.
* \returns SDL_TRUE on success, SDL_FALSE if the event was filtered or on
* failure; call SDL_GetError() for more information. A common reason
* for error is the event queue being full.
*
* \since This function is available since SDL 3.0.0.
*
@ -1210,7 +1264,7 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_WaitEventTimeout(SDL_Event *event, Sint
* \sa SDL_PollEvent
* \sa SDL_RegisterEvents
*/
extern SDL_DECLSPEC int SDLCALL SDL_PushEvent(SDL_Event *event);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_PushEvent(SDL_Event *event);
/**
* A function pointer used for callbacks that watch the event queue.
@ -1218,8 +1272,9 @@ extern SDL_DECLSPEC int SDLCALL SDL_PushEvent(SDL_Event *event);
* \param userdata what was passed as `userdata` to SDL_SetEventFilter() or
* SDL_AddEventWatch, etc.
* \param event the event that triggered the callback.
* \returns 1 to permit event to be added to the queue, and 0 to disallow it.
* When used with SDL_AddEventWatch, the return value is ignored.
* \returns SDL_TRUE to permit event to be added to the queue, and SDL_FALSE
* to disallow it. When used with SDL_AddEventWatch, the return value
* is ignored.
*
* \threadsafety SDL may call this callback at any time from any thread; the
* application is responsible for locking resources the callback
@ -1230,16 +1285,16 @@ extern SDL_DECLSPEC int SDLCALL SDL_PushEvent(SDL_Event *event);
* \sa SDL_SetEventFilter
* \sa SDL_AddEventWatch
*/
typedef int (SDLCALL *SDL_EventFilter)(void *userdata, SDL_Event *event);
typedef SDL_bool (SDLCALL *SDL_EventFilter)(void *userdata, SDL_Event *event);
/**
* Set up a filter to process all events before they change internal state and
* are posted to the internal event queue.
*
* If the filter function returns 1 when called, then the event will be added
* to the internal queue. If it returns 0, then the event will be dropped from
* the queue, but the internal state will still be updated. This allows
* selective filtering of dynamically arriving events.
* If the filter function returns SDL_TRUE when called, then the event will be
* added to the internal queue. If it returns SDL_FALSE, then the event will
* be dropped from the queue, but the internal state will still be updated.
* This allows selective filtering of dynamically arriving events.
*
* **WARNING**: Be very careful of what you do in the event filter function,
* as it may run in a different thread!
@ -1317,17 +1372,17 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetEventFilter(SDL_EventFilter *filter,
*
* \param filter an SDL_EventFilter function to call when an event happens.
* \param userdata a pointer that is passed to `filter`.
* \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.
*
* \threadsafety It is safe to call this function from any thread.
*
* \since This function is available since SDL 3.0.0.
*
* \sa SDL_DelEventWatch
* \sa SDL_RemoveEventWatch
* \sa SDL_SetEventFilter
*/
extern SDL_DECLSPEC int SDLCALL SDL_AddEventWatch(SDL_EventFilter filter, void *userdata);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_AddEventWatch(SDL_EventFilter filter, void *userdata);
/**
* Remove an event watch callback added with SDL_AddEventWatch().
@ -1342,11 +1397,11 @@ extern SDL_DECLSPEC int SDLCALL SDL_AddEventWatch(SDL_EventFilter filter, void *
*
* \sa SDL_AddEventWatch
*/
extern SDL_DECLSPEC void SDLCALL SDL_DelEventWatch(SDL_EventFilter filter, void *userdata);
extern SDL_DECLSPEC void SDLCALL SDL_RemoveEventWatch(SDL_EventFilter filter, void *userdata);
/**
* Run a specific filter function on the current event queue, removing any
* events for which the filter returns 0.
* events for which the filter returns SDL_FALSE.
*
* See SDL_SetEventFilter() for more information. Unlike SDL_SetEventFilter(),
* this function does not change the filter permanently, it only uses the

View File

@ -266,12 +266,12 @@ typedef Uint32 SDL_GlobFlags;
* Create a directory.
*
* \param path the path of the directory to create.
* \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.
*/
extern SDL_DECLSPEC int SDLCALL SDL_CreateDirectory(const char *path);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_CreateDirectory(const char *path);
/* Callback for directory enumeration. Return 1 to keep enumerating,
0 to stop enumerating (no error), -1 to stop enumerating and
@ -289,47 +289,47 @@ typedef int (SDLCALL *SDL_EnumerateDirectoryCallback)(void *userdata, const char
* \param path the path of the directory to enumerate.
* \param callback a function that is called for each entry in the directory.
* \param userdata a pointer that is passed to `callback`.
* \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.
*/
extern SDL_DECLSPEC int SDLCALL SDL_EnumerateDirectory(const char *path, SDL_EnumerateDirectoryCallback callback, void *userdata);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_EnumerateDirectory(const char *path, SDL_EnumerateDirectoryCallback callback, void *userdata);
/**
* Remove a file or an empty directory.
*
* \param path the path of the directory to enumerate.
* \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.
*/
extern SDL_DECLSPEC int SDLCALL SDL_RemovePath(const char *path);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_RemovePath(const char *path);
/**
* Rename a file or directory.
*
* \param oldpath the old path.
* \param newpath the new path.
* \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.
*/
extern SDL_DECLSPEC int SDLCALL SDL_RenamePath(const char *oldpath, const char *newpath);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_RenamePath(const char *oldpath, const char *newpath);
/**
* Copy a file.
*
* \param oldpath the old path.
* \param newpath the new path.
* \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.
*/
extern SDL_DECLSPEC int SDLCALL SDL_CopyFile(const char *oldpath, const char *newpath);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_CopyFile(const char *oldpath, const char *newpath);
/**
* Get information about a filesystem path.
@ -337,12 +337,12 @@ extern SDL_DECLSPEC int SDLCALL SDL_CopyFile(const char *oldpath, const char *ne
* \param path the path to query.
* \param info a pointer filled in with information about the path, or NULL to
* check for the existence of a file.
* \returns 0 on success or a negative error code if the file doesn't exist,
* or another failure; call SDL_GetError() for more information.
* \returns SDL_TRUE on success or SDL_FALSE if the file doesn't exist, or
* another failure; call SDL_GetError() for more information.
*
* \since This function is available since SDL 3.0.0.
*/
extern SDL_DECLSPEC int SDLCALL SDL_GetPathInfo(const char *path, SDL_PathInfo *info);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetPathInfo(const char *path, SDL_PathInfo *info);
/**
* Enumerate a directory tree, filtered by pattern, and return a list.

View File

@ -379,12 +379,12 @@ extern SDL_DECLSPEC int SDLCALL SDL_AddGamepadMappingsFromFile(const char *file)
*
* This will generate gamepad events as needed if device mappings change.
*
* \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.
*/
extern SDL_DECLSPEC int SDLCALL SDL_ReloadGamepadMappings(void);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_ReloadGamepadMappings(void);
/**
* Get the current gamepad mappings.
@ -442,15 +442,15 @@ extern SDL_DECLSPEC char * SDLCALL SDL_GetGamepadMapping(SDL_Gamepad *gamepad);
* \param instance_id the joystick instance ID.
* \param mapping the mapping to use for this device, or NULL to clear the
* mapping.
* \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_AddGamepadMapping
* \sa SDL_GetGamepadMapping
*/
extern SDL_DECLSPEC int SDLCALL SDL_SetGamepadMapping(SDL_JoystickID instance_id, const char *mapping);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetGamepadMapping(SDL_JoystickID instance_id, const char *mapping);
/**
* Return whether a gamepad is currently connected.
@ -813,14 +813,14 @@ extern SDL_DECLSPEC int SDLCALL SDL_GetGamepadPlayerIndex(SDL_Gamepad *gamepad);
* \param gamepad the gamepad object to adjust.
* \param player_index player index to assign to this gamepad, or -1 to clear
* the player index and turn off player LEDs.
* \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_GetGamepadPlayerIndex
*/
extern SDL_DECLSPEC int SDLCALL SDL_SetGamepadPlayerIndex(SDL_Gamepad *gamepad, int player_index);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetGamepadPlayerIndex(SDL_Gamepad *gamepad, int player_index);
/**
* Get the USB vendor ID of an opened gamepad, if available.
@ -1257,14 +1257,14 @@ extern SDL_DECLSPEC int SDLCALL SDL_GetNumGamepadTouchpadFingers(SDL_Gamepad *ga
* \param y filled with y position, normalized 0 to 1, with the origin in the
* upper left.
* \param pressure filled with pressure value.
* \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_GetNumGamepadTouchpadFingers
*/
extern SDL_DECLSPEC int SDLCALL SDL_GetGamepadTouchpadFinger(SDL_Gamepad *gamepad, int touchpad, int finger, Uint8 *state, float *x, float *y, float *pressure);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetGamepadTouchpadFinger(SDL_Gamepad *gamepad, int touchpad, int finger, Uint8 *state, float *x, float *y, float *pressure);
/**
* Return whether a gamepad has a particular sensor.
@ -1287,15 +1287,15 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GamepadHasSensor(SDL_Gamepad *gamepad,
* \param gamepad the gamepad to update.
* \param type the type of sensor to enable/disable.
* \param enabled whether data reporting should be enabled.
* \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_GamepadHasSensor
* \sa SDL_GamepadSensorEnabled
*/
extern SDL_DECLSPEC int SDLCALL SDL_SetGamepadSensorEnabled(SDL_Gamepad *gamepad, SDL_SensorType type, SDL_bool enabled);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetGamepadSensorEnabled(SDL_Gamepad *gamepad, SDL_SensorType type, SDL_bool enabled);
/**
* Query whether sensor data reporting is enabled for a gamepad.
@ -1331,12 +1331,12 @@ extern SDL_DECLSPEC float SDLCALL SDL_GetGamepadSensorDataRate(SDL_Gamepad *game
* \param type the type of sensor to query.
* \param data a pointer filled with the current sensor state.
* \param num_values the number of values to write to data.
* \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.
*/
extern SDL_DECLSPEC int SDLCALL SDL_GetGamepadSensorData(SDL_Gamepad *gamepad, SDL_SensorType type, float *data, int num_values);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetGamepadSensorData(SDL_Gamepad *gamepad, SDL_SensorType type, float *data, int num_values);
/**
* Start a rumble effect on a gamepad.
@ -1353,11 +1353,12 @@ extern SDL_DECLSPEC int SDLCALL SDL_GetGamepadSensorData(SDL_Gamepad *gamepad, S
* \param high_frequency_rumble the intensity of the high frequency (right)
* rumble motor, from 0 to 0xFFFF.
* \param duration_ms the duration of the rumble effect, in milliseconds.
* \returns 0, or -1 if rumble isn't supported on this gamepad.
* \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.
*/
extern SDL_DECLSPEC int SDLCALL SDL_RumbleGamepad(SDL_Gamepad *gamepad, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble, Uint32 duration_ms);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_RumbleGamepad(SDL_Gamepad *gamepad, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble, Uint32 duration_ms);
/**
* Start a rumble effect in the gamepad's triggers.
@ -1378,14 +1379,14 @@ extern SDL_DECLSPEC int SDLCALL SDL_RumbleGamepad(SDL_Gamepad *gamepad, Uint16 l
* \param right_rumble the intensity of the right trigger rumble motor, from 0
* to 0xFFFF.
* \param duration_ms the duration of the rumble effect, 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_RumbleGamepad
*/
extern SDL_DECLSPEC int SDLCALL SDL_RumbleGamepadTriggers(SDL_Gamepad *gamepad, Uint16 left_rumble, Uint16 right_rumble, Uint32 duration_ms);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_RumbleGamepadTriggers(SDL_Gamepad *gamepad, Uint16 left_rumble, Uint16 right_rumble, Uint32 duration_ms);
/**
* Update a gamepad's LED color.
@ -1400,12 +1401,12 @@ extern SDL_DECLSPEC int SDLCALL SDL_RumbleGamepadTriggers(SDL_Gamepad *gamepad,
* \param red the intensity of the red LED.
* \param green the intensity of the green LED.
* \param blue the intensity of the blue LED.
* \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.
*/
extern SDL_DECLSPEC int SDLCALL SDL_SetGamepadLED(SDL_Gamepad *gamepad, Uint8 red, Uint8 green, Uint8 blue);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetGamepadLED(SDL_Gamepad *gamepad, Uint8 red, Uint8 green, Uint8 blue);
/**
* Send a gamepad specific effect packet.
@ -1413,12 +1414,12 @@ extern SDL_DECLSPEC int SDLCALL SDL_SetGamepadLED(SDL_Gamepad *gamepad, Uint8 re
* \param gamepad the gamepad to affect.
* \param data the data to send to the gamepad.
* \param size the size of the data to send to the gamepad.
* \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.
*/
extern SDL_DECLSPEC int SDLCALL SDL_SendGamepadEffect(SDL_Gamepad *gamepad, const void *data, int size);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SendGamepadEffect(SDL_Gamepad *gamepad, const void *data, int size);
/**
* Close a gamepad previously opened with SDL_OpenGamepad().

File diff suppressed because it is too large Load Diff

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

View File

@ -31,6 +31,7 @@
#include <SDL3/SDL_stdinc.h>
#include <SDL3/SDL_error.h>
#include <SDL3/SDL_events.h>
#include <SDL3/SDL_begin_code.h>
/* Set up for C function definitions, even when using C++ */
@ -66,6 +67,38 @@ typedef Uint32 SDL_InitFlags;
#define SDL_INIT_SENSOR 0x00008000u /**< `SDL_INIT_SENSOR` implies `SDL_INIT_EVENTS` */
#define SDL_INIT_CAMERA 0x00010000u /**< `SDL_INIT_CAMERA` implies `SDL_INIT_EVENTS` */
/**
* Return values for optional main callbacks.
*
* Returning SDL_APP_SUCCESS or SDL_APP_FAILURE from SDL_AppInit,
* SDL_AppEvent, or SDL_AppIterate will terminate the program and report
* success/failure to the operating system. What that means is
* platform-dependent. On Unix, for example, on success, the process error
* code will be zero, and on failure it will be 1. This interface doesn't
* allow you to return specific exit codes, just whether there was an error
* generally or not.
*
* Returning SDL_APP_CONTINUE from these functions will let the app continue
* to run.
*
* See
* [Main callbacks in SDL3](https://wiki.libsdl.org/SDL3/README/main-functions#main-callbacks-in-sdl3)
* for complete details.
*
* \since This enum is available since SDL 3.0.0.
*/
typedef enum SDL_AppResult
{
SDL_APP_CONTINUE, /**< Value that requests that the app continue from the main callbacks. */
SDL_APP_SUCCESS, /**< Value that requests termination with success from the main callbacks. */
SDL_APP_FAILURE /**< Value that requests termination with error from the main callbacks. */
} SDL_AppResult;
typedef SDL_AppResult (SDLCALL *SDL_AppInit_func)(void **appstate, int argc, char *argv[]);
typedef SDL_AppResult (SDLCALL *SDL_AppIterate_func)(void *appstate);
typedef SDL_AppResult (SDLCALL *SDL_AppEvent_func)(void *appstate, const SDL_Event *event);
typedef void (SDLCALL *SDL_AppQuit_func)(void *appstate);
/**
* Initialize the SDL library.
*
@ -110,8 +143,8 @@ typedef Uint32 SDL_InitFlags;
* SDL_SetAppMetadataProperty().
*
* \param flags subsystem initialization flags.
* \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.
*
@ -122,7 +155,7 @@ typedef Uint32 SDL_InitFlags;
* \sa SDL_SetMainReady
* \sa SDL_WasInit
*/
extern SDL_DECLSPEC int SDLCALL SDL_Init(SDL_InitFlags flags);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_Init(SDL_InitFlags flags);
/**
* Compatibility function to initialize the SDL library.
@ -130,8 +163,8 @@ extern SDL_DECLSPEC int SDLCALL SDL_Init(SDL_InitFlags flags);
* This function and SDL_Init() are interchangeable.
*
* \param flags any of the flags used by SDL_Init(); see SDL_Init for details.
* \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.
*
@ -139,7 +172,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_Init(SDL_InitFlags flags);
* \sa SDL_Quit
* \sa SDL_QuitSubSystem
*/
extern SDL_DECLSPEC int SDLCALL SDL_InitSubSystem(SDL_InitFlags flags);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_InitSubSystem(SDL_InitFlags flags);
/**
* Shut down specific SDL subsystems.
@ -215,8 +248,8 @@ extern SDL_DECLSPEC void SDLCALL SDL_Quit(void);
* hash, or whatever makes sense).
* \param appidentifier A unique string in reverse-domain format that
* identifies this app ("com.example.mygame2").
* \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.
*
* \threadsafety It is safe to call this function from any thread.
*
@ -224,7 +257,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_Quit(void);
*
* \sa SDL_SetAppMetadataProperty
*/
extern SDL_DECLSPEC int SDLCALL SDL_SetAppMetadata(const char *appname, const char *appversion, const char *appidentifier);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetAppMetadata(const char *appname, const char *appversion, const char *appidentifier);
/**
* Specify metadata about your app through a set of properties.
@ -250,7 +283,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_SetAppMetadata(const char *appname, const ch
* anywhere the OS shows the name of the application separately from window
* titles, such as volume control applets, etc. This defaults to "SDL
* Application".
* - SDL_PROP_APP_METADATA_VERSION_STRING`: The version of the app that is
* - `SDL_PROP_APP_METADATA_VERSION_STRING`: The version of the app that is
* running; there are no rules on format, so "1.0.3beta2" and "April 22nd,
* 2024" and a git hash are all valid options. This has no default.
* - `SDL_PROP_APP_METADATA_IDENTIFIER_STRING`: A unique string that
@ -260,16 +293,16 @@ extern SDL_DECLSPEC int SDLCALL SDL_SetAppMetadata(const char *appname, const ch
* associated desktop settings and icons. If you plan to package your
* application in a container such as Flatpak, the app ID should match the
* name of your Flatpak container as well. This has no default.
* - SDL_PROP_APP_METADATA_CREATOR_STRING`: The human-readable name of the
* - `SDL_PROP_APP_METADATA_CREATOR_STRING`: The human-readable name of the
* creator/developer/maker of this app, like "MojoWorkshop, LLC"
* - SDL_PROP_APP_METADATA_COPYRIGHT_STRING`: The human-readable copyright
* - `SDL_PROP_APP_METADATA_COPYRIGHT_STRING`: The human-readable copyright
* notice, like "Copyright (c) 2024 MojoWorkshop, LLC" or whatnot. Keep this
* to one line, don't paste a copy of a whole software license in here. This
* has no default.
* - SDL_PROP_APP_METADATA_URL_STRING`: A URL to the app on the web. Maybe a
* - `SDL_PROP_APP_METADATA_URL_STRING`: A URL to the app on the web. Maybe a
* product page, or a storefront, or even a GitHub repository, for user's
* further information This has no default.
* - SDL_PROP_APP_METADATA_TYPE_STRING`: The type of application this is.
* - `SDL_PROP_APP_METADATA_TYPE_STRING`: The type of application this is.
* Currently this string can be "game" for a video game, "mediaplayer" for a
* media player, or generically "application" if nothing else applies.
* Future versions of SDL might add new types. This defaults to
@ -277,8 +310,8 @@ extern SDL_DECLSPEC int SDLCALL SDL_SetAppMetadata(const char *appname, const ch
*
* \param name the name of the metadata property to set.
* \param value the value of the property, or NULL to remove that property.
* \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.
*
* \threadsafety It is safe to call this function from any thread.
*
@ -287,7 +320,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_SetAppMetadata(const char *appname, const ch
* \sa SDL_GetAppMetadataProperty
* \sa SDL_SetAppMetadata
*/
extern SDL_DECLSPEC int SDLCALL SDL_SetAppMetadataProperty(const char *name, const char *value);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetAppMetadataProperty(const char *name, const char *value);
#define SDL_PROP_APP_METADATA_NAME_STRING "SDL.app.metadata.name"
#define SDL_PROP_APP_METADATA_VERSION_STRING "SDL.app.metadata.version"

View File

@ -132,9 +132,10 @@ typedef struct SDL_IOStreamInterface
* The SDL_IOStream is still destroyed even if this fails, so clean up anything
* even if flushing to disk returns an error.
*
* \return 0 if successful or -1 on write error when flushing data.
* \return SDL_TRUE if successful or SDL_FALSE on write error when flushing data.
*/
int (SDLCALL *close)(void *userdata);
SDL_bool (SDLCALL *close)(void *userdata);
} SDL_IOStreamInterface;
@ -371,21 +372,21 @@ extern SDL_DECLSPEC SDL_IOStream * SDLCALL SDL_OpenIO(const SDL_IOStreamInterfac
*
* SDL_CloseIO() closes and cleans up the SDL_IOStream stream. It releases any
* resources used by the stream and frees the SDL_IOStream itself. This
* returns 0 on success, or -1 if the stream failed to flush to its output
* (e.g. to disk).
* returns SDL_TRUE on success, or SDL_FALSE if the stream failed to flush to
* its output (e.g. to disk).
*
* Note that if this fails to flush the stream to disk, this function reports
* an error, but the SDL_IOStream is still invalid once this function returns.
*
* \param context SDL_IOStream structure to close.
* \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_OpenIO
*/
extern SDL_DECLSPEC int SDLCALL SDL_CloseIO(SDL_IOStream *context);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_CloseIO(SDL_IOStream *context);
/**
* Get the properties associated with an SDL_IOStream.
@ -481,9 +482,9 @@ extern SDL_DECLSPEC Sint64 SDLCALL SDL_TellIO(SDL_IOStream *context);
*
* This function reads up `size` bytes from the data source to the area
* pointed at by `ptr`. This function may read less bytes than requested. It
* will return zero when the data stream is completely read, or on error. To
* determine if there was an error or all data was read, call
* SDL_GetIOStatus().
* will return zero when the data stream is completely read, and
* SDL_GetIOStatus() will return SDL_IO_STATUS_EOF, or on error, and
* SDL_GetIOStatus() will return SDL_IO_STATUS_ERROR.
*
* \param context a pointer to an SDL_IOStream structure.
* \param ptr a pointer to a buffer to read data into.

View File

@ -91,8 +91,7 @@ typedef struct SDL_Joystick SDL_Joystick;
*
* If the joystick 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.
*/
@ -447,11 +446,12 @@ typedef struct SDL_VirtualJoystickDesc
void *userdata; /**< User data pointer passed to callbacks */
void (SDLCALL *Update)(void *userdata); /**< Called when the joystick state should be updated */
void (SDLCALL *SetPlayerIndex)(void *userdata, int player_index); /**< Called when the player index is set */
int (SDLCALL *Rumble)(void *userdata, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble); /**< Implements SDL_RumbleJoystick() */
int (SDLCALL *RumbleTriggers)(void *userdata, Uint16 left_rumble, Uint16 right_rumble); /**< Implements SDL_RumbleJoystickTriggers() */
int (SDLCALL *SetLED)(void *userdata, Uint8 red, Uint8 green, Uint8 blue); /**< Implements SDL_SetJoystickLED() */
int (SDLCALL *SendEffect)(void *userdata, const void *data, int size); /**< Implements SDL_SendJoystickEffect() */
int (SDLCALL *SetSensorsEnabled)(void *userdata, SDL_bool enabled); /**< Implements SDL_SetGamepadSensorEnabled() */
SDL_bool (SDLCALL *Rumble)(void *userdata, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble); /**< Implements SDL_RumbleJoystick() */
SDL_bool (SDLCALL *RumbleTriggers)(void *userdata, Uint16 left_rumble, Uint16 right_rumble); /**< Implements SDL_RumbleJoystickTriggers() */
SDL_bool (SDLCALL *SetLED)(void *userdata, Uint8 red, Uint8 green, Uint8 blue); /**< Implements SDL_SetJoystickLED() */
SDL_bool (SDLCALL *SendEffect)(void *userdata, const void *data, int size); /**< Implements SDL_SendJoystickEffect() */
SDL_bool (SDLCALL *SetSensorsEnabled)(void *userdata, SDL_bool enabled); /**< Implements SDL_SetGamepadSensorEnabled() */
void (SDLCALL *Cleanup)(void *userdata); /**< Cleans up the userdata when the joystick is detached */
} SDL_VirtualJoystickDesc;
/**
@ -472,14 +472,14 @@ extern SDL_DECLSPEC SDL_JoystickID SDLCALL SDL_AttachVirtualJoystick(const SDL_V
*
* \param instance_id the joystick instance ID, previously returned from
* SDL_AttachVirtualJoystick().
* \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_AttachVirtualJoystick
*/
extern SDL_DECLSPEC int SDLCALL SDL_DetachVirtualJoystick(SDL_JoystickID instance_id);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_DetachVirtualJoystick(SDL_JoystickID instance_id);
/**
* Query whether or not a joystick is virtual.
@ -507,12 +507,12 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_IsJoystickVirtual(SDL_JoystickID instan
* \param joystick the virtual joystick on which to set state.
* \param axis the index of the axis on the virtual joystick to update.
* \param value the new value for the specified axis.
* \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.
*/
extern SDL_DECLSPEC int SDLCALL SDL_SetJoystickVirtualAxis(SDL_Joystick *joystick, int axis, Sint16 value);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetJoystickVirtualAxis(SDL_Joystick *joystick, int axis, Sint16 value);
/**
* Generate ball motion on an opened virtual joystick.
@ -527,12 +527,12 @@ extern SDL_DECLSPEC int SDLCALL SDL_SetJoystickVirtualAxis(SDL_Joystick *joystic
* \param ball the index of the ball on the virtual joystick to update.
* \param xrel the relative motion on the X axis.
* \param yrel the relative motion on the Y axis.
* \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.
*/
extern SDL_DECLSPEC int SDLCALL SDL_SetJoystickVirtualBall(SDL_Joystick *joystick, int ball, Sint16 xrel, Sint16 yrel);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetJoystickVirtualBall(SDL_Joystick *joystick, int ball, Sint16 xrel, Sint16 yrel);
/**
* Set the state of a button on an opened virtual joystick.
@ -546,12 +546,12 @@ extern SDL_DECLSPEC int SDLCALL SDL_SetJoystickVirtualBall(SDL_Joystick *joystic
* \param joystick the virtual joystick on which to set state.
* \param button the index of the button on the virtual joystick to update.
* \param value the new value for the specified button.
* \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.
*/
extern SDL_DECLSPEC int SDLCALL SDL_SetJoystickVirtualButton(SDL_Joystick *joystick, int button, Uint8 value);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetJoystickVirtualButton(SDL_Joystick *joystick, int button, Uint8 value);
/**
* Set the state of a hat on an opened virtual joystick.
@ -565,12 +565,12 @@ extern SDL_DECLSPEC int SDLCALL SDL_SetJoystickVirtualButton(SDL_Joystick *joyst
* \param joystick the virtual joystick on which to set state.
* \param hat the index of the hat on the virtual joystick to update.
* \param value the new value for the specified hat.
* \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.
*/
extern SDL_DECLSPEC int SDLCALL SDL_SetJoystickVirtualHat(SDL_Joystick *joystick, int hat, Uint8 value);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetJoystickVirtualHat(SDL_Joystick *joystick, int hat, Uint8 value);
/**
* Set touchpad finger state on an opened virtual joystick.
@ -592,12 +592,12 @@ extern SDL_DECLSPEC int SDLCALL SDL_SetJoystickVirtualHat(SDL_Joystick *joystick
* \param y the y coordinate of the finger on the touchpad, normalized 0 to 1,
* with the origin in the upper left.
* \param pressure the pressure of the finger.
* \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.
*/
extern SDL_DECLSPEC int SDLCALL SDL_SetJoystickVirtualTouchpad(SDL_Joystick *joystick, int touchpad, int finger, Uint8 state, float x, float y, float pressure);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetJoystickVirtualTouchpad(SDL_Joystick *joystick, int touchpad, int finger, Uint8 state, float x, float y, float pressure);
/**
* Send a sensor update for an opened virtual joystick.
@ -614,12 +614,12 @@ extern SDL_DECLSPEC int SDLCALL SDL_SetJoystickVirtualTouchpad(SDL_Joystick *joy
* the sensor reading.
* \param data the data associated with the sensor reading.
* \param num_values the number of values pointed to by `data`.
* \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.
*/
extern SDL_DECLSPEC int SDLCALL SDL_SendJoystickVirtualSensorData(SDL_Joystick *joystick, SDL_SensorType type, Uint64 sensor_timestamp, const float *data, int num_values);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SendJoystickVirtualSensorData(SDL_Joystick *joystick, SDL_SensorType type, Uint64 sensor_timestamp, const float *data, int num_values);
/**
* Get the properties associated with a joystick.
@ -698,14 +698,14 @@ extern SDL_DECLSPEC int SDLCALL SDL_GetJoystickPlayerIndex(SDL_Joystick *joystic
* \param joystick the SDL_Joystick obtained from SDL_OpenJoystick().
* \param player_index player index to assign to this joystick, or -1 to clear
* the player index and turn off player LEDs.
* \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_GetJoystickPlayerIndex
*/
extern SDL_DECLSPEC int SDLCALL SDL_SetJoystickPlayerIndex(SDL_Joystick *joystick, int player_index);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetJoystickPlayerIndex(SDL_Joystick *joystick, int player_index);
/**
* Get the implementation-dependent GUID for the joystick.
@ -853,9 +853,8 @@ extern SDL_DECLSPEC SDL_JoystickID SDLCALL SDL_GetJoystickID(SDL_Joystick *joyst
* device and platform.
*
* \param joystick an SDL_Joystick structure containing joystick information.
* \returns the number of axis controls/number of axes on success or a
* negative error code on failure; call SDL_GetError() for more
* information.
* \returns the number of axis controls/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.
*
@ -875,8 +874,8 @@ extern SDL_DECLSPEC int SDLCALL SDL_GetNumJoystickAxes(SDL_Joystick *joystick);
* Most joysticks do not have trackballs.
*
* \param joystick an SDL_Joystick structure containing joystick information.
* \returns the number of trackballs on success or a negative error code on
* failure; call SDL_GetError() for more information.
* \returns the number of trackballs on success or -1 on failure; call
* SDL_GetError() for more information.
*
* \since This function is available since SDL 3.0.0.
*
@ -891,8 +890,8 @@ extern SDL_DECLSPEC int SDLCALL SDL_GetNumJoystickBalls(SDL_Joystick *joystick);
* Get the number of POV hats on a joystick.
*
* \param joystick an SDL_Joystick structure containing joystick information.
* \returns the number of POV hats on success or a negative error code on
* failure; call SDL_GetError() for more information.
* \returns the number of POV hats on success or -1 on failure; call
* SDL_GetError() for more information.
*
* \since This function is available since SDL 3.0.0.
*
@ -907,8 +906,8 @@ extern SDL_DECLSPEC int SDLCALL SDL_GetNumJoystickHats(SDL_Joystick *joystick);
* Get the number of buttons on a joystick.
*
* \param joystick an SDL_Joystick structure containing joystick information.
* \returns the number of buttons on success or a negative error code on
* failure; call SDL_GetError() for more information.
* \returns the number of buttons on success or -1 on failure; call
* SDL_GetError() for more information.
*
* \since This function is available since SDL 3.0.0.
*
@ -1013,14 +1012,14 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetJoystickAxisInitialState(SDL_Joystic
* \param ball the ball index to query; ball indices start at index 0.
* \param dx stores the difference in the x axis position since the last poll.
* \param dy stores the difference in the y axis position since the last poll.
* \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_GetNumJoystickBalls
*/
extern SDL_DECLSPEC int SDLCALL SDL_GetJoystickBall(SDL_Joystick *joystick, int ball, int *dx, int *dy);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetJoystickBall(SDL_Joystick *joystick, int ball, int *dx, int *dy);
/**
* Get the current state of a POV hat on a joystick.
@ -1076,11 +1075,11 @@ extern SDL_DECLSPEC Uint8 SDLCALL SDL_GetJoystickButton(SDL_Joystick *joystick,
* \param high_frequency_rumble the intensity of the high frequency (right)
* rumble motor, from 0 to 0xFFFF.
* \param duration_ms the duration of the rumble effect, in milliseconds.
* \returns 0, or -1 if rumble isn't supported on this joystick.
* \returns SDL_TRUE, or SDL_FALSE if rumble isn't supported on this joystick.
*
* \since This function is available since SDL 3.0.0.
*/
extern SDL_DECLSPEC int SDLCALL SDL_RumbleJoystick(SDL_Joystick *joystick, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble, Uint32 duration_ms);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_RumbleJoystick(SDL_Joystick *joystick, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble, Uint32 duration_ms);
/**
* Start a rumble effect in the joystick's triggers.
@ -1102,14 +1101,14 @@ extern SDL_DECLSPEC int SDLCALL SDL_RumbleJoystick(SDL_Joystick *joystick, Uint1
* \param right_rumble the intensity of the right trigger rumble motor, from 0
* to 0xFFFF.
* \param duration_ms the duration of the rumble effect, 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_RumbleJoystick
*/
extern SDL_DECLSPEC int SDLCALL SDL_RumbleJoystickTriggers(SDL_Joystick *joystick, Uint16 left_rumble, Uint16 right_rumble, Uint32 duration_ms);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_RumbleJoystickTriggers(SDL_Joystick *joystick, Uint16 left_rumble, Uint16 right_rumble, Uint32 duration_ms);
/**
* Update a joystick's LED color.
@ -1124,12 +1123,12 @@ extern SDL_DECLSPEC int SDLCALL SDL_RumbleJoystickTriggers(SDL_Joystick *joystic
* \param red the intensity of the red LED.
* \param green the intensity of the green LED.
* \param blue the intensity of the blue LED.
* \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.
*/
extern SDL_DECLSPEC int SDLCALL SDL_SetJoystickLED(SDL_Joystick *joystick, Uint8 red, Uint8 green, Uint8 blue);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetJoystickLED(SDL_Joystick *joystick, Uint8 red, Uint8 green, Uint8 blue);
/**
* Send a joystick specific effect packet.
@ -1137,12 +1136,12 @@ extern SDL_DECLSPEC int SDLCALL SDL_SetJoystickLED(SDL_Joystick *joystick, Uint8
* \param joystick the joystick to affect.
* \param data the data to send to the joystick.
* \param size the size of the data to send to the joystick.
* \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.
*/
extern SDL_DECLSPEC int SDLCALL SDL_SendJoystickEffect(SDL_Joystick *joystick, const void *data, int size);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SendJoystickEffect(SDL_Joystick *joystick, const void *data, int size);
/**
* Close a joystick previously opened with SDL_OpenJoystick().

View File

@ -45,8 +45,7 @@ extern "C" {
*
* If the keyboard 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.
*/
@ -184,61 +183,27 @@ extern SDL_DECLSPEC SDL_Keymod SDLCALL SDL_GetModState(void);
*/
extern SDL_DECLSPEC void SDLCALL SDL_SetModState(SDL_Keymod modstate);
/**
* Get the key code corresponding to the given scancode according to a default
* en_US keyboard layout.
*
* See SDL_Keycode for details.
*
* \param scancode the desired SDL_Scancode to query.
* \param modstate the modifier state to use when translating the scancode to
* a keycode.
* \returns the SDL_Keycode that corresponds to the given SDL_Scancode.
*
* \since This function is available since SDL 3.0.0.
*
* \sa SDL_GetKeyName
* \sa SDL_GetScancodeFromKey
*/
extern SDL_DECLSPEC SDL_Keycode SDLCALL SDL_GetDefaultKeyFromScancode(SDL_Scancode scancode, SDL_Keymod modstate);
/**
* Get the key code corresponding to the given scancode according to the
* current keyboard layout.
*
* See SDL_Keycode for details.
* If you want to get the keycode as it would be delivered in key events,
* including options specified in SDL_HINT_KEYCODE_OPTIONS, then you should
* pass `key_event` as SDL_TRUE. Otherwise this function simply translates the
* scancode based on the given modifier state.
*
* \param scancode the desired SDL_Scancode to query.
* \param modstate the modifier state to use when translating the scancode to
* a keycode.
* \param key_event SDL_TRUE if the keycode will be used in key events.
* \returns the SDL_Keycode that corresponds to the given SDL_Scancode.
*
* \since This function is available since SDL 3.0.0.
*
* \sa SDL_GetDefaultKeyFromScancode
* \sa SDL_GetKeyName
* \sa SDL_GetScancodeFromKey
*/
extern SDL_DECLSPEC SDL_Keycode SDLCALL SDL_GetKeyFromScancode(SDL_Scancode scancode, SDL_Keymod modstate);
/**
* Get the scancode corresponding to the given key code according to a default
* en_US keyboard layout.
*
* Note that there may be multiple scancode+modifier states that can generate
* this keycode, this will just return the first one found.
*
* \param key the desired SDL_Keycode to query.
* \param modstate a pointer to the modifier state that would be used when the
* scancode generates this key, may be NULL.
* \returns the SDL_Scancode that corresponds to the given SDL_Keycode.
*
* \since This function is available since SDL 3.0.0.
*
* \sa SDL_GetScancodeFromKey
* \sa SDL_GetScancodeName
*/
extern SDL_DECLSPEC SDL_Scancode SDLCALL SDL_GetDefaultScancodeFromKey(SDL_Keycode key, SDL_Keymod *modstate);
extern SDL_DECLSPEC SDL_Keycode SDLCALL SDL_GetKeyFromScancode(SDL_Scancode scancode, SDL_Keymod modstate, SDL_bool key_event);
/**
* Get the scancode corresponding to the given key code according to the
@ -254,7 +219,6 @@ extern SDL_DECLSPEC SDL_Scancode SDLCALL SDL_GetDefaultScancodeFromKey(SDL_Keyco
*
* \since This function is available since SDL 3.0.0.
*
* \sa SDL_GetDefaultScancodeFromKey
* \sa SDL_GetKeyFromScancode
* \sa SDL_GetScancodeName
*/
@ -267,14 +231,14 @@ extern SDL_DECLSPEC SDL_Scancode SDLCALL SDL_GetScancodeFromKey(SDL_Keycode key,
* \param name the name to use for the scancode, encoded as UTF-8. The string
* is not copied, so the pointer given to this function must stay
* valid while SDL is being used.
* \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_GetScancodeName
*/
extern SDL_DECLSPEC int SDLCALL SDL_SetScancodeName(SDL_Scancode scancode, const char *name);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetScancodeName(SDL_Scancode scancode, const char *name);
/**
* Get a human-readable name for a scancode.
@ -318,9 +282,6 @@ extern SDL_DECLSPEC SDL_Scancode SDLCALL SDL_GetScancodeFromName(const char *nam
/**
* Get a human-readable name for a key.
*
* Both lowercase and uppercase alphabetic keycodes have uppercase names, e.g.
* SDL_Keycode 'a' and 'A' both have the name "A".
*
* If the key doesn't have a name, this function returns an empty string ("").
*
* \param key the desired SDL_Keycode to query.
@ -361,8 +322,8 @@ extern SDL_DECLSPEC SDL_Keycode SDLCALL SDL_GetKeyFromName(const char *name);
* On some platforms using this function shows the screen keyboard.
*
* \param window the window to enable text input.
* \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.
*
@ -371,7 +332,7 @@ extern SDL_DECLSPEC SDL_Keycode SDLCALL SDL_GetKeyFromName(const char *name);
* \sa SDL_StopTextInput
* \sa SDL_TextInputActive
*/
extern SDL_DECLSPEC int SDLCALL SDL_StartTextInput(SDL_Window *window);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_StartTextInput(SDL_Window *window);
/**
* Text input type.
@ -453,8 +414,8 @@ typedef enum SDL_Capitalization
*
* \param window the window to enable text input.
* \param props the 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.
*
@ -463,7 +424,7 @@ typedef enum SDL_Capitalization
* \sa SDL_StopTextInput
* \sa SDL_TextInputActive
*/
extern SDL_DECLSPEC int SDLCALL SDL_StartTextInputWithProperties(SDL_Window *window, SDL_PropertiesID props);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_StartTextInputWithProperties(SDL_Window *window, SDL_PropertiesID props);
#define SDL_PROP_TEXTINPUT_TYPE_NUMBER "SDL.textinput.type"
#define SDL_PROP_TEXTINPUT_CAPITALIZATION_NUMBER "SDL.textinput.capitalization"
@ -490,28 +451,28 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_TextInputActive(SDL_Window *window);
* it.
*
* \param window the window to disable text input.
* \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_StartTextInput
*/
extern SDL_DECLSPEC int SDLCALL SDL_StopTextInput(SDL_Window *window);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_StopTextInput(SDL_Window *window);
/**
* Dismiss the composition window/IME without disabling the subsystem.
*
* \param window the window to affect.
* \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_StartTextInput
* \sa SDL_StopTextInput
*/
extern SDL_DECLSPEC int SDLCALL SDL_ClearComposition(SDL_Window *window);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_ClearComposition(SDL_Window *window);
/**
* Set the area used to type Unicode text input.
@ -524,15 +485,15 @@ extern SDL_DECLSPEC int SDLCALL SDL_ClearComposition(SDL_Window *window);
* coordinates, or NULL to clear it.
* \param cursor the offset of the current cursor location relative to
* `rect->x`, in window coordinates.
* \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_GetTextInputArea
* \sa SDL_StartTextInput
*/
extern SDL_DECLSPEC int SDLCALL SDL_SetTextInputArea(SDL_Window *window, const SDL_Rect *rect, int cursor);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetTextInputArea(SDL_Window *window, const SDL_Rect *rect, int cursor);
/**
* Get the area used to type Unicode text input.
@ -544,14 +505,14 @@ extern SDL_DECLSPEC int SDLCALL SDL_SetTextInputArea(SDL_Window *window, const S
* may be NULL.
* \param cursor a pointer to the offset of the current cursor location
* relative to `rect->x`, may be NULL.
* \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_SetTextInputArea
*/
extern SDL_DECLSPEC int SDLCALL SDL_GetTextInputArea(SDL_Window *window, SDL_Rect *rect, int *cursor);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetTextInputArea(SDL_Window *window, SDL_Rect *rect, int *cursor);
/**
* Check whether the platform has screen keyboard support.

View File

@ -29,9 +29,27 @@
* it will only be sent out if it has that minimum priority or higher.
*
* SDL's own logs are sent below the default priority threshold, so they are
* quiet by default. If you're debugging SDL you might want:
* quiet by default.
*
* SDL_SetLogPriorities(SDL_LOG_PRIORITY_WARN);
* You can change the log verbosity programmatically using
* SDL_SetLogPriority() or with SDL_SetHint(SDL_HINT_LOGGING, ...), or with
* the "SDL_LOGGING" environment variable. This variable is a comma separated
* set of category=level tokens that define the default logging levels for SDL
* applications.
*
* The category can be a numeric category, one of "app", "error", "assert",
* "system", "audio", "video", "render", "input", "test", or `*` for any
* unspecified category.
*
* The level can be a numeric level, one of "verbose", "debug", "info",
* "warn", "error", "critical", or "quiet" to disable that category.
*
* You can omit the category if you want to set the logging level for all
* categories.
*
* If this hint isn't set, the default log levels are equivalent to:
*
* `app=info,assert=warn,test=verbose,*=error`
*
* Here's where the messages go on different platforms:
*
@ -54,9 +72,9 @@ extern "C" {
/**
* The predefined log categories
*
* By default the application category is enabled at the INFO level, the
* assert category is enabled at the WARN level, test is enabled at the
* VERBOSE level and all other categories are enabled at the ERROR level.
* By default the application and gpu categories are enabled at the INFO
* level, the assert category is enabled at the WARN level, test is enabled at
* the VERBOSE level and all other categories are enabled at the ERROR level.
*
* \since This enum is available since SDL 3.0.0.
*/
@ -69,6 +87,7 @@ typedef enum SDL_LogCategory
SDL_LOG_CATEGORY_AUDIO,
SDL_LOG_CATEGORY_VIDEO,
SDL_LOG_CATEGORY_RENDER,
SDL_LOG_CATEGORY_GPU,
SDL_LOG_CATEGORY_INPUT,
SDL_LOG_CATEGORY_TEST,
@ -163,6 +182,26 @@ extern SDL_DECLSPEC SDL_LogPriority SDLCALL SDL_GetLogPriority(int category);
*/
extern SDL_DECLSPEC void SDLCALL SDL_ResetLogPriorities(void);
/**
* Set the text prepended to log messages of a given priority.
*
* By default SDL_LOG_PRIORITY_INFO and below have no prefix, and
* SDL_LOG_PRIORITY_WARN and higher have a prefix showing their priority, e.g.
* "WARNING: ".
*
* \param priority the SDL_LogPriority to modify.
* \param prefix the prefix to use for that log priority, or NULL to use no
* prefix.
* \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_SetLogPriorities
* \sa SDL_SetLogPriority
*/
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetLogPriorityPrefix(SDL_LogPriority priority, const char *prefix);
/**
* Log a message with SDL_LOG_CATEGORY_APPLICATION and SDL_LOG_PRIORITY_INFO.
*

View File

@ -188,16 +188,12 @@
#define main SDL_main
#endif
#include <SDL3/SDL_init.h>
#include <SDL3/SDL_begin_code.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef int (SDLCALL *SDL_AppInit_func)(void **appstate, int argc, char *argv[]);
typedef int (SDLCALL *SDL_AppIterate_func)(void *appstate);
typedef int (SDLCALL *SDL_AppEvent_func)(void *appstate, const SDL_Event *event);
typedef void (SDLCALL *SDL_AppQuit_func)(void *appstate);
/*
* You can (optionally!) define SDL_MAIN_USE_CALLBACKS before including
* SDL_main.h, and then your application will _not_ have a standard
@ -224,49 +220,6 @@ typedef void (SDLCALL *SDL_AppQuit_func)(void *appstate);
*/
#ifdef SDL_MAIN_USE_CALLBACKS
/**
* Value that requests that the app continue from the main callbacks.
*
* If SDL_AppInit, SDL_AppEvent, or SDL_AppIterate returns this value, the
* program will continue to run. This is the normal return value case.
*
* This is always 0; using this macro may be clearer, but is not required.
*
* \since This macro is available since SDL 3.0.0.
*/
#define SDL_APP_CONTINUE 0
/**
* Value that requests termination with error from the main callbacks.
*
* If SDL_AppInit, SDL_AppEvent, or SDL_AppIterate returns this value, the
* program will terminate and report failure to the operating system.
*
* What that failure looks like is platform-dependent. On Unix, for example,
* the process error code will be non-zero.
*
* This is always -1; using this macro may be clearer, but is not required.
*
* \since This macro is available since SDL 3.0.0.
*/
#define SDL_APP_FAILURE -1
/**
* Value that requests termination with success from the main callbacks.
*
* If SDL_AppInit, SDL_AppEvent, or SDL_AppIterate returns this value, the
* program will terminate and report success to the operating system.
*
* What that success looks like is platform-dependent. On Unix, for example,
* the process error code will be zero.
*
* This is always 1; using this macro may be clearer, but is not required.
*
* \since This macro is available since SDL 3.0.0.
*/
#define SDL_APP_SUCCESS 1
/**
* App-implemented initial entry point for SDL_MAIN_USE_CALLBACKS apps.
*
@ -311,7 +264,7 @@ typedef void (SDLCALL *SDL_AppQuit_func)(void *appstate);
* \sa SDL_AppEvent
* \sa SDL_AppQuit
*/
extern SDLMAIN_DECLSPEC int SDLCALL SDL_AppInit(void **appstate, int argc, char *argv[]);
extern SDLMAIN_DECLSPEC SDL_AppResult SDLCALL SDL_AppInit(void **appstate, int argc, char *argv[]);
/**
* App-implemented iteration entry point for SDL_MAIN_USE_CALLBACKS apps.
@ -359,7 +312,7 @@ extern SDLMAIN_DECLSPEC int SDLCALL SDL_AppInit(void **appstate, int argc, char
* \sa SDL_AppInit
* \sa SDL_AppEvent
*/
extern SDLMAIN_DECLSPEC int SDLCALL SDL_AppIterate(void *appstate);
extern SDLMAIN_DECLSPEC SDL_AppResult SDLCALL SDL_AppIterate(void *appstate);
/**
* App-implemented event entry point for SDL_MAIN_USE_CALLBACKS apps.
@ -406,7 +359,7 @@ extern SDLMAIN_DECLSPEC int SDLCALL SDL_AppIterate(void *appstate);
* \sa SDL_AppInit
* \sa SDL_AppIterate
*/
extern SDLMAIN_DECLSPEC int SDLCALL SDL_AppEvent(void *appstate, const SDL_Event *event);
extern SDLMAIN_DECLSPEC SDL_AppResult SDLCALL SDL_AppEvent(void *appstate, const SDL_Event *event);
/**
* App-implemented deinit entry point for SDL_MAIN_USE_CALLBACKS apps.
@ -525,8 +478,9 @@ extern SDL_DECLSPEC void SDLCALL SDL_SetMainReady(void);
* literally have to be `main`.
* \param reserved should be NULL (reserved for future use, will probably be
* platform-specific then).
* \returns the return value from mainFunction: 0 on success, -1 on failure;
* SDL_GetError() might have more information on the failure.
* \returns the return value from mainFunction: 0 on success, otherwise
* failure; SDL_GetError() might have more information on the
* failure.
*
* \threadsafety Generally this is called once, near startup, from the
* process's initial thread.
@ -584,12 +538,12 @@ extern SDL_DECLSPEC int SDLCALL SDL_EnterAppMainCallbacks(int argc, char *argv[]
* what is specified here.
* \param hInst the HINSTANCE to use in WNDCLASSEX::hInstance. If zero, SDL
* will use `GetModuleHandle(NULL)` instead.
* \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.
*/
extern SDL_DECLSPEC int SDLCALL SDL_RegisterApp(const char *name, Uint32 style, void *hInst);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_RegisterApp(const char *name, Uint32 style, void *hInst);
/**
* Deregister the win32 window class from an SDL_RegisterApp call.
@ -631,7 +585,8 @@ extern SDL_DECLSPEC void SDLCALL SDL_GDKSuspendComplete(void);
/* include header-only SDL_main implementations */
#if defined(SDL_MAIN_USE_CALLBACKS) \
|| defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_GDK) || defined(SDL_PLATFORM_IOS) || defined(SDL_PLATFORM_TVOS) \
|| defined(SDL_PLATFORM_3DS) || defined(SDL_PLATFORM_NGAGE) || defined(SDL_PLATFORM_PS2) || defined(SDL_PLATFORM_PSP)
|| defined(SDL_PLATFORM_3DS) || defined(SDL_PLATFORM_NGAGE) || defined(SDL_PLATFORM_PS2) || defined(SDL_PLATFORM_PSP) \
|| defined(SDL_PLATFORM_EMSCRIPTEN)
/* platforms which main (-equivalent) can be implemented in plain C */
#include <SDL3/SDL_main_impl.h>

View File

@ -154,14 +154,14 @@ typedef struct SDL_MessageBoxData
* other options.
* \param buttonid the pointer to which user id of hit button should be
* copied.
* \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_ShowSimpleMessageBox
*/
extern SDL_DECLSPEC int SDLCALL SDL_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid);
/**
* Display a simple modal message box.
@ -196,14 +196,14 @@ extern SDL_DECLSPEC int SDLCALL SDL_ShowMessageBox(const SDL_MessageBoxData *mes
* \param title uTF-8 title text.
* \param message uTF-8 message text.
* \param window the parent window, or NULL for no parent.
* \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_ShowMessageBox
*/
extern SDL_DECLSPEC int SDLCALL SDL_ShowSimpleMessageBox(SDL_MessageBoxFlags flags, const char *title, const char *message, SDL_Window *window);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_ShowSimpleMessageBox(SDL_MessageBoxFlags flags, const char *title, const char *message, SDL_Window *window);
/* Ends C function definitions when using C++ */

View File

@ -62,12 +62,12 @@ extern "C" {
*
* \param url a valid URL/URI to open. Use `file:///full/path/to/file` for
* local files, if supported.
* \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.
*/
extern SDL_DECLSPEC int SDLCALL SDL_OpenURL(const char *url);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_OpenURL(const char *url);
/* Ends C function definitions when using C++ */
#ifdef __cplusplus

View File

@ -38,9 +38,26 @@
extern "C" {
#endif
/**
* This is a unique ID for a mouse for the time it is connected to the system,
* and is never reused for the lifetime of the application.
*
* If the mouse is disconnected and reconnected, it will get a new ID.
*
* The value 0 is an invalid ID.
*
* \since This datatype is available since SDL 3.0.0.
*/
typedef Uint32 SDL_MouseID;
typedef struct SDL_Cursor SDL_Cursor; /**< Implementation dependent */
/**
* The structure used to identify an SDL cursor.
*
* This is opaque data.
*
* \since This struct is available since SDL 3.0.0.
*/
typedef struct SDL_Cursor SDL_Cursor;
/**
* Cursor types for SDL_CreateSystemCursor().
@ -278,33 +295,48 @@ extern SDL_DECLSPEC void SDLCALL SDL_WarpMouseInWindow(SDL_Window * window,
*
* \param x the x coordinate.
* \param y the y coordinate.
* \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_WarpMouseInWindow
*/
extern SDL_DECLSPEC int SDLCALL SDL_WarpMouseGlobal(float x, float y);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_WarpMouseGlobal(float x, float y);
/**
* Set relative mouse mode.
* Set relative mouse mode for a window.
*
* While the mouse is in relative mode, the cursor is hidden, the mouse
* position is constrained to the window, and SDL will report continuous
* relative mouse motion even if the mouse is at the edge of the window.
* While the window has focus and relative mouse mode is enabled, the cursor
* is hidden, the mouse position is constrained to the window, and SDL will
* report continuous relative mouse motion even if the mouse is at the edge of
* the window.
*
* This function will flush any pending mouse motion.
* This function will flush any pending mouse motion for this window.
*
* \param window the window to change.
* \param enabled SDL_TRUE to enable relative mode, SDL_FALSE to disable.
* \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_GetRelativeMouseMode
* \sa SDL_GetWindowRelativeMouseMode
*/
extern SDL_DECLSPEC int SDLCALL SDL_SetRelativeMouseMode(SDL_bool enabled);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetWindowRelativeMouseMode(SDL_Window *window, SDL_bool enabled);
/**
* Query whether relative mouse mode is enabled for a window.
*
* \param window the window to query.
* \returns SDL_TRUE if relative mode is enabled for a window or SDL_FALSE
* otherwise.
*
* \since This function is available since SDL 3.0.0.
*
* \sa SDL_SetWindowRelativeMouseMode
*/
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetWindowRelativeMouseMode(SDL_Window *window);
/**
* Capture the mouse and to track input outside an SDL window.
@ -321,7 +353,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_SetRelativeMouseMode(SDL_bool enabled);
* mouse while the user is dragging something, until the user releases a mouse
* button. It is not recommended that you capture the mouse for long periods
* of time, such as the entire time your app is running. For that, you should
* probably use SDL_SetRelativeMouseMode() or SDL_SetWindowMouseGrab(),
* probably use SDL_SetWindowRelativeMouseMode() or SDL_SetWindowMouseGrab(),
* depending on your goals.
*
* While captured, mouse events still report coordinates relative to the
@ -343,25 +375,14 @@ extern SDL_DECLSPEC int SDLCALL SDL_SetRelativeMouseMode(SDL_bool enabled);
* `SDL_HINT_MOUSE_AUTO_CAPTURE` hint to zero.
*
* \param enabled SDL_TRUE to enable capturing, SDL_FALSE to disable.
* \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_GetGlobalMouseState
*/
extern SDL_DECLSPEC int SDLCALL SDL_CaptureMouse(SDL_bool enabled);
/**
* Query whether relative mouse mode is enabled.
*
* \returns SDL_TRUE if relative mode is enabled or SDL_FALSE otherwise.
*
* \since This function is available since SDL 3.0.0.
*
* \sa SDL_SetRelativeMouseMode
*/
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetRelativeMouseMode(void);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_CaptureMouse(SDL_bool enabled);
/**
* Create a cursor using the specified bitmap data and mask (in MSB format).
@ -419,8 +440,9 @@ extern SDL_DECLSPEC SDL_Cursor * SDLCALL SDL_CreateCursor(const Uint8 * data,
* situations. For example, if the original surface is 32x32, then on a 2x
* macOS display or 200% display scale on Windows, a 64x64 version of the
* image will be used, if available. If a matching version of the image isn't
* available, the closest size image will be scaled to the appropriate size
* and be used instead.
* available, the closest larger size image will be downscaled to the
* appropriate size and be used instead, if available. Otherwise, the closest
* smaller image will be upscaled and be used instead.
*
* \param surface an SDL_Surface structure representing the cursor image.
* \param hot_x the x position of the cursor hot spot.
@ -461,14 +483,14 @@ extern SDL_DECLSPEC SDL_Cursor * SDLCALL SDL_CreateSystemCursor(SDL_SystemCursor
* this is desired for any reason.
*
* \param cursor a cursor to make active.
* \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_GetCursor
*/
extern SDL_DECLSPEC int SDLCALL SDL_SetCursor(SDL_Cursor *cursor);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetCursor(SDL_Cursor *cursor);
/**
* Get the active cursor.
@ -516,28 +538,28 @@ extern SDL_DECLSPEC void SDLCALL SDL_DestroyCursor(SDL_Cursor *cursor);
/**
* Show the cursor.
*
* \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_CursorVisible
* \sa SDL_HideCursor
*/
extern SDL_DECLSPEC int SDLCALL SDL_ShowCursor(void);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_ShowCursor(void);
/**
* Hide the cursor.
*
* \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_CursorVisible
* \sa SDL_ShowCursor
*/
extern SDL_DECLSPEC int SDLCALL SDL_HideCursor(void);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_HideCursor(void);
/**
* Return whether the cursor is currently being shown.

View File

@ -115,16 +115,6 @@
extern "C" {
#endif
/**
* Synchronization functions return this value if they time out.
*
* Not all functions _can_ time out; some will block indefinitely.
*
* \since This macro is available since SDL 3.0.0.
*/
#define SDL_MUTEX_TIMEDOUT 1
/**
* \name Mutex functions
*/
@ -194,25 +184,22 @@ extern SDL_DECLSPEC void SDLCALL SDL_LockMutex(SDL_Mutex *mutex) SDL_ACQUIRE(mut
* Try to lock a mutex without blocking.
*
* This works just like SDL_LockMutex(), but if the mutex is not available,
* this function returns `SDL_MUTEX_TIMEDOUT` immediately.
* this function returns SDL_FALSE immediately.
*
* This technique is useful if you need exclusive access to a resource but
* don't want to wait for it, and will return to it to try again later.
*
* This function does not fail; if mutex is NULL, it will return 0 immediately
* having locked nothing. If the mutex is valid, this function will always
* either lock the mutex and return 0, or return SDL_MUTEX_TIMEOUT and lock
* nothing.
* This function returns SDL_TRUE if passed a NULL mutex.
*
* \param mutex the mutex to try to lock.
* \returns 0 or `SDL_MUTEX_TIMEDOUT`.
* \returns SDL_TRUE on success, SDL_FALSE if the mutex would block.
*
* \since This function is available since SDL 3.0.0.
*
* \sa SDL_LockMutex
* \sa SDL_UnlockMutex
*/
extern SDL_DECLSPEC int SDLCALL SDL_TryLockMutex(SDL_Mutex *mutex) SDL_TRY_ACQUIRE(0, mutex);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_TryLockMutex(SDL_Mutex *mutex) SDL_TRY_ACQUIRE(0, mutex);
/**
* Unlock the mutex.
@ -278,19 +265,6 @@ extern SDL_DECLSPEC void SDLCALL SDL_DestroyMutex(SDL_Mutex *mutex);
*/
typedef struct SDL_RWLock SDL_RWLock;
/*
* Synchronization functions return this value if they time out.
*
* Not all functions _can_ time out; some will block indefinitely.
*
* This symbol is just for clarity when dealing with SDL_RWLock
* functions; its value is equivalent to SDL_MUTEX_TIMEOUT.
*
* \since This macro is available since SDL 3.0.0.
*/
#define SDL_RWLOCK_TIMEDOUT SDL_MUTEX_TIMEDOUT
/**
* Create a new read/write lock.
*
@ -405,7 +379,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_LockRWLockForWriting(SDL_RWLock *rwlock) SD
* Try to lock a read/write lock _for reading_ without blocking.
*
* This works just like SDL_LockRWLockForReading(), but if the rwlock is not
* available, then this function returns `SDL_RWLOCK_TIMEDOUT` immediately.
* available, then this function returns SDL_FALSE immediately.
*
* This technique is useful if you need access to a resource but don't want to
* wait for it, and will return to it to try again later.
@ -413,13 +387,10 @@ extern SDL_DECLSPEC void SDLCALL SDL_LockRWLockForWriting(SDL_RWLock *rwlock) SD
* Trying to lock for read-only access can succeed if other threads are
* holding read-only locks, as this won't prevent access.
*
* This function does not fail; if rwlock is NULL, it will return 0
* immediately having locked nothing. If rwlock is valid, this function will
* always either lock the rwlock and return 0, or return SDL_RWLOCK_TIMEOUT
* and lock nothing.
* This function returns SDL_TRUE if passed a NULL rwlock.
*
* \param rwlock the rwlock to try to lock.
* \returns 0 or `SDL_RWLOCK_TIMEDOUT`.
* \returns SDL_TRUE on success, SDL_FALSE if the lock would block.
*
* \since This function is available since SDL 3.0.0.
*
@ -427,13 +398,13 @@ extern SDL_DECLSPEC void SDLCALL SDL_LockRWLockForWriting(SDL_RWLock *rwlock) SD
* \sa SDL_TryLockRWLockForWriting
* \sa SDL_UnlockRWLock
*/
extern SDL_DECLSPEC int SDLCALL SDL_TryLockRWLockForReading(SDL_RWLock *rwlock) SDL_TRY_ACQUIRE_SHARED(0, rwlock);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_TryLockRWLockForReading(SDL_RWLock *rwlock) SDL_TRY_ACQUIRE_SHARED(0, rwlock);
/**
* Try to lock a read/write lock _for writing_ without blocking.
*
* This works just like SDL_LockRWLockForWriting(), but if the rwlock is not
* available, this function returns `SDL_RWLOCK_TIMEDOUT` immediately.
* available, then this function returns SDL_FALSE immediately.
*
* This technique is useful if you need exclusive access to a resource but
* don't want to wait for it, and will return to it to try again later.
@ -446,13 +417,10 @@ extern SDL_DECLSPEC int SDLCALL SDL_TryLockRWLockForReading(SDL_RWLock *rwlock)
* read-only lock. Doing so results in undefined behavior. Unlock the
* read-only lock before requesting a write lock.
*
* This function does not fail; if rwlock is NULL, it will return 0
* immediately having locked nothing. If rwlock is valid, this function will
* always either lock the rwlock and return 0, or return SDL_RWLOCK_TIMEOUT
* and lock nothing.
* This function returns SDL_TRUE if passed a NULL rwlock.
*
* \param rwlock the rwlock to try to lock.
* \returns 0 or `SDL_RWLOCK_TIMEDOUT`.
* \returns SDL_TRUE on success, SDL_FALSE if the lock would block.
*
* \since This function is available since SDL 3.0.0.
*
@ -460,7 +428,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_TryLockRWLockForReading(SDL_RWLock *rwlock)
* \sa SDL_TryLockRWLockForReading
* \sa SDL_UnlockRWLock
*/
extern SDL_DECLSPEC int SDLCALL SDL_TryLockRWLockForWriting(SDL_RWLock *rwlock) SDL_TRY_ACQUIRE(0, rwlock);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_TryLockRWLockForWriting(SDL_RWLock *rwlock) SDL_TRY_ACQUIRE(0, rwlock);
/**
* Unlock the read/write lock.
@ -569,17 +537,14 @@ extern SDL_DECLSPEC void SDLCALL SDL_DestroySemaphore(SDL_Semaphore *sem);
/**
* Wait until a semaphore has a positive value and then decrements it.
*
* This function suspends the calling thread until either the semaphore
* pointed to by `sem` has a positive value or the call is interrupted by a
* signal or error. If the call is successful it will atomically decrement the
* semaphore value.
* This function suspends the calling thread until the semaphore pointed to by
* `sem` has a positive value, and then atomically decrement the semaphore
* value.
*
* This function is the equivalent of calling SDL_WaitSemaphoreTimeout() with
* a time length of -1.
*
* \param sem the semaphore wait on.
* \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information.
*
* \since This function is available since SDL 3.0.0.
*
@ -587,7 +552,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_DestroySemaphore(SDL_Semaphore *sem);
* \sa SDL_TryWaitSemaphore
* \sa SDL_WaitSemaphoreTimeout
*/
extern SDL_DECLSPEC int SDLCALL SDL_WaitSemaphore(SDL_Semaphore *sem);
extern SDL_DECLSPEC void SDLCALL SDL_WaitSemaphore(SDL_Semaphore *sem);
/**
* See if a semaphore has a positive value and decrement it if it does.
@ -595,12 +560,10 @@ extern SDL_DECLSPEC int SDLCALL SDL_WaitSemaphore(SDL_Semaphore *sem);
* This function checks to see if the semaphore pointed to by `sem` has a
* positive value and atomically decrements the semaphore value if it does. If
* the semaphore doesn't have a positive value, the function immediately
* returns SDL_MUTEX_TIMEDOUT.
* returns SDL_FALSE.
*
* \param sem the semaphore to wait on.
* \returns 0 if the wait succeeds, `SDL_MUTEX_TIMEDOUT` if the wait would
* block, or a negative error code on failure; call SDL_GetError()
* for more information.
* \returns SDL_TRUE if the wait succeeds, SDL_FALSE if the wait would block.
*
* \since This function is available since SDL 3.0.0.
*
@ -608,21 +571,19 @@ extern SDL_DECLSPEC int SDLCALL SDL_WaitSemaphore(SDL_Semaphore *sem);
* \sa SDL_WaitSemaphore
* \sa SDL_WaitSemaphoreTimeout
*/
extern SDL_DECLSPEC int SDLCALL SDL_TryWaitSemaphore(SDL_Semaphore *sem);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_TryWaitSemaphore(SDL_Semaphore *sem);
/**
* Wait until a semaphore has a positive value and then decrements it.
*
* This function suspends the calling thread until either the semaphore
* pointed to by `sem` has a positive value, the call is interrupted by a
* signal or error, or the specified time has elapsed. If the call is
* successful it will atomically decrement the semaphore value.
* pointed to by `sem` has a positive value or the specified time has elapsed.
* If the call is successful it will atomically decrement the semaphore value.
*
* \param sem the semaphore to wait on.
* \param timeoutMS the length of the timeout, in milliseconds.
* \returns 0 if the wait succeeds, `SDL_MUTEX_TIMEDOUT` if the wait does not
* succeed in the allotted time, or a negative error code on failure;
* call SDL_GetError() for more information.
* \param timeoutMS the length of the timeout, in milliseconds, or -1 to wait
* indefinitely.
* \returns SDL_TRUE if the wait succeeds or SDL_FALSE if the wait times out.
*
* \since This function is available since SDL 3.0.0.
*
@ -630,14 +591,12 @@ extern SDL_DECLSPEC int SDLCALL SDL_TryWaitSemaphore(SDL_Semaphore *sem);
* \sa SDL_TryWaitSemaphore
* \sa SDL_WaitSemaphore
*/
extern SDL_DECLSPEC int SDLCALL SDL_WaitSemaphoreTimeout(SDL_Semaphore *sem, Sint32 timeoutMS);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_WaitSemaphoreTimeout(SDL_Semaphore *sem, Sint32 timeoutMS);
/**
* Atomically increment a semaphore's value and wake waiting threads.
*
* \param sem the semaphore to increment.
* \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information.
*
* \since This function is available since SDL 3.0.0.
*
@ -645,7 +604,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_WaitSemaphoreTimeout(SDL_Semaphore *sem, Sin
* \sa SDL_WaitSemaphore
* \sa SDL_WaitSemaphoreTimeout
*/
extern SDL_DECLSPEC int SDLCALL SDL_SignalSemaphore(SDL_Semaphore *sem);
extern SDL_DECLSPEC void SDLCALL SDL_SignalSemaphore(SDL_Semaphore *sem);
/**
* Get the current value of a semaphore.
@ -711,8 +670,6 @@ extern SDL_DECLSPEC void SDLCALL SDL_DestroyCondition(SDL_Condition *cond);
* Restart one of the threads that are waiting on the condition variable.
*
* \param cond the condition variable to signal.
* \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information.
*
* \threadsafety It is safe to call this function from any thread.
*
@ -722,14 +679,12 @@ extern SDL_DECLSPEC void SDLCALL SDL_DestroyCondition(SDL_Condition *cond);
* \sa SDL_WaitCondition
* \sa SDL_WaitConditionTimeout
*/
extern SDL_DECLSPEC int SDLCALL SDL_SignalCondition(SDL_Condition *cond);
extern SDL_DECLSPEC void SDLCALL SDL_SignalCondition(SDL_Condition *cond);
/**
* Restart all threads that are waiting on the condition variable.
*
* \param cond the condition variable to signal.
* \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information.
*
* \threadsafety It is safe to call this function from any thread.
*
@ -739,7 +694,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_SignalCondition(SDL_Condition *cond);
* \sa SDL_WaitCondition
* \sa SDL_WaitConditionTimeout
*/
extern SDL_DECLSPEC int SDLCALL SDL_BroadcastCondition(SDL_Condition *cond);
extern SDL_DECLSPEC void SDLCALL SDL_BroadcastCondition(SDL_Condition *cond);
/**
* Wait until a condition variable is signaled.
@ -758,8 +713,6 @@ extern SDL_DECLSPEC int SDLCALL SDL_BroadcastCondition(SDL_Condition *cond);
*
* \param cond the condition variable to wait on.
* \param mutex the mutex used to coordinate thread access.
* \returns 0 when it is signaled or a negative error code on failure; call
* SDL_GetError() for more information.
*
* \threadsafety It is safe to call this function from any thread.
*
@ -769,7 +722,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_BroadcastCondition(SDL_Condition *cond);
* \sa SDL_SignalCondition
* \sa SDL_WaitConditionTimeout
*/
extern SDL_DECLSPEC int SDLCALL SDL_WaitCondition(SDL_Condition *cond, SDL_Mutex *mutex);
extern SDL_DECLSPEC void SDLCALL SDL_WaitCondition(SDL_Condition *cond, SDL_Mutex *mutex);
/**
* Wait until a condition variable is signaled or a certain time has passed.
@ -788,9 +741,8 @@ extern SDL_DECLSPEC int SDLCALL SDL_WaitCondition(SDL_Condition *cond, SDL_Mutex
* \param mutex the mutex used to coordinate thread access.
* \param timeoutMS the maximum time to wait, in milliseconds, or -1 to wait
* indefinitely.
* \returns 0 if the condition variable is signaled, `SDL_MUTEX_TIMEDOUT` if
* the condition is not signaled in the allotted time, or a negative
* error code on failure; call SDL_GetError() for more information.
* \returns SDL_TRUE if the condition variable is signaled, SDL_FALSE if the
* condition is not signaled in the allotted time.
*
* \threadsafety It is safe to call this function from any thread.
*
@ -800,7 +752,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_WaitCondition(SDL_Condition *cond, SDL_Mutex
* \sa SDL_SignalCondition
* \sa SDL_WaitCondition
*/
extern SDL_DECLSPEC int SDLCALL SDL_WaitConditionTimeout(SDL_Condition *cond,
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_WaitConditionTimeout(SDL_Condition *cond,
SDL_Mutex *mutex, Sint32 timeoutMS);
/* @} *//* Condition variable functions */

View File

@ -40,7 +40,9 @@
/* ##SDL_atomic.h */
#define SDL_AtomicCAS SDL_AtomicCompareAndSwap
#define SDL_AtomicCASPtr SDL_AtomicCompareAndSwapPointer
#define SDL_AtomicGetPtr SDL_AtomicGetPointer
#define SDL_AtomicLock SDL_LockSpinlock
#define SDL_AtomicSetPtr SDL_AtomicSetPointer
#define SDL_AtomicTryLock SDL_TryLockSpinlock
#define SDL_AtomicUnlock SDL_UnlockSpinlock
#define SDL_atomic_t SDL_AtomicInt
@ -116,6 +118,7 @@
#define SDL_DROPCOMPLETE SDL_EVENT_DROP_COMPLETE
#define SDL_DROPFILE SDL_EVENT_DROP_FILE
#define SDL_DROPTEXT SDL_EVENT_DROP_TEXT
#define SDL_DelEventWatch SDL_RemoveEventWatch
#define SDL_FINGERDOWN SDL_EVENT_FINGER_DOWN
#define SDL_FINGERMOTION SDL_EVENT_FINGER_MOTION
#define SDL_FINGERUP SDL_EVENT_FINGER_UP
@ -296,6 +299,7 @@
#define SDL_MouseIsHaptic SDL_IsMouseHaptic
/* ##SDL_hints.h */
#define SDL_DelHintCallback SDL_RemoveHintCallback
#define SDL_HINT_ALLOW_TOPMOST SDL_HINT_WINDOW_ALLOW_TOPMOST
#define SDL_HINT_DIRECTINPUT_ENABLED SDL_HINT_JOYSTICK_DIRECTINPUT
#define SDL_HINT_GDK_TEXTINPUT_DEFAULT SDL_HINT_GDK_TEXTINPUT_DEFAULT_TEXT
@ -523,7 +527,6 @@
#define SDL_RenderSetVSync SDL_SetRenderVSync
#define SDL_RenderSetViewport SDL_SetRenderViewport
#define SDL_RenderWindowToLogical SDL_RenderCoordinatesFromWindow
#define SDL_ScaleModeBest SDL_SCALEMODE_BEST
#define SDL_ScaleModeLinear SDL_SCALEMODE_LINEAR
#define SDL_ScaleModeNearest SDL_SCALEMODE_NEAREST
@ -660,7 +663,9 @@
/* ##SDL_atomic.h */
#define SDL_AtomicCAS SDL_AtomicCAS_renamed_SDL_AtomicCompareAndSwap
#define SDL_AtomicCASPtr SDL_AtomicCASPtr_renamed_SDL_AtomicCompareAndSwapPointer
#define SDL_AtomicGetPtr SDL_AtomicGetPtr_renamed_SDL_AtomicGetPointer
#define SDL_AtomicLock SDL_AtomicLock_renamed_SDL_LockSpinlock
#define SDL_AtomicSetPtr SDL_AtomicSetPtr_renamed_SDL_AtomicSetPointer
#define SDL_AtomicTryLock SDL_AtomicTryLock_renamed_SDL_TryLockSpinlock
#define SDL_AtomicUnlock SDL_AtomicUnlock_renamed_SDL_UnlockSpinlock
#define SDL_atomic_t SDL_atomic_t_renamed_SDL_AtomicInt
@ -736,6 +741,7 @@
#define SDL_DROPCOMPLETE SDL_DROPCOMPLETE_renamed_SDL_EVENT_DROP_COMPLETE
#define SDL_DROPFILE SDL_DROPFILE_renamed_SDL_EVENT_DROP_FILE
#define SDL_DROPTEXT SDL_DROPTEXT_renamed_SDL_EVENT_DROP_TEXT
#define SDL_DelEventWatch SDL_DelEventWatch_renamed_SDL_RemoveEventWatch
#define SDL_FINGERDOWN SDL_FINGERDOWN_renamed_SDL_EVENT_FINGER_DOWN
#define SDL_FINGERMOTION SDL_FINGERMOTION_renamed_SDL_EVENT_FINGER_MOTION
#define SDL_FINGERUP SDL_FINGERUP_renamed_SDL_EVENT_FINGER_UP
@ -917,6 +923,7 @@
#define SDL_MouseIsHaptic SDL_MouseIsHaptic_renamed_SDL_IsMouseHaptic
/* ##SDL_hints.h */
#define SDL_DelHintCallback SDL_DelHintCallback_renamed_SDL_RemoveHintCallback
#define SDL_HINT_ALLOW_TOPMOST SDL_HINT_ALLOW_TOPMOST_renamed_SDL_HINT_WINDOW_ALLOW_TOPMOST
#define SDL_HINT_DIRECTINPUT_ENABLED SDL_HINT_DIRECTINPUT_ENABLED_renamed_SDL_HINT_JOYSTICK_DIRECTINPUT
#define SDL_HINT_GDK_TEXTINPUT_DEFAULT SDL_HINT_GDK_TEXTINPUT_DEFAULT_renamed_SDL_HINT_GDK_TEXTINPUT_DEFAULT_TEXT
@ -1144,7 +1151,6 @@
#define SDL_RenderSetVSync SDL_RenderSetVSync_renamed_SDL_SetRenderVSync
#define SDL_RenderSetViewport SDL_RenderSetViewport_renamed_SDL_SetRenderViewport
#define SDL_RenderWindowToLogical SDL_RenderWindowToLogical_renamed_SDL_RenderCoordinatesFromWindow
#define SDL_ScaleModeBest SDL_ScaleModeBest_renamed_SDL_SCALEMODE_BEST
#define SDL_ScaleModeLinear SDL_ScaleModeLinear_renamed_SDL_SCALEMODE_LINEAR
#define SDL_ScaleModeNearest SDL_ScaleModeNearest_renamed_SDL_SCALEMODE_NEAREST

View File

@ -9807,15 +9807,15 @@ typedef void (APIENTRYP PFNGLUPLOADGPUMASKNVXPROC) (GLbitfield mask);
typedef void (APIENTRYP PFNGLMULTICASTVIEWPORTARRAYVNVXPROC) (GLuint gpu, GLuint first, GLsizei count, const GLfloat *v);
typedef void (APIENTRYP PFNGLMULTICASTVIEWPORTPOSITIONWSCALENVXPROC) (GLuint gpu, GLuint index, GLfloat xcoeff, GLfloat ycoeff);
typedef void (APIENTRYP PFNGLMULTICASTSCISSORARRAYVNVXPROC) (GLuint gpu, GLuint first, GLsizei count, const GLint *v);
typedef GLuint (APIENTRYP PFNGLASYNCCOPYBUFFERSUBDATANVXPROC) (GLsizei waitSemaphoreCount, const GLuint *waitSemaphoreArray, const GLuint64 *fenceValueArray, GLuint readGpu, GLbitfield writeGpuMask, GLuint readBuffer, GLuint writeBuffer, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size, GLsizei signalSemaphoreCount, const GLuint *signalSemaphoreArray, const GLuint64 *signalValueArray);
typedef GLuint (APIENTRYP PFNGLASYNCCOPYIMAGESUBDATANVXPROC) (GLsizei waitSemaphoreCount, const GLuint *waitSemaphoreArray, const GLuint64 *waitValueArray, GLuint srcGpu, GLbitfield dstGpuMask, GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei srcWidth, GLsizei srcHeight, GLsizei srcDepth, GLsizei signalSemaphoreCount, const GLuint *signalSemaphoreArray, const GLuint64 *signalValueArray);
typedef GLuint (APIENTRYP PFNGLASYNCCOPYBUFFERSUBDATANVXPROC) (GLsizei waitSemaphoreCount, const GLuint *waitSemaphoreArray, const GLuint64 *fenceValueArray, GLuint readGPU, GLbitfield writeGPUMask, GLuint readBuffer, GLuint writeBuffer, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size, GLsizei signalSemaphoreCount, const GLuint *signalSemaphoreArray, const GLuint64 *signalValueArray);
typedef GLuint (APIENTRYP PFNGLASYNCCOPYIMAGESUBDATANVXPROC) (GLsizei waitSemaphoreCount, const GLuint *waitSemaphoreArray, const GLuint64 *waitValueArray, GLuint srcGPU, GLbitfield dstGPUMask, GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei srcWidth, GLsizei srcHeight, GLsizei srcDepth, GLsizei signalSemaphoreCount, const GLuint *signalSemaphoreArray, const GLuint64 *signalValueArray);
#ifdef GL_GLEXT_PROTOTYPES
GLAPI void APIENTRY glUploadGpuMaskNVX (GLbitfield mask);
GLAPI void APIENTRY glUploadGPUMaskNVX (GLbitfield mask);
GLAPI void APIENTRY glMulticastViewportArrayvNVX (GLuint gpu, GLuint first, GLsizei count, const GLfloat *v);
GLAPI void APIENTRY glMulticastViewportPositionWScaleNVX (GLuint gpu, GLuint index, GLfloat xcoeff, GLfloat ycoeff);
GLAPI void APIENTRY glMulticastScissorArrayvNVX (GLuint gpu, GLuint first, GLsizei count, const GLint *v);
GLAPI GLuint APIENTRY glAsyncCopyBufferSubDataNVX (GLsizei waitSemaphoreCount, const GLuint *waitSemaphoreArray, const GLuint64 *fenceValueArray, GLuint readGpu, GLbitfield writeGpuMask, GLuint readBuffer, GLuint writeBuffer, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size, GLsizei signalSemaphoreCount, const GLuint *signalSemaphoreArray, const GLuint64 *signalValueArray);
GLAPI GLuint APIENTRY glAsyncCopyImageSubDataNVX (GLsizei waitSemaphoreCount, const GLuint *waitSemaphoreArray, const GLuint64 *waitValueArray, GLuint srcGpu, GLbitfield dstGpuMask, GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei srcWidth, GLsizei srcHeight, GLsizei srcDepth, GLsizei signalSemaphoreCount, const GLuint *signalSemaphoreArray, const GLuint64 *signalValueArray);
GLAPI GLuint APIENTRY glAsyncCopyBufferSubDataNVX (GLsizei waitSemaphoreCount, const GLuint *waitSemaphoreArray, const GLuint64 *fenceValueArray, GLuint readGPU, GLbitfield writeGPUMask, GLuint readBuffer, GLuint writeBuffer, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size, GLsizei signalSemaphoreCount, const GLuint *signalSemaphoreArray, const GLuint64 *signalValueArray);
GLAPI GLuint APIENTRY glAsyncCopyImageSubDataNVX (GLsizei waitSemaphoreCount, const GLuint *waitSemaphoreArray, const GLuint64 *waitValueArray, GLuint srcGPU, GLbitfield dstGPUMask, GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei srcWidth, GLsizei srcHeight, GLsizei srcDepth, GLsizei signalSemaphoreCount, const GLuint *signalSemaphoreArray, const GLuint64 *signalValueArray);
#endif
#endif /* GL_NVX_gpu_multicast2 */
@ -9824,11 +9824,11 @@ GLAPI GLuint APIENTRY glAsyncCopyImageSubDataNVX (GLsizei waitSemaphoreCount, co
#define GL_LGPU_SEPARATE_STORAGE_BIT_NVX 0x0800
#define GL_MAX_LGPU_GPUS_NVX 0x92BA
typedef void (APIENTRYP PFNGLLGPUNAMEDBUFFERSUBDATANVXPROC) (GLbitfield gpuMask, GLuint buffer, GLintptr offset, GLsizeiptr size, const void *data);
typedef void (APIENTRYP PFNGLLGPUCOPYIMAGESUBDATANVXPROC) (GLuint sourceGpu, GLbitfield destinationGpuMask, GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srxY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei width, GLsizei height, GLsizei depth);
typedef void (APIENTRYP PFNGLLGPUCOPYIMAGESUBDATANVXPROC) (GLuint sourceGPU, GLbitfield destinationGPUMask, GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srxY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei width, GLsizei height, GLsizei depth);
typedef void (APIENTRYP PFNGLLGPUINTERLOCKNVXPROC) (void);
#ifdef GL_GLEXT_PROTOTYPES
GLAPI void APIENTRY glLGPUNamedBufferSubDataNVX (GLbitfield gpuMask, GLuint buffer, GLintptr offset, GLsizeiptr size, const void *data);
GLAPI void APIENTRY glLGPUCopyImageSubDataNVX (GLuint sourceGpu, GLbitfield destinationGpuMask, GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srxY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei width, GLsizei height, GLsizei depth);
GLAPI void APIENTRY glLGPUCopyImageSubDataNVX (GLuint sourceGPU, GLbitfield destinationGPUMask, GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srxY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei width, GLsizei height, GLsizei depth);
GLAPI void APIENTRY glLGPUInterlockNVX (void);
#endif
#endif /* GL_NVX_linked_gpu_multicast */
@ -9836,13 +9836,13 @@ GLAPI void APIENTRY glLGPUInterlockNVX (void);
#ifndef GL_NVX_progress_fence
#define GL_NVX_progress_fence 1
typedef GLuint (APIENTRYP PFNGLCREATEPROGRESSFENCENVXPROC) (void);
typedef void (APIENTRYP PFNGLSIGNALSEMAPHOREUI64NVXPROC) (GLuint signalGpu, GLsizei fenceObjectCount, const GLuint *semaphoreArray, const GLuint64 *fenceValueArray);
typedef void (APIENTRYP PFNGLWAITSEMAPHOREUI64NVXPROC) (GLuint waitGpu, GLsizei fenceObjectCount, const GLuint *semaphoreArray, const GLuint64 *fenceValueArray);
typedef void (APIENTRYP PFNGLSIGNALSEMAPHOREUI64NVXPROC) (GLuint signalGPU, GLsizei fenceObjectCount, const GLuint *semaphoreArray, const GLuint64 *fenceValueArray);
typedef void (APIENTRYP PFNGLWAITSEMAPHOREUI64NVXPROC) (GLuint waitGPU, GLsizei fenceObjectCount, const GLuint *semaphoreArray, const GLuint64 *fenceValueArray);
typedef void (APIENTRYP PFNGLCLIENTWAITSEMAPHOREUI64NVXPROC) (GLsizei fenceObjectCount, const GLuint *semaphoreArray, const GLuint64 *fenceValueArray);
#ifdef GL_GLEXT_PROTOTYPES
GLAPI GLuint APIENTRY glCreateProgressFenceNVX (void);
GLAPI void APIENTRY glSignalSemaphoreui64NVX (GLuint signalGpu, GLsizei fenceObjectCount, const GLuint *semaphoreArray, const GLuint64 *fenceValueArray);
GLAPI void APIENTRY glWaitSemaphoreui64NVX (GLuint waitGpu, GLsizei fenceObjectCount, const GLuint *semaphoreArray, const GLuint64 *fenceValueArray);
GLAPI void APIENTRY glSignalSemaphoreui64NVX (GLuint signalGPU, GLsizei fenceObjectCount, const GLuint *semaphoreArray, const GLuint64 *fenceValueArray);
GLAPI void APIENTRY glWaitSemaphoreui64NVX (GLuint waitGPU, GLsizei fenceObjectCount, const GLuint *semaphoreArray, const GLuint64 *fenceValueArray);
GLAPI void APIENTRY glClientWaitSemaphoreui64NVX (GLsizei fenceObjectCount, const GLuint *semaphoreArray, const GLuint64 *fenceValueArray);
#endif
#endif /* GL_NVX_progress_fence */
@ -10433,25 +10433,25 @@ GLAPI void APIENTRY glFramebufferTextureFaceEXT (GLenum target, GLenum attachmen
#define GL_MULTICAST_PROGRAMMABLE_SAMPLE_LOCATION_NV 0x9549
typedef void (APIENTRYP PFNGLRENDERGPUMASKNVPROC) (GLbitfield mask);
typedef void (APIENTRYP PFNGLMULTICASTBUFFERSUBDATANVPROC) (GLbitfield gpuMask, GLuint buffer, GLintptr offset, GLsizeiptr size, const void *data);
typedef void (APIENTRYP PFNGLMULTICASTCOPYBUFFERSUBDATANVPROC) (GLuint readGpu, GLbitfield writeGpuMask, GLuint readBuffer, GLuint writeBuffer, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size);
typedef void (APIENTRYP PFNGLMULTICASTCOPYIMAGESUBDATANVPROC) (GLuint srcGpu, GLbitfield dstGpuMask, GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei srcWidth, GLsizei srcHeight, GLsizei srcDepth);
typedef void (APIENTRYP PFNGLMULTICASTBLITFRAMEBUFFERNVPROC) (GLuint srcGpu, GLuint dstGpu, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
typedef void (APIENTRYP PFNGLMULTICASTCOPYBUFFERSUBDATANVPROC) (GLuint readGPU, GLbitfield writeGPUMask, GLuint readBuffer, GLuint writeBuffer, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size);
typedef void (APIENTRYP PFNGLMULTICASTCOPYIMAGESUBDATANVPROC) (GLuint srcGPU, GLbitfield dstGPUMask, GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei srcWidth, GLsizei srcHeight, GLsizei srcDepth);
typedef void (APIENTRYP PFNGLMULTICASTBLITFRAMEBUFFERNVPROC) (GLuint srcGPU, GLuint dstGPU, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
typedef void (APIENTRYP PFNGLMULTICASTFRAMEBUFFERSAMPLELOCATIONSFVNVPROC) (GLuint gpu, GLuint framebuffer, GLuint start, GLsizei count, const GLfloat *v);
typedef void (APIENTRYP PFNGLMULTICASTBARRIERNVPROC) (void);
typedef void (APIENTRYP PFNGLMULTICASTWAITSYNCNVPROC) (GLuint signalGpu, GLbitfield waitGpuMask);
typedef void (APIENTRYP PFNGLMULTICASTWAITSYNCNVPROC) (GLuint signalGPU, GLbitfield waitGPUMask);
typedef void (APIENTRYP PFNGLMULTICASTGETQUERYOBJECTIVNVPROC) (GLuint gpu, GLuint id, GLenum pname, GLint *params);
typedef void (APIENTRYP PFNGLMULTICASTGETQUERYOBJECTUIVNVPROC) (GLuint gpu, GLuint id, GLenum pname, GLuint *params);
typedef void (APIENTRYP PFNGLMULTICASTGETQUERYOBJECTI64VNVPROC) (GLuint gpu, GLuint id, GLenum pname, GLint64 *params);
typedef void (APIENTRYP PFNGLMULTICASTGETQUERYOBJECTUI64VNVPROC) (GLuint gpu, GLuint id, GLenum pname, GLuint64 *params);
#ifdef GL_GLEXT_PROTOTYPES
GLAPI void APIENTRY glRenderGpuMaskNV (GLbitfield mask);
GLAPI void APIENTRY glRenderGPUMaskNV (GLbitfield mask);
GLAPI void APIENTRY glMulticastBufferSubDataNV (GLbitfield gpuMask, GLuint buffer, GLintptr offset, GLsizeiptr size, const void *data);
GLAPI void APIENTRY glMulticastCopyBufferSubDataNV (GLuint readGpu, GLbitfield writeGpuMask, GLuint readBuffer, GLuint writeBuffer, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size);
GLAPI void APIENTRY glMulticastCopyImageSubDataNV (GLuint srcGpu, GLbitfield dstGpuMask, GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei srcWidth, GLsizei srcHeight, GLsizei srcDepth);
GLAPI void APIENTRY glMulticastBlitFramebufferNV (GLuint srcGpu, GLuint dstGpu, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
GLAPI void APIENTRY glMulticastCopyBufferSubDataNV (GLuint readGPU, GLbitfield writeGPUMask, GLuint readBuffer, GLuint writeBuffer, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size);
GLAPI void APIENTRY glMulticastCopyImageSubDataNV (GLuint srcGPU, GLbitfield dstGPUMask, GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei srcWidth, GLsizei srcHeight, GLsizei srcDepth);
GLAPI void APIENTRY glMulticastBlitFramebufferNV (GLuint srcGPU, GLuint dstGPU, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
GLAPI void APIENTRY glMulticastFramebufferSampleLocationsfvNV (GLuint gpu, GLuint framebuffer, GLuint start, GLsizei count, const GLfloat *v);
GLAPI void APIENTRY glMulticastBarrierNV (void);
GLAPI void APIENTRY glMulticastWaitSyncNV (GLuint signalGpu, GLbitfield waitGpuMask);
GLAPI void APIENTRY glMulticastWaitSyncNV (GLuint signalGPU, GLbitfield waitGPUMask);
GLAPI void APIENTRY glMulticastGetQueryObjectivNV (GLuint gpu, GLuint id, GLenum pname, GLint *params);
GLAPI void APIENTRY glMulticastGetQueryObjectuivNV (GLuint gpu, GLuint id, GLenum pname, GLuint *params);
GLAPI void APIENTRY glMulticastGetQueryObjecti64vNV (GLuint gpu, GLuint id, GLenum pname, GLint64 *params);

View File

@ -22,56 +22,65 @@
/**
* # CategoryPen
*
* Include file for SDL pen event handling.
* SDL pen event handling.
*
* This file describes operations for pressure-sensitive pen (stylus and/or
* eraser) handling, e.g., for input and drawing tablets or suitably equipped
* mobile / tablet devices.
* SDL provides an API for pressure-sensitive pen (stylus and/or eraser)
* handling, e.g., for input and drawing tablets or suitably equipped mobile /
* tablet devices.
*
* To get started with pens:
* To get started with pens, simply handle SDL_EVENT_PEN_* events. When a pen
* starts providing input, SDL will assign it a unique SDL_PenID, which will
* remain for the life of the process, as long as the pen stays connected.
*
* - Listen to SDL_PenMotionEvent and SDL_PenButtonEvent
* - To avoid treating pen events as mouse events, ignore SDL_MouseMotionEvent
* and SDL_MouseButtonEvent whenever `which` == SDL_PEN_MOUSEID.
*
* We primarily identify pens by SDL_PenID. The implementation makes a best
* effort to relate each SDL_PenID to the same physical device during a
* session. Formerly valid SDL_PenID values remain valid even if a device
* disappears.
*
* For identifying pens across sessions, the API provides the type SDL_GUID .
* Pens may provide more than simple touch input; they might have other axes,
* such as pressure, tilt, rotation, etc.
*/
#ifndef SDL_pen_h_
#define SDL_pen_h_
#include <SDL3/SDL_error.h>
#include <SDL3/SDL_guid.h>
#include <SDL3/SDL_mouse.h>
#include <SDL3/SDL_stdinc.h>
/* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus
extern "C" {
#endif
typedef Uint32 SDL_PenID; /**< SDL_PenIDs identify pens uniquely within a session */
/**
* SDL pen instance IDs.
*
* Zero is used to signify an invalid/null device.
*
* These show up in pen events when SDL sees input from them. They remain
* consistent as long as SDL can recognize a tool to be the same pen; but if a
* pen physically leaves the area and returns, it might get a new ID.
*
* \since This datatype is available since SDL 3.0.0.
*/
typedef Uint32 SDL_PenID;
#define SDL_PEN_INVALID ((SDL_PenID)0) /**< Reserved invalid SDL_PenID is valid */
#define SDL_PEN_MOUSEID ((SDL_MouseID)-2) /**< Device ID for mouse events triggered by pen events */
#define SDL_PEN_INFO_UNKNOWN (-1) /**< Marks unknown information when querying the pen */
/**
* Pen axis indices
* Pen input flags, as reported by various pen events' `pen_state` field.
*
* Below are the valid indices to the "axis" array from SDL_PenMotionEvent and
* SDL_PenButtonEvent. The axis indices form a contiguous range of ints from 0
* to SDL_PEN_AXIS_LAST, inclusive. All "axis[]" entries are either normalised
* to 0..1 or report a (positive or negative) angle in degrees, with 0.0
* representing the centre. Not all pens/backends support all axes:
* unsupported entries are always "0.0f".
* \since This datatype is available since SDL 3.0.0.
*/
typedef Uint32 SDL_PenInputFlags;
#define SDL_PEN_INPUT_DOWN (1u << 0) /**< & to see if pen is pressed down */
#define SDL_PEN_INPUT_BUTTON_1 (1u << 1) /**< & to see if button 1 is pressed */
#define SDL_PEN_INPUT_BUTTON_2 (1u << 2) /**< & to see if button 2 is pressed */
#define SDL_PEN_INPUT_BUTTON_3 (1u << 3) /**< & to see if button 3 is pressed */
#define SDL_PEN_INPUT_BUTTON_4 (1u << 4) /**< & to see if button 4 is pressed */
#define SDL_PEN_INPUT_BUTTON_5 (1u << 5) /**< & to see if button 5 is pressed */
#define SDL_PEN_INPUT_ERASER_TIP (1u << 30) /**< & to see if eraser tip is used */
/**
* Pen axis indices.
*
* These are the valid values for the `axis` field in SDL_PenAxisEvent. All
* axes are either normalised to 0..1 or report a (positive or negative) angle
* in degrees, with 0.0 representing the centre. Not all pens/backends support
* all axes: unsupported axes are always zero.
*
* To convert angles for tilt and rotation into vector representation, use
* SDL_sinf on the XTILT, YTILT, or ROTATION component, for example:
@ -82,200 +91,18 @@ typedef Uint32 SDL_PenID; /**< SDL_PenIDs identify pens uniquely within a sessio
*/
typedef enum SDL_PenAxis
{
SDL_PEN_AXIS_PRESSURE = 0, /**< Pen pressure. Unidirectional: 0..1.0 */
SDL_PEN_AXIS_XTILT, /**< Pen horizontal tilt angle. Bidirectional: -90.0..90.0 (left-to-right).
The physical max/min tilt may be smaller than -90.0 / 90.0, cf. SDL_PenCapabilityInfo */
SDL_PEN_AXIS_YTILT, /**< Pen vertical tilt angle. Bidirectional: -90.0..90.0 (top-to-down).
The physical max/min tilt may be smaller than -90.0 / 90.0, cf. SDL_PenCapabilityInfo */
SDL_PEN_AXIS_DISTANCE, /**< Pen distance to drawing surface. Unidirectional: 0.0..1.0 */
SDL_PEN_AXIS_ROTATION, /**< Pen barrel rotation. Bidirectional: -180..179.9 (clockwise, 0 is facing up, -180.0 is facing down). */
SDL_PEN_AXIS_SLIDER, /**< Pen finger wheel or slider (e.g., Airbrush Pen). Unidirectional: 0..1.0 */
SDL_PEN_NUM_AXES, /**< Last valid axis index */
SDL_PEN_AXIS_LAST = SDL_PEN_NUM_AXES - 1 /**< Last axis index plus 1 */
SDL_PEN_AXIS_PRESSURE, /**< Pen pressure. Unidirectional: 0 to 1.0 */
SDL_PEN_AXIS_XTILT, /**< Pen horizontal tilt angle. Bidirectional: -90.0 to 90.0 (left-to-right).
The physical max/min tilt may be smaller than -90.0 / 90.0, check SDL_PenCapabilityInfo */
SDL_PEN_AXIS_YTILT, /**< Pen vertical tilt angle. Bidirectional: -90.0 to 90.0 (top-to-down).
The physical max/min tilt may be smaller than -90.0 / 90.0 check SDL_PenCapabilityInfo */
SDL_PEN_AXIS_DISTANCE, /**< Pen distance to drawing surface. Unidirectional: 0.0 to 1.0 */
SDL_PEN_AXIS_ROTATION, /**< Pen barrel rotation. Bidirectional: -180 to 179.9 (clockwise, 0 is facing up, -180.0 is facing down). */
SDL_PEN_AXIS_SLIDER, /**< Pen finger wheel or slider (e.g., Airbrush Pen). Unidirectional: 0 to 1.0 */
SDL_PEN_AXIS_TANGENTIAL_PRESSURE, /**< Pressure from squeezing the pen ("barrel pressure"). */
SDL_PEN_NUM_AXES /**< Total known pen axis types in this version of SDL. This number may grow in future releases! */
} SDL_PenAxis;
/* Pen flags. These share a bitmask space with SDL_BUTTON_LEFT and friends. */
#define SDL_PEN_FLAG_DOWN_BIT_INDEX 13 /* Bit for storing that pen is touching the surface */
#define SDL_PEN_FLAG_INK_BIT_INDEX 14 /* Bit for storing has-non-eraser-capability status */
#define SDL_PEN_FLAG_ERASER_BIT_INDEX 15 /* Bit for storing is-eraser or has-eraser-capability property */
#define SDL_PEN_FLAG_AXIS_BIT_OFFSET 16 /* Bit for storing has-axis-0 property */
#define SDL_PEN_CAPABILITY(capbit) (1ul << (capbit))
#define SDL_PEN_AXIS_CAPABILITY(axis) SDL_PEN_CAPABILITY((axis) + SDL_PEN_FLAG_AXIS_BIT_OFFSET)
/* Pen tips */
#define SDL_PEN_TIP_INK SDL_PEN_FLAG_INK_BIT_INDEX /**< Regular pen tip (for drawing) touched the surface */
#define SDL_PEN_TIP_ERASER SDL_PEN_FLAG_ERASER_BIT_INDEX /**< Eraser pen tip touched the surface */
/**
* Pen capabilities reported by SDL_GetPenCapabilities.
*
* \since This datatype is available since SDL 3.0.0.
*/
typedef Uint32 SDL_PenCapabilityFlags;
#define SDL_PEN_DOWN_MASK SDL_PEN_CAPABILITY(SDL_PEN_FLAG_DOWN_BIT_INDEX) /**< Pen tip is currently touching the drawing surface. */
#define SDL_PEN_INK_MASK SDL_PEN_CAPABILITY(SDL_PEN_FLAG_INK_BIT_INDEX) /**< Pen has a regular drawing tip (SDL_GetPenCapabilities). For events (SDL_PenButtonEvent, SDL_PenMotionEvent, SDL_GetPenStatus) this flag is mutually exclusive with SDL_PEN_ERASER_MASK . */
#define SDL_PEN_ERASER_MASK SDL_PEN_CAPABILITY(SDL_PEN_FLAG_ERASER_BIT_INDEX) /**< Pen has an eraser tip (SDL_GetPenCapabilities) or is being used as eraser (SDL_PenButtonEvent , SDL_PenMotionEvent , SDL_GetPenStatus) */
#define SDL_PEN_AXIS_PRESSURE_MASK SDL_PEN_AXIS_CAPABILITY(SDL_PEN_AXIS_PRESSURE) /**< Pen provides pressure information in axis SDL_PEN_AXIS_PRESSURE */
#define SDL_PEN_AXIS_XTILT_MASK SDL_PEN_AXIS_CAPABILITY(SDL_PEN_AXIS_XTILT) /**< Pen provides horizontal tilt information in axis SDL_PEN_AXIS_XTILT */
#define SDL_PEN_AXIS_YTILT_MASK SDL_PEN_AXIS_CAPABILITY(SDL_PEN_AXIS_YTILT) /**< Pen provides vertical tilt information in axis SDL_PEN_AXIS_YTILT */
#define SDL_PEN_AXIS_DISTANCE_MASK SDL_PEN_AXIS_CAPABILITY(SDL_PEN_AXIS_DISTANCE) /**< Pen provides distance to drawing tablet in SDL_PEN_AXIS_DISTANCE */
#define SDL_PEN_AXIS_ROTATION_MASK SDL_PEN_AXIS_CAPABILITY(SDL_PEN_AXIS_ROTATION) /**< Pen provides barrel rotation information in axis SDL_PEN_AXIS_ROTATION */
#define SDL_PEN_AXIS_SLIDER_MASK SDL_PEN_AXIS_CAPABILITY(SDL_PEN_AXIS_SLIDER) /**< Pen provides slider / finger wheel or similar in axis SDL_PEN_AXIS_SLIDER */
#define SDL_PEN_AXIS_BIDIRECTIONAL_MASKS (SDL_PEN_AXIS_XTILT_MASK | SDL_PEN_AXIS_YTILT_MASK)
/**
* Pen types
*
* Some pens identify as a particular type of drawing device (e.g., an
* airbrush or a pencil).
*
* \since This enum is available since SDL 3.0.0
*/
typedef enum SDL_PenSubtype
{
SDL_PEN_TYPE_UNKNOWN = 0,
SDL_PEN_TYPE_ERASER = 1, /**< Eraser */
SDL_PEN_TYPE_PEN, /**< Generic pen; this is the default. */
SDL_PEN_TYPE_PENCIL, /**< Pencil */
SDL_PEN_TYPE_BRUSH, /**< Brush-like device */
SDL_PEN_TYPE_AIRBRUSH, /**< Airbrush device that "sprays" ink */
SDL_PEN_TYPE_LAST = SDL_PEN_TYPE_AIRBRUSH /**< Last valid pen type */
} SDL_PenSubtype;
/* Function prototypes */
/**
* Retrieves all pens that are connected to the system.
*
* Yields an array of SDL_PenID values. These identify and track pens
* throughout a session. To track pens across sessions (program restart), use
* SDL_GUID .
*
* \param count the number of pens in the array (number of array elements
* minus 1, i.e., not counting the terminator 0).
* \returns a 0 terminated array of SDL_PenID values, or NULL on failure. The
* array must be freed with SDL_free(). On a NULL return,
* SDL_GetError() is set.
*
* \since This function is available since SDL 3.0.0.
*/
extern SDL_DECLSPEC SDL_PenID * SDLCALL SDL_GetPens(int *count);
/**
* Retrieves the pen's current status.
*
* If the pen is detached (cf. SDL_PenConnected), this operation may return
* default values.
*
* \param instance_id the pen to query.
* \param x out-mode parameter for pen x coordinate. May be NULL.
* \param y out-mode parameter for pen y coordinate. May be NULL.
* \param axes out-mode parameter for axis information. May be null. The axes
* are in the same order as SDL_PenAxis.
* \param num_axes maximum number of axes to write to "axes".
* \returns a bit mask with the current pen button states (SDL_BUTTON_LMASK
* etc.), possibly SDL_PEN_DOWN_MASK, and exactly one of
* SDL_PEN_INK_MASK or SDL_PEN_ERASER_MASK , or 0 on error (see
* SDL_GetError()).
*
* \since This function is available since SDL 3.0.0.
*/
extern SDL_DECLSPEC Uint32 SDLCALL SDL_GetPenStatus(SDL_PenID instance_id, float *x, float *y, float *axes, size_t num_axes);
/**
* Retrieves an SDL_PenID for the given SDL_GUID.
*
* \param guid a pen GUID.
* \returns a valid SDL_PenID, or SDL_PEN_INVALID if there is no matching
* SDL_PenID.
*
* \since This function is available since SDL 3.0.0.
*/
extern SDL_DECLSPEC SDL_PenID SDLCALL SDL_GetPenFromGUID(SDL_GUID guid);
/**
* Retrieves the SDL_GUID for a given SDL_PenID.
*
* \param instance_id the pen to query.
* \returns the corresponding pen GUID; persistent across multiple sessions.
* If "instance_id" is SDL_PEN_INVALID, returns an all-zeroes GUID.
*
* \since This function is available since SDL 3.0.0.
*/
extern SDL_DECLSPEC SDL_GUID SDLCALL SDL_GetPenGUID(SDL_PenID instance_id);
/**
* Checks whether a pen is still attached.
*
* If a pen is detached, it will not show up for SDL_GetPens(). Other
* operations will still be available but may return default values.
*
* \param instance_id a pen ID.
* \returns SDL_TRUE if "instance_id" is valid and the corresponding pen is
* attached, or SDL_FALSE otherwise.
*
* \since This function is available since SDL 3.0.0.
*/
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_PenConnected(SDL_PenID instance_id);
/**
* Retrieves a human-readable description for a SDL_PenID.
*
* \param instance_id the pen to query.
* \returns a string that contains the name of the pen, intended for human
* consumption. The string might or might not be localised, depending
* on platform settings. It is not guaranteed to be unique; use
* SDL_GetPenGUID() for (best-effort) unique identifiers. The pointer
* is managed by the SDL pen subsystem and must not be deallocated.
* The pointer remains valid until SDL is shut down. Returns NULL on
* error (cf. SDL_GetError()).
*
* \since This function is available since SDL 3.0.0.
*/
extern SDL_DECLSPEC const char * SDLCALL SDL_GetPenName(SDL_PenID instance_id);
/**
* Pen capabilities, as reported by SDL_GetPenCapabilities()
*
* \since This struct is available since SDL 3.0.0.
*/
typedef struct SDL_PenCapabilityInfo
{
float max_tilt; /**< Physical maximum tilt angle, for XTILT and YTILT, or SDL_PEN_INFO_UNKNOWN . Pens cannot typically tilt all the way to 90 degrees, so this value is usually less than 90.0. */
Uint32 wacom_id; /**< For Wacom devices: wacom tool type ID, otherwise 0 (useful e.g. with libwacom) */
Sint8 num_buttons; /**< Number of pen buttons (not counting the pen tip), or SDL_PEN_INFO_UNKNOWN */
} SDL_PenCapabilityInfo;
/**
* Retrieves capability flags for a given SDL_PenID.
*
* \param instance_id the pen to query.
* \param capabilities detail information about pen capabilities, such as the
* number of buttons.
* \returns a set of capability flags, cf. SDL_PEN_CAPABILITIES.
*
* \since This function is available since SDL 3.0.0.
*/
extern SDL_DECLSPEC SDL_PenCapabilityFlags SDLCALL SDL_GetPenCapabilities(SDL_PenID instance_id, SDL_PenCapabilityInfo *capabilities);
/**
* Retrieves the pen type for a given SDL_PenID.
*
* \param instance_id the pen to query.
* \returns the corresponding pen type (cf. SDL_PenSubtype) or 0 on error.
* Note that the pen type does not dictate whether the pen tip is
* SDL_PEN_TIP_INK or SDL_PEN_TIP_ERASER; to determine whether a pen
* is being used for drawing or in eraser mode, check either the pen
* tip on SDL_EVENT_PEN_DOWN, or the flag SDL_PEN_ERASER_MASK in the
* pen state.
*
* \since This function is available since SDL 3.0.0.
*/
extern SDL_DECLSPEC SDL_PenSubtype SDLCALL SDL_GetPenType(SDL_PenID instance_id);
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
}

View File

@ -742,8 +742,8 @@ extern SDL_DECLSPEC const char * SDLCALL SDL_GetPixelFormatName(SDL_PixelFormat
* \param Gmask a pointer filled in with the green mask for the format.
* \param Bmask a pointer filled in with the blue mask for the format.
* \param Amask a pointer filled in with the alpha mask for the format.
* \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.
*
* \threadsafety It is safe to call this function from any thread.
*
@ -751,7 +751,7 @@ extern SDL_DECLSPEC const char * SDLCALL SDL_GetPixelFormatName(SDL_PixelFormat
*
* \sa SDL_GetPixelFormatForMasks
*/
extern SDL_DECLSPEC int SDLCALL SDL_GetMasksForPixelFormat(SDL_PixelFormat format, int *bpp, Uint32 *Rmask, Uint32 *Gmask, Uint32 *Bmask, Uint32 *Amask);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetMasksForPixelFormat(SDL_PixelFormat format, int *bpp, Uint32 *Rmask, Uint32 *Gmask, Uint32 *Bmask, Uint32 *Amask);
/**
* Convert a bpp value and RGBA masks to an enumerated pixel format.
@ -819,15 +819,15 @@ extern SDL_DECLSPEC SDL_Palette * SDLCALL SDL_CreatePalette(int ncolors);
* \param colors an array of SDL_Color structures to copy into the palette.
* \param firstcolor the index of the first palette entry to modify.
* \param ncolors the number of entries to modify.
* \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.
*
* \threadsafety It is safe to call this function from any thread, as long as
* the palette is not modified or destroyed in another thread.
*
* \since This function is available since SDL 3.0.0.
*/
extern SDL_DECLSPEC int SDLCALL SDL_SetPaletteColors(SDL_Palette *palette, const SDL_Color *colors, int firstcolor, int ncolors);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetPaletteColors(SDL_Palette *palette, const SDL_Color *colors, int firstcolor, int ncolors);
/**
* Free a palette created with SDL_CreatePalette().
@ -874,6 +874,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_DestroyPalette(SDL_Palette *palette);
*
* \since This function is available since SDL 3.0.0.
*
* \sa SDL_GetPixelFormatDetails
* \sa SDL_GetRGB
* \sa SDL_MapRGBA
* \sa SDL_MapSurfaceRGB
@ -912,6 +913,7 @@ extern SDL_DECLSPEC Uint32 SDLCALL SDL_MapRGB(const SDL_PixelFormatDetails *form
*
* \since This function is available since SDL 3.0.0.
*
* \sa SDL_GetPixelFormatDetails
* \sa SDL_GetRGBA
* \sa SDL_MapRGB
* \sa SDL_MapSurfaceRGBA
@ -939,6 +941,7 @@ extern SDL_DECLSPEC Uint32 SDLCALL SDL_MapRGBA(const SDL_PixelFormatDetails *for
*
* \since This function is available since SDL 3.0.0.
*
* \sa SDL_GetPixelFormatDetails
* \sa SDL_GetRGBA
* \sa SDL_MapRGB
* \sa SDL_MapRGBA
@ -970,6 +973,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_GetRGB(Uint32 pixel, const SDL_PixelFormatD
*
* \since This function is available since SDL 3.0.0.
*
* \sa SDL_GetPixelFormatDetails
* \sa SDL_GetRGB
* \sa SDL_MapRGB
* \sa SDL_MapRGBA

View File

@ -116,14 +116,14 @@ extern SDL_DECLSPEC SDL_PropertiesID SDLCALL SDL_CreateProperties(void);
*
* \param src the properties to copy.
* \param dst the destination properties.
* \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.
*
* \threadsafety It is safe to call this function from any thread.
*
* \since This function is available since SDL 3.0.0.
*/
extern SDL_DECLSPEC int SDLCALL SDL_CopyProperties(SDL_PropertiesID src, SDL_PropertiesID dst);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_CopyProperties(SDL_PropertiesID src, SDL_PropertiesID dst);
/**
* Lock a group of properties.
@ -138,8 +138,8 @@ extern SDL_DECLSPEC int SDLCALL SDL_CopyProperties(SDL_PropertiesID src, SDL_Pro
* thread.
*
* \param props the properties to lock.
* \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.
*
* \threadsafety It is safe to call this function from any thread.
*
@ -147,7 +147,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_CopyProperties(SDL_PropertiesID src, SDL_Pro
*
* \sa SDL_UnlockProperties
*/
extern SDL_DECLSPEC int SDLCALL SDL_LockProperties(SDL_PropertiesID props);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_LockProperties(SDL_PropertiesID props);
/**
* Unlock a group of properties.
@ -204,8 +204,8 @@ typedef void (SDLCALL *SDL_CleanupPropertyCallback)(void *userdata, void *value)
* \param cleanup the function to call when this property is deleted, or NULL
* if no cleanup is necessary.
* \param userdata a pointer that is passed to the cleanup function.
* \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.
*
* \threadsafety It is safe to call this function from any thread.
*
@ -215,7 +215,7 @@ typedef void (SDLCALL *SDL_CleanupPropertyCallback)(void *userdata, void *value)
* \sa SDL_SetPointerProperty
* \sa SDL_CleanupPropertyCallback
*/
extern SDL_DECLSPEC int SDLCALL SDL_SetPointerPropertyWithCleanup(SDL_PropertiesID props, const char *name, void *value, SDL_CleanupPropertyCallback cleanup, void *userdata);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetPointerPropertyWithCleanup(SDL_PropertiesID props, const char *name, void *value, SDL_CleanupPropertyCallback cleanup, void *userdata);
/**
* Set a pointer property in a group of properties.
@ -223,8 +223,8 @@ extern SDL_DECLSPEC int SDLCALL SDL_SetPointerPropertyWithCleanup(SDL_Properties
* \param props the properties to modify.
* \param name the name of the property to modify.
* \param value the new value of the property, or NULL to delete the property.
* \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.
*
* \threadsafety It is safe to call this function from any thread.
*
@ -238,7 +238,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_SetPointerPropertyWithCleanup(SDL_Properties
* \sa SDL_SetPointerPropertyWithCleanup
* \sa SDL_SetStringProperty
*/
extern SDL_DECLSPEC int SDLCALL SDL_SetPointerProperty(SDL_PropertiesID props, const char *name, void *value);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetPointerProperty(SDL_PropertiesID props, const char *name, void *value);
/**
* Set a string property in a group of properties.
@ -249,8 +249,8 @@ extern SDL_DECLSPEC int SDLCALL SDL_SetPointerProperty(SDL_PropertiesID props, c
* \param props the properties to modify.
* \param name the name of the property to modify.
* \param value the new value of the property, or NULL to delete the property.
* \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.
*
* \threadsafety It is safe to call this function from any thread.
*
@ -258,7 +258,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_SetPointerProperty(SDL_PropertiesID props, c
*
* \sa SDL_GetStringProperty
*/
extern SDL_DECLSPEC int SDLCALL SDL_SetStringProperty(SDL_PropertiesID props, const char *name, const char *value);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetStringProperty(SDL_PropertiesID props, const char *name, const char *value);
/**
* Set an integer property in a group of properties.
@ -266,8 +266,8 @@ extern SDL_DECLSPEC int SDLCALL SDL_SetStringProperty(SDL_PropertiesID props, co
* \param props the properties to modify.
* \param name the name of the property to modify.
* \param value the new value of the property.
* \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.
*
* \threadsafety It is safe to call this function from any thread.
*
@ -275,7 +275,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_SetStringProperty(SDL_PropertiesID props, co
*
* \sa SDL_GetNumberProperty
*/
extern SDL_DECLSPEC int SDLCALL SDL_SetNumberProperty(SDL_PropertiesID props, const char *name, Sint64 value);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetNumberProperty(SDL_PropertiesID props, const char *name, Sint64 value);
/**
* Set a floating point property in a group of properties.
@ -283,8 +283,8 @@ extern SDL_DECLSPEC int SDLCALL SDL_SetNumberProperty(SDL_PropertiesID props, co
* \param props the properties to modify.
* \param name the name of the property to modify.
* \param value the new value of the property.
* \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.
*
* \threadsafety It is safe to call this function from any thread.
*
@ -292,7 +292,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_SetNumberProperty(SDL_PropertiesID props, co
*
* \sa SDL_GetFloatProperty
*/
extern SDL_DECLSPEC int SDLCALL SDL_SetFloatProperty(SDL_PropertiesID props, const char *name, float value);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetFloatProperty(SDL_PropertiesID props, const char *name, float value);
/**
* Set a boolean property in a group of properties.
@ -300,8 +300,8 @@ extern SDL_DECLSPEC int SDLCALL SDL_SetFloatProperty(SDL_PropertiesID props, con
* \param props the properties to modify.
* \param name the name of the property to modify.
* \param value the new value of the property.
* \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.
*
* \threadsafety It is safe to call this function from any thread.
*
@ -309,7 +309,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_SetFloatProperty(SDL_PropertiesID props, con
*
* \sa SDL_GetBooleanProperty
*/
extern SDL_DECLSPEC int SDLCALL SDL_SetBooleanProperty(SDL_PropertiesID props, const char *name, SDL_bool value);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetBooleanProperty(SDL_PropertiesID props, const char *name, SDL_bool value);
/**
* Return whether a property exists in a group of properties.
@ -470,14 +470,14 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetBooleanProperty(SDL_PropertiesID pro
*
* \param props the properties to modify.
* \param name the name of the property to clear.
* \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.
*
* \threadsafety It is safe to call this function from any thread.
*
* \since This function is available since SDL 3.0.0.
*/
extern SDL_DECLSPEC int SDLCALL SDL_ClearProperty(SDL_PropertiesID props, const char *name);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_ClearProperty(SDL_PropertiesID props, const char *name);
/**
* A callback used to enumerate all the properties in a group of properties.
@ -507,14 +507,14 @@ typedef void (SDLCALL *SDL_EnumeratePropertiesCallback)(void *userdata, SDL_Prop
* \param props the properties to query.
* \param callback the function to call for each property.
* \param userdata a pointer that is passed to `callback`.
* \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.
*
* \threadsafety It is safe to call this function from any thread.
*
* \since This function is available since SDL 3.0.0.
*/
extern SDL_DECLSPEC int SDLCALL SDL_EnumerateProperties(SDL_PropertiesID props, SDL_EnumeratePropertiesCallback callback, void *userdata);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_EnumerateProperties(SDL_PropertiesID props, SDL_EnumeratePropertiesCallback callback, void *userdata);
/**
* Destroy a group of properties.

View File

@ -221,8 +221,7 @@ SDL_FORCE_INLINE SDL_bool SDL_RectsEqual(const SDL_Rect *a, const SDL_Rect *b)
*
* \sa SDL_GetRectIntersection
*/
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_HasRectIntersection(const SDL_Rect * A,
const SDL_Rect * B);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_HasRectIntersection(const SDL_Rect *A, const SDL_Rect *B);
/**
* Calculate the intersection of two rectangles.
@ -239,9 +238,7 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_HasRectIntersection(const SDL_Rect * A,
*
* \sa SDL_HasRectIntersection
*/
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetRectIntersection(const SDL_Rect * A,
const SDL_Rect * B,
SDL_Rect * result);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetRectIntersection(const SDL_Rect *A, const SDL_Rect *B, SDL_Rect *result);
/**
* Calculate the union of two rectangles.
@ -250,14 +247,12 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetRectIntersection(const SDL_Rect * A,
* \param B an SDL_Rect structure representing the second rectangle.
* \param result an SDL_Rect structure filled in with the union of rectangles
* `A` and `B`.
* \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.
*/
extern SDL_DECLSPEC int SDLCALL SDL_GetRectUnion(const SDL_Rect * A,
const SDL_Rect * B,
SDL_Rect * result);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetRectUnion(const SDL_Rect *A, const SDL_Rect *B, SDL_Rect *result);
/**
* Calculate a minimal rectangle enclosing a set of points.
@ -276,10 +271,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_GetRectUnion(const SDL_Rect * A,
*
* \since This function is available since SDL 3.0.0.
*/
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetRectEnclosingPoints(const SDL_Point * points,
int count,
const SDL_Rect * clip,
SDL_Rect * result);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetRectEnclosingPoints(const SDL_Point *points, int count, const SDL_Rect *clip, SDL_Rect *result);
/**
* Calculate the intersection of a rectangle and line segment.
@ -299,10 +291,7 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetRectEnclosingPoints(const SDL_Point
*
* \since This function is available since SDL 3.0.0.
*/
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetRectAndLineIntersection(const SDL_Rect *
rect, int *X1,
int *Y1, int *X2,
int *Y2);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetRectAndLineIntersection(const SDL_Rect *rect, int *X1, int *Y1, int *X2, int *Y2);
/* SDL_FRect versions... */
@ -435,8 +424,7 @@ SDL_FORCE_INLINE SDL_bool SDL_RectsEqualFloat(const SDL_FRect *a, const SDL_FRec
*
* \sa SDL_GetRectIntersection
*/
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_HasRectIntersectionFloat(const SDL_FRect * A,
const SDL_FRect * B);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_HasRectIntersectionFloat(const SDL_FRect *A, const SDL_FRect *B);
/**
* Calculate the intersection of two rectangles with float precision.
@ -453,9 +441,7 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_HasRectIntersectionFloat(const SDL_FRec
*
* \sa SDL_HasRectIntersectionFloat
*/
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetRectIntersectionFloat(const SDL_FRect * A,
const SDL_FRect * B,
SDL_FRect * result);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetRectIntersectionFloat(const SDL_FRect *A, const SDL_FRect *B, SDL_FRect *result);
/**
* Calculate the union of two rectangles with float precision.
@ -464,14 +450,12 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetRectIntersectionFloat(const SDL_FRec
* \param B an SDL_FRect structure representing the second rectangle.
* \param result an SDL_FRect structure filled in with the union of rectangles
* `A` and `B`.
* \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.
*/
extern SDL_DECLSPEC int SDLCALL SDL_GetRectUnionFloat(const SDL_FRect * A,
const SDL_FRect * B,
SDL_FRect * result);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetRectUnionFloat(const SDL_FRect *A, const SDL_FRect *B, SDL_FRect *result);
/**
* Calculate a minimal rectangle enclosing a set of points with float
@ -491,10 +475,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_GetRectUnionFloat(const SDL_FRect * A,
*
* \since This function is available since SDL 3.0.0.
*/
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetRectEnclosingPointsFloat(const SDL_FPoint * points,
int count,
const SDL_FRect * clip,
SDL_FRect * result);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetRectEnclosingPointsFloat(const SDL_FPoint *points, int count, const SDL_FRect *clip, SDL_FRect *result);
/**
* Calculate the intersection of a rectangle and line segment with float
@ -515,10 +496,7 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetRectEnclosingPointsFloat(const SDL_F
*
* \since This function is available since SDL 3.0.0.
*/
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetRectAndLineIntersectionFloat(const SDL_FRect *
rect, float *X1,
float *Y1, float *X2,
float *Y2);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetRectAndLineIntersectionFloat(const SDL_FRect *rect, float *X1, float *Y1, float *X2, float *Y2);
/* Ends C function definitions when using C++ */
#ifdef __cplusplus

View File

@ -55,8 +55,7 @@ typedef struct SDL_Sensor SDL_Sensor;
* This is a unique ID for a sensor for the time it is connected to the
* system, and is never reused for the lifetime of the application.
*
* 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.
*/
@ -278,12 +277,12 @@ extern SDL_DECLSPEC SDL_SensorID SDLCALL SDL_GetSensorID(SDL_Sensor *sensor);
* \param sensor the SDL_Sensor object to query.
* \param data a pointer filled with the current sensor state.
* \param num_values the number of values to write to data.
* \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.
*/
extern SDL_DECLSPEC int SDLCALL SDL_GetSensorData(SDL_Sensor *sensor, float *data, int num_values);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetSensorData(SDL_Sensor *sensor, float *data, int num_values);
/**
* Close a sensor previously opened with SDL_OpenSensor().

View File

@ -36,6 +36,9 @@
#include <inttypes.h>
#endif
#include <stdarg.h>
#ifndef __cplusplus
#include <stdbool.h>
#endif
#include <stdint.h>
#include <string.h>
#include <wchar.h>
@ -191,7 +194,7 @@ void *alloca(size_t);
*
* \sa SDL_bool
*/
#define SDL_FALSE 0
#define SDL_FALSE false
/**
* A boolean true.
@ -200,7 +203,7 @@ void *alloca(size_t);
*
* \sa SDL_bool
*/
#define SDL_TRUE 1
#define SDL_TRUE true
/**
* A boolean type: true or false.
@ -210,7 +213,7 @@ void *alloca(size_t);
* \sa SDL_TRUE
* \sa SDL_FALSE
*/
typedef int SDL_bool;
typedef bool SDL_bool;
/**
* A signed 8-bit integer type.
@ -482,6 +485,7 @@ typedef Sint64 SDL_Time;
/** \cond */
#ifndef DOXYGEN_SHOULD_IGNORE_THIS
SDL_COMPILE_TIME_ASSERT(bool, sizeof(SDL_bool) == 1);
SDL_COMPILE_TIME_ASSERT(uint8, sizeof(Uint8) == 1);
SDL_COMPILE_TIME_ASSERT(sint8, sizeof(Sint8) == 1);
SDL_COMPILE_TIME_ASSERT(uint16, sizeof(Uint16) == 2);
@ -595,8 +599,8 @@ extern SDL_DECLSPEC void SDLCALL SDL_GetMemoryFunctions(SDL_malloc_func *malloc_
* \param calloc_func custom calloc function.
* \param realloc_func custom realloc function.
* \param free_func custom free function.
* \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.
*
* \threadsafety It is safe to call this function from any thread, but one
* should not replace the memory functions once any allocations
@ -607,10 +611,10 @@ extern SDL_DECLSPEC void SDLCALL SDL_GetMemoryFunctions(SDL_malloc_func *malloc_
* \sa SDL_GetMemoryFunctions
* \sa SDL_GetOriginalMemoryFunctions
*/
extern SDL_DECLSPEC int SDLCALL SDL_SetMemoryFunctions(SDL_malloc_func malloc_func,
SDL_calloc_func calloc_func,
SDL_realloc_func realloc_func,
SDL_free_func free_func);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetMemoryFunctions(SDL_malloc_func malloc_func,
SDL_calloc_func calloc_func,
SDL_realloc_func realloc_func,
SDL_free_func free_func);
/**
* Allocate memory aligned to a specific value.
@ -2899,14 +2903,78 @@ extern SDL_DECLSPEC float SDLCALL SDL_tanf(float x);
#define SDL_ICONV_EILSEQ (size_t)-3
#define SDL_ICONV_EINVAL (size_t)-4
/* SDL_iconv_* are now always real symbols/types, not macros or inlined. */
typedef struct SDL_iconv_data_t *SDL_iconv_t;
/**
* This function allocates a context for the specified character set
* conversion.
*
* \param tocode The target character encoding, must not be NULL.
* \param fromcode The source character encoding, must not be NULL.
* \returns a handle that must be freed with SDL_iconv_close, or
* SDL_ICONV_ERROR on failure.
*
* \since This function is available since SDL 3.0.0.
*
* \sa SDL_iconv
* \sa SDL_iconv_close
* \sa SDL_iconv_string
*/
extern SDL_DECLSPEC SDL_iconv_t SDLCALL SDL_iconv_open(const char *tocode,
const char *fromcode);
/**
* This function frees a context used for character set conversion.
*
* \param cd The character set conversion handle.
* \returns 0 on success, or -1 on failure.
*
* \since This function is available since SDL 3.0.0.
*
* \sa SDL_iconv
* \sa SDL_iconv_open
* \sa SDL_iconv_string
*/
extern SDL_DECLSPEC int SDLCALL SDL_iconv_close(SDL_iconv_t cd);
/**
* This function converts text between encodings, reading from and writing to
* a buffer.
*
* It returns the number of succesful conversions.
*
* \param cd The character set conversion context, created in
* SDL_iconv_open().
* \param inbuf Address of variable that points to the first character of the
* input sequence.
* \param inbytesleft The number of bytes in the input buffer.
* \param outbuf Address of variable that points to the output buffer.
* \param outbytesleft The number of bytes in the output buffer.
* \returns the number of conversions on success, else SDL_ICONV_E2BIG is
* returned when the output buffer is too small, or SDL_ICONV_EILSEQ
* is returned when an invalid input sequence is encountered, or
* SDL_ICONV_EINVAL is returned when an incomplete input sequence is
* encountered.
*
* On exit:
*
* - inbuf will point to the beginning of the next multibyte
* sequence. On error, this is the location of the problematic
* input sequence. On success, this is the end of the input
* sequence. - inbytesleft will be set to the number of bytes left
* to convert, which will be 0 on success. - outbuf will point to
* the location where to store the next output byte. - outbytesleft
* will be set to the number of bytes left in the output buffer.
*
* \since This function is available since SDL 3.0.0.
*
* \sa SDL_iconv_open
* \sa SDL_iconv_close
* \sa SDL_iconv_string
*/
extern SDL_DECLSPEC size_t SDLCALL SDL_iconv(SDL_iconv_t cd, const char **inbuf,
size_t * inbytesleft, char **outbuf,
size_t * outbytesleft);
size_t *inbytesleft, char **outbuf,
size_t *outbytesleft);
/**
* Helper function to convert a string's encoding in one call.
@ -2928,6 +2996,10 @@ extern SDL_DECLSPEC size_t SDLCALL SDL_iconv(SDL_iconv_t cd, const char **inbuf,
* \returns a new string, converted to the new encoding, or NULL on error.
*
* \since This function is available since SDL 3.0.0.
*
* \sa SDL_iconv_open
* \sa SDL_iconv_close
* \sa SDL_iconv
*/
extern SDL_DECLSPEC char * SDLCALL SDL_iconv_string(const char *tocode,
const char *fromcode,

View File

@ -57,34 +57,34 @@ extern "C" {
typedef struct SDL_StorageInterface
{
/* Called when the storage is closed */
int (SDLCALL *close)(void *userdata);
SDL_bool (SDLCALL *close)(void *userdata);
/* Optional, returns whether the storage is currently ready for access */
SDL_bool (SDLCALL *ready)(void *userdata);
/* Enumerate a directory, optional for write-only storage */
int (SDLCALL *enumerate)(void *userdata, const char *path, SDL_EnumerateDirectoryCallback callback, void *callback_userdata);
SDL_bool (SDLCALL *enumerate)(void *userdata, const char *path, SDL_EnumerateDirectoryCallback callback, void *callback_userdata);
/* Get path information, optional for write-only storage */
int (SDLCALL *info)(void *userdata, const char *path, SDL_PathInfo *info);
SDL_bool (SDLCALL *info)(void *userdata, const char *path, SDL_PathInfo *info);
/* Read a file from storage, optional for write-only storage */
int (SDLCALL *read_file)(void *userdata, const char *path, void *destination, Uint64 length);
SDL_bool (SDLCALL *read_file)(void *userdata, const char *path, void *destination, Uint64 length);
/* Write a file to storage, optional for read-only storage */
int (SDLCALL *write_file)(void *userdata, const char *path, const void *source, Uint64 length);
SDL_bool (SDLCALL *write_file)(void *userdata, const char *path, const void *source, Uint64 length);
/* Create a directory, optional for read-only storage */
int (SDLCALL *mkdir)(void *userdata, const char *path);
SDL_bool (SDLCALL *mkdir)(void *userdata, const char *path);
/* Remove a file or empty directory, optional for read-only storage */
int (SDLCALL *remove)(void *userdata, const char *path);
SDL_bool (SDLCALL *remove)(void *userdata, const char *path);
/* Rename a path, optional for read-only storage */
int (SDLCALL *rename)(void *userdata, const char *oldpath, const char *newpath);
SDL_bool (SDLCALL *rename)(void *userdata, const char *oldpath, const char *newpath);
/* Copy a file, optional for read-only storage */
int (SDLCALL *copy)(void *userdata, const char *oldpath, const char *newpath);
SDL_bool (SDLCALL *copy)(void *userdata, const char *oldpath, const char *newpath);
/* Get the space remaining, optional for read-only storage */
Uint64 (SDLCALL *space_remaining)(void *userdata);
@ -196,7 +196,7 @@ extern SDL_DECLSPEC SDL_Storage * SDLCALL SDL_OpenStorage(const SDL_StorageInter
* Closes and frees a storage container.
*
* \param storage a storage container to close.
* \returns 0 if the container was freed with no errors, a negative value
* \returns SDL_TRUE if the container was freed with no errors, SDL_FALSE
* otherwise; call SDL_GetError() for more information. Even if the
* function returns an error, the container data will be freed; the
* error is only for informational purposes.
@ -208,7 +208,7 @@ extern SDL_DECLSPEC SDL_Storage * SDLCALL SDL_OpenStorage(const SDL_StorageInter
* \sa SDL_OpenTitleStorage
* \sa SDL_OpenUserStorage
*/
extern SDL_DECLSPEC int SDLCALL SDL_CloseStorage(SDL_Storage *storage);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_CloseStorage(SDL_Storage *storage);
/**
* Checks if the storage container is ready to use.
@ -230,15 +230,15 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_StorageReady(SDL_Storage *storage);
* \param storage a storage container to query.
* \param path the relative path of the file to query.
* \param length a pointer to be filled with the file's length.
* \returns 0 if the file could be queried or a negative error code on
* failure; call SDL_GetError() for more information.
* \returns SDL_TRUE if the file could be queried or SDL_FALSE on failure;
* call SDL_GetError() for more information.
*
* \since This function is available since SDL 3.0.0.
*
* \sa SDL_ReadStorageFile
* \sa SDL_StorageReady
*/
extern SDL_DECLSPEC int SDLCALL SDL_GetStorageFileSize(SDL_Storage *storage, const char *path, Uint64 *length);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetStorageFileSize(SDL_Storage *storage, const char *path, Uint64 *length);
/**
* Synchronously read a file from a storage container into a client-provided
@ -248,7 +248,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_GetStorageFileSize(SDL_Storage *storage, con
* \param path the relative path of the file to read.
* \param destination a client-provided buffer to read the file into.
* \param length the length of the destination buffer.
* \returns 0 if the file was read or a negative error code on failure; call
* \returns SDL_TRUE if the file was read or SDL_FALSE on failure; call
* SDL_GetError() for more information.
*
* \since This function is available since SDL 3.0.0.
@ -257,7 +257,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_GetStorageFileSize(SDL_Storage *storage, con
* \sa SDL_StorageReady
* \sa SDL_WriteStorageFile
*/
extern SDL_DECLSPEC int SDLCALL SDL_ReadStorageFile(SDL_Storage *storage, const char *path, void *destination, Uint64 length);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_ReadStorageFile(SDL_Storage *storage, const char *path, void *destination, Uint64 length);
/**
* Synchronously write a file from client memory into a storage container.
@ -266,8 +266,8 @@ extern SDL_DECLSPEC int SDLCALL SDL_ReadStorageFile(SDL_Storage *storage, const
* \param path the relative path of the file to write.
* \param source a client-provided buffer to write from.
* \param length the length of the source buffer.
* \returns 0 if the file was written or a negative error code on failure;
* call SDL_GetError() for more information.
* \returns SDL_TRUE if the file was written or SDL_FALSE on failure; call
* SDL_GetError() for more information.
*
* \since This function is available since SDL 3.0.0.
*
@ -275,21 +275,21 @@ extern SDL_DECLSPEC int SDLCALL SDL_ReadStorageFile(SDL_Storage *storage, const
* \sa SDL_ReadStorageFile
* \sa SDL_StorageReady
*/
extern SDL_DECLSPEC int SDLCALL SDL_WriteStorageFile(SDL_Storage *storage, const char *path, const void *source, Uint64 length);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_WriteStorageFile(SDL_Storage *storage, const char *path, const void *source, Uint64 length);
/**
* Create a directory in a writable storage container.
*
* \param storage a storage container.
* \param path the path of the directory to create.
* \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_StorageReady
*/
extern SDL_DECLSPEC int SDLCALL SDL_CreateStorageDirectory(SDL_Storage *storage, const char *path);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_CreateStorageDirectory(SDL_Storage *storage, const char *path);
/**
* Enumerate a directory in a storage container through a callback function.
@ -302,28 +302,28 @@ extern SDL_DECLSPEC int SDLCALL SDL_CreateStorageDirectory(SDL_Storage *storage,
* \param path the path of the directory to enumerate.
* \param callback a function that is called for each entry in the directory.
* \param userdata a pointer that is passed to `callback`.
* \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_StorageReady
*/
extern SDL_DECLSPEC int SDLCALL SDL_EnumerateStorageDirectory(SDL_Storage *storage, const char *path, SDL_EnumerateDirectoryCallback callback, void *userdata);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_EnumerateStorageDirectory(SDL_Storage *storage, const char *path, SDL_EnumerateDirectoryCallback callback, void *userdata);
/**
* Remove a file or an empty directory in a writable storage container.
*
* \param storage a storage container.
* \param path the path of the directory to enumerate.
* \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_StorageReady
*/
extern SDL_DECLSPEC int SDLCALL SDL_RemoveStoragePath(SDL_Storage *storage, const char *path);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_RemoveStoragePath(SDL_Storage *storage, const char *path);
/**
* Rename a file or directory in a writable storage container.
@ -331,14 +331,14 @@ extern SDL_DECLSPEC int SDLCALL SDL_RemoveStoragePath(SDL_Storage *storage, cons
* \param storage a storage container.
* \param oldpath the old path.
* \param newpath the new path.
* \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_StorageReady
*/
extern SDL_DECLSPEC int SDLCALL SDL_RenameStoragePath(SDL_Storage *storage, const char *oldpath, const char *newpath);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_RenameStoragePath(SDL_Storage *storage, const char *oldpath, const char *newpath);
/**
* Copy a file in a writable storage container.
@ -346,14 +346,14 @@ extern SDL_DECLSPEC int SDLCALL SDL_RenameStoragePath(SDL_Storage *storage, cons
* \param storage a storage container.
* \param oldpath the old path.
* \param newpath the new path.
* \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_StorageReady
*/
extern SDL_DECLSPEC int SDLCALL SDL_CopyStorageFile(SDL_Storage *storage, const char *oldpath, const char *newpath);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_CopyStorageFile(SDL_Storage *storage, const char *oldpath, const char *newpath);
/**
* Get information about a filesystem path in a storage container.
@ -362,14 +362,14 @@ extern SDL_DECLSPEC int SDLCALL SDL_CopyStorageFile(SDL_Storage *storage, const
* \param path the path to query.
* \param info a pointer filled in with information about the path, or NULL to
* check for the existence of a file.
* \returns 0 on success or a negative error code if the file doesn't exist,
* or another failure; call SDL_GetError() for more information.
* \returns SDL_TRUE on success or SDL_FALSE if the file doesn't exist, or
* another failure; call SDL_GetError() for more information.
*
* \since This function is available since SDL 3.0.0.
*
* \sa SDL_StorageReady
*/
extern SDL_DECLSPEC int SDLCALL SDL_GetStoragePathInfo(SDL_Storage *storage, const char *path, SDL_PathInfo *info);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetStoragePathInfo(SDL_Storage *storage, const char *path, SDL_PathInfo *info);
/**
* Queries the remaining space in a storage container.

View File

@ -71,8 +71,7 @@ typedef Uint32 SDL_SurfaceFlags;
typedef enum SDL_ScaleMode
{
SDL_SCALEMODE_NEAREST, /**< nearest pixel sampling */
SDL_SCALEMODE_LINEAR, /**< linear filtering */
SDL_SCALEMODE_BEST /**< anisotropic filtering */
SDL_SCALEMODE_LINEAR /**< linear filtering */
} SDL_ScaleMode;
/**
@ -125,6 +124,8 @@ typedef struct SDL_Surface
/**
* Allocate a new surface with a specific pixel format.
*
* The pixels of the new surface are initialized to zero.
*
* \param width the width of the surface.
* \param height the height of the surface.
* \param format the SDL_PixelFormat for the new surface's pixel format.
@ -222,14 +223,14 @@ extern SDL_DECLSPEC SDL_PropertiesID SDLCALL SDL_GetSurfaceProperties(SDL_Surfac
* \param surface the SDL_Surface structure to update.
* \param colorspace an SDL_ColorSpace value describing the surface
* colorspace.
* \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_GetSurfaceColorspace
*/
extern SDL_DECLSPEC int SDLCALL SDL_SetSurfaceColorspace(SDL_Surface *surface, SDL_Colorspace colorspace);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetSurfaceColorspace(SDL_Surface *surface, SDL_Colorspace colorspace);
/**
* Get the colorspace used by a surface.
@ -283,15 +284,15 @@ extern SDL_DECLSPEC SDL_Palette * SDLCALL SDL_CreateSurfacePalette(SDL_Surface *
*
* \param surface the SDL_Surface structure to update.
* \param palette the SDL_Palette structure 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_CreatePalette
* \sa SDL_GetSurfacePalette
*/
extern SDL_DECLSPEC int SDLCALL SDL_SetSurfacePalette(SDL_Surface *surface, SDL_Palette *palette);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetSurfacePalette(SDL_Surface *surface, SDL_Palette *palette);
/**
* Get the palette used by a surface.
@ -320,8 +321,8 @@ extern SDL_DECLSPEC SDL_Palette * SDLCALL SDL_GetSurfacePalette(SDL_Surface *sur
* \param surface the SDL_Surface structure to update.
* \param image a pointer to an alternate SDL_Surface to associate with this
* surface.
* \returns SDL_TRUE if alternate versions are available or SDL_TRUE
* otherwise.
* \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.
*
@ -329,7 +330,7 @@ extern SDL_DECLSPEC SDL_Palette * SDLCALL SDL_GetSurfacePalette(SDL_Surface *sur
* \sa SDL_GetSurfaceImages
* \sa SDL_SurfaceHasAlternateImages
*/
extern SDL_DECLSPEC int SDLCALL SDL_AddSurfaceAlternateImage(SDL_Surface *surface, SDL_Surface *image);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_AddSurfaceAlternateImage(SDL_Surface *surface, SDL_Surface *image);
/**
* Return whether a surface has alternate versions available.
@ -400,15 +401,15 @@ extern SDL_DECLSPEC void SDLCALL SDL_RemoveSurfaceAlternateImages(SDL_Surface *s
* format of the surface will not change.
*
* \param surface the SDL_Surface structure to be locked.
* \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_MUSTLOCK
* \sa SDL_UnlockSurface
*/
extern SDL_DECLSPEC int SDLCALL SDL_LockSurface(SDL_Surface *surface);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_LockSurface(SDL_Surface *surface);
/**
* Release a surface after directly accessing the pixels.
@ -472,15 +473,15 @@ extern SDL_DECLSPEC SDL_Surface * SDLCALL SDL_LoadBMP(const char *file);
* \param dst a data stream to save to.
* \param closeio if SDL_TRUE, calls SDL_CloseIO() on `dst` before returning,
* even in the case of an error.
* \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_LoadBMP_IO
* \sa SDL_SaveBMP
*/
extern SDL_DECLSPEC int SDLCALL SDL_SaveBMP_IO(SDL_Surface *surface, SDL_IOStream *dst, SDL_bool closeio);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SaveBMP_IO(SDL_Surface *surface, SDL_IOStream *dst, SDL_bool closeio);
/**
* Save a surface to a file.
@ -493,15 +494,15 @@ extern SDL_DECLSPEC int SDLCALL SDL_SaveBMP_IO(SDL_Surface *surface, SDL_IOStrea
*
* \param surface the SDL_Surface structure containing the image to be saved.
* \param file a file to save to.
* \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_LoadBMP
* \sa SDL_SaveBMP_IO
*/
extern SDL_DECLSPEC int SDLCALL SDL_SaveBMP(SDL_Surface *surface, const char *file);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SaveBMP(SDL_Surface *surface, const char *file);
/**
* Set the RLE acceleration hint for a surface.
@ -512,8 +513,8 @@ extern SDL_DECLSPEC int SDLCALL SDL_SaveBMP(SDL_Surface *surface, const char *fi
* \param surface the SDL_Surface structure to optimize.
* \param enabled SDL_TRUE to enable RLE acceleration, SDL_FALSE to disable
* it.
* \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.
*
@ -521,7 +522,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_SaveBMP(SDL_Surface *surface, const char *fi
* \sa SDL_LockSurface
* \sa SDL_UnlockSurface
*/
extern SDL_DECLSPEC int SDLCALL SDL_SetSurfaceRLE(SDL_Surface *surface, SDL_bool enabled);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetSurfaceRLE(SDL_Surface *surface, SDL_bool enabled);
/**
* Returns whether the surface is RLE enabled.
@ -551,8 +552,8 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SurfaceHasRLE(SDL_Surface *surface);
* \param enabled SDL_TRUE to enable color key, SDL_FALSE to disable color
* key.
* \param key the transparent pixel.
* \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.
*
@ -560,7 +561,7 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SurfaceHasRLE(SDL_Surface *surface);
* \sa SDL_SetSurfaceRLE
* \sa SDL_SurfaceHasColorKey
*/
extern SDL_DECLSPEC int SDLCALL SDL_SetSurfaceColorKey(SDL_Surface *surface, SDL_bool enabled, Uint32 key);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetSurfaceColorKey(SDL_Surface *surface, SDL_bool enabled, Uint32 key);
/**
* Returns whether the surface has a color key.
@ -587,15 +588,15 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SurfaceHasColorKey(SDL_Surface *surface
*
* \param surface the SDL_Surface structure to query.
* \param key a pointer filled in with the transparent pixel.
* \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_SetSurfaceColorKey
* \sa SDL_SurfaceHasColorKey
*/
extern SDL_DECLSPEC int SDLCALL SDL_GetSurfaceColorKey(SDL_Surface *surface, Uint32 *key);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetSurfaceColorKey(SDL_Surface *surface, Uint32 *key);
/**
* Set an additional color value multiplied into blit operations.
@ -610,15 +611,15 @@ extern SDL_DECLSPEC int SDLCALL SDL_GetSurfaceColorKey(SDL_Surface *surface, Uin
* \param r the red color value multiplied into blit operations.
* \param g the green color value multiplied into blit operations.
* \param b the blue color value multiplied into blit operations.
* \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_GetSurfaceColorMod
* \sa SDL_SetSurfaceAlphaMod
*/
extern SDL_DECLSPEC int SDLCALL SDL_SetSurfaceColorMod(SDL_Surface *surface, Uint8 r, Uint8 g, Uint8 b);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetSurfaceColorMod(SDL_Surface *surface, Uint8 r, Uint8 g, Uint8 b);
/**
@ -628,15 +629,15 @@ extern SDL_DECLSPEC int SDLCALL SDL_SetSurfaceColorMod(SDL_Surface *surface, Uin
* \param r a pointer filled in with the current red color value.
* \param g a pointer filled in with the current green color value.
* \param b a pointer filled in with the current blue color value.
* \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_GetSurfaceAlphaMod
* \sa SDL_SetSurfaceColorMod
*/
extern SDL_DECLSPEC int SDLCALL SDL_GetSurfaceColorMod(SDL_Surface *surface, Uint8 *r, Uint8 *g, Uint8 *b);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetSurfaceColorMod(SDL_Surface *surface, Uint8 *r, Uint8 *g, Uint8 *b);
/**
* Set an additional alpha value used in blit operations.
@ -648,30 +649,30 @@ extern SDL_DECLSPEC int SDLCALL SDL_GetSurfaceColorMod(SDL_Surface *surface, Uin
*
* \param surface the SDL_Surface structure to update.
* \param alpha the alpha value multiplied into blit operations.
* \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_GetSurfaceAlphaMod
* \sa SDL_SetSurfaceColorMod
*/
extern SDL_DECLSPEC int SDLCALL SDL_SetSurfaceAlphaMod(SDL_Surface *surface, Uint8 alpha);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetSurfaceAlphaMod(SDL_Surface *surface, Uint8 alpha);
/**
* Get the additional alpha value used in blit operations.
*
* \param surface the SDL_Surface structure to query.
* \param alpha a pointer filled in with the current alpha value.
* \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_GetSurfaceColorMod
* \sa SDL_SetSurfaceAlphaMod
*/
extern SDL_DECLSPEC int SDLCALL SDL_GetSurfaceAlphaMod(SDL_Surface *surface, Uint8 *alpha);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetSurfaceAlphaMod(SDL_Surface *surface, Uint8 *alpha);
/**
* Set the blend mode used for blit operations.
@ -682,28 +683,28 @@ extern SDL_DECLSPEC int SDLCALL SDL_GetSurfaceAlphaMod(SDL_Surface *surface, Uin
*
* \param surface the SDL_Surface structure to update.
* \param blendMode the SDL_BlendMode to use for blit blending.
* \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_GetSurfaceBlendMode
*/
extern SDL_DECLSPEC int SDLCALL SDL_SetSurfaceBlendMode(SDL_Surface *surface, SDL_BlendMode blendMode);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetSurfaceBlendMode(SDL_Surface *surface, SDL_BlendMode blendMode);
/**
* Get the blend mode used for blit operations.
*
* \param surface the SDL_Surface structure to query.
* \param blendMode a pointer filled in with the current SDL_BlendMode.
* \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_SetSurfaceBlendMode
*/
extern SDL_DECLSPEC int SDLCALL SDL_GetSurfaceBlendMode(SDL_Surface *surface, SDL_BlendMode *blendMode);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetSurfaceBlendMode(SDL_Surface *surface, SDL_BlendMode *blendMode);
/**
* Set the clipping rectangle for a surface.
@ -736,26 +737,26 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetSurfaceClipRect(SDL_Surface *surface
* clipped.
* \param rect an SDL_Rect structure filled in with the clipping rectangle for
* the surface.
* \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_SetSurfaceClipRect
*/
extern SDL_DECLSPEC int SDLCALL SDL_GetSurfaceClipRect(SDL_Surface *surface, SDL_Rect *rect);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetSurfaceClipRect(SDL_Surface *surface, SDL_Rect *rect);
/**
* Flip a surface vertically or horizontally.
*
* \param surface the surface to flip.
* \param flip the direction to flip.
* \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.
*/
extern SDL_DECLSPEC int SDLCALL SDL_FlipSurface(SDL_Surface *surface, SDL_FlipMode flip);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_FlipSurface(SDL_Surface *surface, SDL_FlipMode flip);
/**
* Creates a new surface identical to the existing surface.
@ -858,14 +859,14 @@ extern SDL_DECLSPEC SDL_Surface * SDLCALL SDL_ConvertSurfaceAndColorspace(SDL_Su
* \param dst_format an SDL_PixelFormat value of the `dst` pixels format.
* \param dst a pointer to be filled in with new pixel data.
* \param dst_pitch the pitch of the destination pixels, in bytes.
* \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information.
* \returns SDL_FALSE 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_ConvertPixelsAndColorspace
*/
extern SDL_DECLSPEC int SDLCALL SDL_ConvertPixels(int width, int height, SDL_PixelFormat src_format, const void *src, int src_pitch, SDL_PixelFormat dst_format, void *dst, int dst_pitch);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_ConvertPixels(int width, int height, SDL_PixelFormat src_format, const void *src, int src_pitch, SDL_PixelFormat dst_format, void *dst, int dst_pitch);
/**
* Copy a block of pixels of one format and colorspace to another format and
@ -887,14 +888,14 @@ extern SDL_DECLSPEC int SDLCALL SDL_ConvertPixels(int width, int height, SDL_Pix
* properties, or 0.
* \param dst a pointer to be filled in with new pixel data.
* \param dst_pitch the pitch of the destination pixels, in bytes.
* \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information.
* \returns SDL_FALSE 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_ConvertPixels
*/
extern SDL_DECLSPEC int SDLCALL SDL_ConvertPixelsAndColorspace(int width, int height, SDL_PixelFormat src_format, SDL_Colorspace src_colorspace, SDL_PropertiesID src_properties, const void *src, int src_pitch, SDL_PixelFormat dst_format, SDL_Colorspace dst_colorspace, SDL_PropertiesID dst_properties, void *dst, int dst_pitch);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_ConvertPixelsAndColorspace(int width, int height, SDL_PixelFormat src_format, SDL_Colorspace src_colorspace, SDL_PropertiesID src_properties, const void *src, int src_pitch, SDL_PixelFormat dst_format, SDL_Colorspace dst_colorspace, SDL_PropertiesID dst_properties, void *dst, int dst_pitch);
/**
* Premultiply the alpha on a block of pixels.
@ -911,12 +912,12 @@ extern SDL_DECLSPEC int SDLCALL SDL_ConvertPixelsAndColorspace(int width, int he
* \param dst_pitch the pitch of the destination pixels, in bytes.
* \param linear SDL_TRUE to convert from sRGB to linear space for the alpha
* multiplication, SDL_FALSE to do multiplication in sRGB space.
* \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.
*/
extern SDL_DECLSPEC int SDLCALL SDL_PremultiplyAlpha(int width, int height, SDL_PixelFormat src_format, const void *src, int src_pitch, SDL_PixelFormat dst_format, void *dst, int dst_pitch, SDL_bool linear);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_PremultiplyAlpha(int width, int height, SDL_PixelFormat src_format, const void *src, int src_pitch, SDL_PixelFormat dst_format, void *dst, int dst_pitch, SDL_bool linear);
/**
* Premultiply the alpha in a surface.
@ -926,12 +927,12 @@ extern SDL_DECLSPEC int SDLCALL SDL_PremultiplyAlpha(int width, int height, SDL_
* \param surface the surface to modify.
* \param linear SDL_TRUE to convert from sRGB to linear space for the alpha
* multiplication, SDL_FALSE to do multiplication in sRGB space.
* \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.
*/
extern SDL_DECLSPEC int SDLCALL SDL_PremultiplySurfaceAlpha(SDL_Surface *surface, SDL_bool linear);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_PremultiplySurfaceAlpha(SDL_Surface *surface, SDL_bool linear);
/**
* Clear a surface with a specific color, with floating point precision.
@ -946,12 +947,12 @@ extern SDL_DECLSPEC int SDLCALL SDL_PremultiplySurfaceAlpha(SDL_Surface *surface
* \param g the green component of the pixel, normally in the range 0-1.
* \param b the blue component of the pixel, normally in the range 0-1.
* \param a the alpha component of the pixel, normally in the range 0-1.
* \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.
*/
extern SDL_DECLSPEC int SDLCALL SDL_ClearSurface(SDL_Surface *surface, float r, float g, float b, float a);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_ClearSurface(SDL_Surface *surface, float r, float g, float b, float a);
/**
* Perform a fast fill of a rectangle with a specific color.
@ -969,14 +970,14 @@ extern SDL_DECLSPEC int SDLCALL SDL_ClearSurface(SDL_Surface *surface, float r,
* \param rect the SDL_Rect structure representing the rectangle to fill, or
* NULL to fill the entire surface.
* \param color the color to fill with.
* \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_FillSurfaceRects
*/
extern SDL_DECLSPEC int SDLCALL SDL_FillSurfaceRect(SDL_Surface *dst, const SDL_Rect *rect, Uint32 color);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_FillSurfaceRect(SDL_Surface *dst, const SDL_Rect *rect, Uint32 color);
/**
* Perform a fast fill of a set of rectangles with a specific color.
@ -994,14 +995,14 @@ extern SDL_DECLSPEC int SDLCALL SDL_FillSurfaceRect(SDL_Surface *dst, const SDL_
* \param rects an array of SDL_Rects representing the rectangles to fill.
* \param count the number of rectangles in the array.
* \param color the color to fill with.
* \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_FillSurfaceRect
*/
extern SDL_DECLSPEC int SDLCALL SDL_FillSurfaceRects(SDL_Surface *dst, const SDL_Rect *rects, int count, Uint32 color);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_FillSurfaceRects(SDL_Surface *dst, const SDL_Rect *rects, int count, Uint32 color);
/**
* Performs a fast blit from the source surface to the destination surface.
@ -1065,8 +1066,8 @@ extern SDL_DECLSPEC int SDLCALL SDL_FillSurfaceRects(SDL_Surface *dst, const SDL
* height are ignored, and are copied from `srcrect`. If you
* want a specific width and height, you should use
* SDL_BlitSurfaceScaled().
* \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.
*
* \threadsafety The same destination surface should not be used from two
* threads at once. It is safe to use the same source surface
@ -1076,7 +1077,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_FillSurfaceRects(SDL_Surface *dst, const SDL
*
* \sa SDL_BlitSurfaceScaled
*/
extern SDL_DECLSPEC int SDLCALL SDL_BlitSurface(SDL_Surface *src, const SDL_Rect *srcrect, SDL_Surface *dst, const SDL_Rect *dstrect);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_BlitSurface(SDL_Surface *src, const SDL_Rect *srcrect, SDL_Surface *dst, const SDL_Rect *dstrect);
/**
* Perform low-level surface blitting only.
@ -1090,8 +1091,8 @@ extern SDL_DECLSPEC int SDLCALL SDL_BlitSurface(SDL_Surface *src, const SDL_Rect
* \param dst the SDL_Surface structure that is the blit target.
* \param dstrect the SDL_Rect structure representing the target rectangle in
* the destination surface, may not be NULL.
* \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.
*
* \threadsafety The same destination surface should not be used from two
* threads at once. It is safe to use the same source surface
@ -1101,7 +1102,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_BlitSurface(SDL_Surface *src, const SDL_Rect
*
* \sa SDL_BlitSurface
*/
extern SDL_DECLSPEC int SDLCALL SDL_BlitSurfaceUnchecked(SDL_Surface *src, const SDL_Rect *srcrect, SDL_Surface *dst, const SDL_Rect *dstrect);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_BlitSurfaceUnchecked(SDL_Surface *src, const SDL_Rect *srcrect, SDL_Surface *dst, const SDL_Rect *dstrect);
/**
* Perform a scaled blit to a destination surface, which may be of a different
@ -1115,8 +1116,8 @@ extern SDL_DECLSPEC int SDLCALL SDL_BlitSurfaceUnchecked(SDL_Surface *src, const
* the destination surface, or NULL to fill the entire
* destination surface.
* \param scaleMode the SDL_ScaleMode to be used.
* \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.
*
* \threadsafety The same destination surface should not be used from two
* threads at once. It is safe to use the same source surface
@ -1126,7 +1127,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_BlitSurfaceUnchecked(SDL_Surface *src, const
*
* \sa SDL_BlitSurface
*/
extern SDL_DECLSPEC int SDLCALL SDL_BlitSurfaceScaled(SDL_Surface *src, const SDL_Rect *srcrect, SDL_Surface *dst, const SDL_Rect *dstrect, SDL_ScaleMode scaleMode);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_BlitSurfaceScaled(SDL_Surface *src, const SDL_Rect *srcrect, SDL_Surface *dst, const SDL_Rect *dstrect, SDL_ScaleMode scaleMode);
/**
* Perform low-level surface scaled blitting only.
@ -1141,8 +1142,8 @@ extern SDL_DECLSPEC int SDLCALL SDL_BlitSurfaceScaled(SDL_Surface *src, const SD
* \param dstrect the SDL_Rect structure representing the target rectangle in
* the destination surface, may not be NULL.
* \param scaleMode the SDL_ScaleMode to be used.
* \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.
*
* \threadsafety The same destination surface should not be used from two
* threads at once. It is safe to use the same source surface
@ -1152,7 +1153,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_BlitSurfaceScaled(SDL_Surface *src, const SD
*
* \sa SDL_BlitSurfaceScaled
*/
extern SDL_DECLSPEC int SDLCALL SDL_BlitSurfaceUncheckedScaled(SDL_Surface *src, const SDL_Rect *srcrect, SDL_Surface *dst, const SDL_Rect *dstrect, SDL_ScaleMode scaleMode);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_BlitSurfaceUncheckedScaled(SDL_Surface *src, const SDL_Rect *srcrect, SDL_Surface *dst, const SDL_Rect *dstrect, SDL_ScaleMode scaleMode);
/**
* Perform a tiled blit to a destination surface, which may be of a different
@ -1167,8 +1168,8 @@ extern SDL_DECLSPEC int SDLCALL SDL_BlitSurfaceUncheckedScaled(SDL_Surface *src,
* \param dst the SDL_Surface structure that is the blit target.
* \param dstrect the SDL_Rect structure representing the target rectangle in
* the destination surface, or NULL to fill the entire surface.
* \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.
*
* \threadsafety The same destination surface should not be used from two
* threads at once. It is safe to use the same source surface
@ -1178,7 +1179,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_BlitSurfaceUncheckedScaled(SDL_Surface *src,
*
* \sa SDL_BlitSurface
*/
extern SDL_DECLSPEC int SDLCALL SDL_BlitSurfaceTiled(SDL_Surface *src, const SDL_Rect *srcrect, SDL_Surface *dst, const SDL_Rect *dstrect);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_BlitSurfaceTiled(SDL_Surface *src, const SDL_Rect *srcrect, SDL_Surface *dst, const SDL_Rect *dstrect);
/**
* Perform a scaled and tiled blit to a destination surface, which may be of a
@ -1197,8 +1198,8 @@ extern SDL_DECLSPEC int SDLCALL SDL_BlitSurfaceTiled(SDL_Surface *src, const SDL
* \param dst the SDL_Surface structure that is the blit target.
* \param dstrect the SDL_Rect structure representing the target rectangle in
* the destination surface, or NULL to fill the entire surface.
* \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.
*
* \threadsafety The same destination surface should not be used from two
* threads at once. It is safe to use the same source surface
@ -1208,7 +1209,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_BlitSurfaceTiled(SDL_Surface *src, const SDL
*
* \sa SDL_BlitSurface
*/
extern SDL_DECLSPEC int SDLCALL SDL_BlitSurfaceTiledWithScale(SDL_Surface *src, const SDL_Rect *srcrect, float scale, SDL_ScaleMode scaleMode, SDL_Surface *dst, const SDL_Rect *dstrect);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_BlitSurfaceTiledWithScale(SDL_Surface *src, const SDL_Rect *srcrect, float scale, SDL_ScaleMode scaleMode, SDL_Surface *dst, const SDL_Rect *dstrect);
/**
* Perform a scaled blit using the 9-grid algorithm to a destination surface,
@ -1234,8 +1235,8 @@ extern SDL_DECLSPEC int SDLCALL SDL_BlitSurfaceTiledWithScale(SDL_Surface *src,
* \param dst the SDL_Surface structure that is the blit target.
* \param dstrect the SDL_Rect structure representing the target rectangle in
* the destination surface, or NULL to fill the entire surface.
* \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.
*
* \threadsafety The same destination surface should not be used from two
* threads at once. It is safe to use the same source surface
@ -1245,7 +1246,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_BlitSurfaceTiledWithScale(SDL_Surface *src,
*
* \sa SDL_BlitSurface
*/
extern SDL_DECLSPEC int SDLCALL SDL_BlitSurface9Grid(SDL_Surface *src, const SDL_Rect *srcrect, int left_width, int right_width, int top_height, int bottom_height, float scale, SDL_ScaleMode scaleMode, SDL_Surface *dst, const SDL_Rect *dstrect);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_BlitSurface9Grid(SDL_Surface *src, const SDL_Rect *srcrect, int left_width, int right_width, int top_height, int bottom_height, float scale, SDL_ScaleMode scaleMode, SDL_Surface *dst, const SDL_Rect *dstrect);
/**
* Map an RGB triple to an opaque pixel value for a surface.
@ -1328,12 +1329,12 @@ extern SDL_DECLSPEC Uint32 SDLCALL SDL_MapSurfaceRGBA(SDL_Surface *surface, Uint
* ignore this channel.
* \param a a pointer filled in with the alpha channel, 0-255, or NULL to
* ignore this channel.
* \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.
*/
extern SDL_DECLSPEC int SDLCALL SDL_ReadSurfacePixel(SDL_Surface *surface, int x, int y, Uint8 *r, Uint8 *g, Uint8 *b, Uint8 *a);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_ReadSurfacePixel(SDL_Surface *surface, int x, int y, Uint8 *r, Uint8 *g, Uint8 *b, Uint8 *a);
/**
* Retrieves a single pixel from a surface.
@ -1352,12 +1353,12 @@ extern SDL_DECLSPEC int SDLCALL SDL_ReadSurfacePixel(SDL_Surface *surface, int x
* 0-1, or NULL to ignore this channel.
* \param a a pointer filled in with the alpha channel, normally in the range
* 0-1, or NULL to ignore this channel.
* \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.
*/
extern SDL_DECLSPEC int SDLCALL SDL_ReadSurfacePixelFloat(SDL_Surface *surface, int x, int y, float *r, float *g, float *b, float *a);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_ReadSurfacePixelFloat(SDL_Surface *surface, int x, int y, float *r, float *g, float *b, float *a);
/**
* Writes a single pixel to a surface.
@ -1375,12 +1376,12 @@ extern SDL_DECLSPEC int SDLCALL SDL_ReadSurfacePixelFloat(SDL_Surface *surface,
* \param g the green channel value, 0-255.
* \param b the blue channel value, 0-255.
* \param a the alpha channel value, 0-255.
* \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.
*/
extern SDL_DECLSPEC int SDLCALL SDL_WriteSurfacePixel(SDL_Surface *surface, int x, int y, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_WriteSurfacePixel(SDL_Surface *surface, int x, int y, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
/**
* Writes a single pixel to a surface.
@ -1395,12 +1396,12 @@ extern SDL_DECLSPEC int SDLCALL SDL_WriteSurfacePixel(SDL_Surface *surface, int
* \param g the green channel value, normally in the range 0-1.
* \param b the blue channel value, normally in the range 0-1.
* \param a the alpha channel value, normally in the range 0-1.
* \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.
*/
extern SDL_DECLSPEC int SDLCALL SDL_WriteSurfacePixelFloat(SDL_Surface *surface, int x, int y, float r, float g, float b, float a);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_WriteSurfacePixelFloat(SDL_Surface *surface, int x, int y, float r, float g, float b, float a);
/* Ends C function definitions when using C++ */
#ifdef __cplusplus

View File

@ -101,8 +101,8 @@ extern SDL_DECLSPEC void SDLCALL SDL_SetWindowsMessageHook(SDL_WindowsMessageHoo
* controls on which monitor a full screen application will appear.
*
* \param displayID the instance of the display to query.
* \returns the D3D9 adapter index on success or a negative error code on
* failure; call SDL_GetError() for more information.
* \returns the D3D9 adapter index on success or -1 on failure; call
* SDL_GetError() for more information.
*
* \since This function is available since SDL 3.0.0.
*/
@ -122,12 +122,12 @@ extern SDL_DECLSPEC int SDLCALL SDL_GetDirect3D9AdapterIndex(SDL_DisplayID displ
* \param displayID the instance of the display to query.
* \param adapterIndex a pointer to be filled in with the adapter index.
* \param outputIndex a pointer to be filled in with the output index.
* \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.
*/
extern SDL_DECLSPEC int SDLCALL SDL_GetDXGIOutputInfo(SDL_DisplayID displayID, int *adapterIndex, int *outputIndex);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetDXGIOutputInfo(SDL_DisplayID displayID, int *adapterIndex, int *outputIndex);
#endif /* defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_WINGDK) */
@ -162,12 +162,12 @@ extern SDL_DECLSPEC void SDLCALL SDL_SetX11EventHook(SDL_X11EventHook callback,
*
* \param threadID the Unix thread ID to change priority of.
* \param priority the new, Unix-specific, priority value.
* \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.
*/
extern SDL_DECLSPEC int SDLCALL SDL_SetLinuxThreadPriority(Sint64 threadID, int priority);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetLinuxThreadPriority(Sint64 threadID, int priority);
/**
* Sets the priority (not nice level) and scheduling policy for a thread.
@ -178,12 +178,12 @@ extern SDL_DECLSPEC int SDLCALL SDL_SetLinuxThreadPriority(Sint64 threadID, int
* \param sdlPriority the new SDL_ThreadPriority value.
* \param schedPolicy the new scheduling policy (SCHED_FIFO, SCHED_RR,
* SCHED_OTHER, etc...).
* \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.
*/
extern SDL_DECLSPEC int SDLCALL SDL_SetLinuxThreadPriorityAndPolicy(Sint64 threadID, int sdlPriority, int schedPolicy);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetLinuxThreadPriorityAndPolicy(Sint64 threadID, int sdlPriority, int schedPolicy);
#endif /* SDL_PLATFORM_LINUX */
@ -240,14 +240,14 @@ typedef void (SDLCALL *SDL_iOSAnimationCallback)(void *userdata);
* called.
* \param callback the function to call for every frame.
* \param callbackParam a pointer that is passed to `callback`.
* \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_SetiOSEventPump
*/
extern SDL_DECLSPEC int SDLCALL SDL_SetiOSAnimationCallback(SDL_Window *window, int interval, SDL_iOSAnimationCallback callback, void *callbackParam);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetiOSAnimationCallback(SDL_Window *window, int interval, SDL_iOSAnimationCallback callback, void *callbackParam);
/**
* Use this function to enable or disable the SDL event pump on Apple iOS.
@ -503,15 +503,15 @@ typedef void (SDLCALL *SDL_RequestAndroidPermissionCallback)(void *userdata, con
* \param permission the permission to request.
* \param cb the callback to trigger when the request has a response.
* \param userdata an app-controlled pointer that is passed to the callback.
* \returns zero if the request was submitted, -1 if there was an error
* submitting. The result of the request is only ever reported
* \returns SDL_TRUE if the request was submitted, SDL_FALSE if there was an
* error submitting. The result of the request is only ever reported
* through the callback, not this return value.
*
* \threadsafety It is safe to call this function from any thread.
*
* \since This function is available since SDL 3.0.0.
*/
extern SDL_DECLSPEC int SDLCALL SDL_RequestAndroidPermission(const char *permission, SDL_RequestAndroidPermissionCallback cb, void *userdata);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_RequestAndroidPermission(const char *permission, SDL_RequestAndroidPermissionCallback cb, void *userdata);
/**
* Shows an Android toast notification.
@ -532,14 +532,14 @@ extern SDL_DECLSPEC int SDLCALL SDL_RequestAndroidPermission(const char *permiss
* \param gravity where the notification should appear on the screen.
* \param xoffset set this parameter only when gravity >=0.
* \param yoffset set this parameter only when gravity >=0.
* \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.
*
* \threadsafety It is safe to call this function from any thread.
*
* \since This function is available since SDL 3.0.0.
*/
extern SDL_DECLSPEC int SDLCALL SDL_ShowAndroidToast(const char *message, int duration, int gravity, int xoffset, int yoffset);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_ShowAndroidToast(const char *message, int duration, int gravity, int xoffset, int yoffset);
/**
* Send a user command to SDLActivity.
@ -548,14 +548,14 @@ extern SDL_DECLSPEC int SDLCALL SDL_ShowAndroidToast(const char *message, int du
*
* \param command user command that must be greater or equal to 0x8000.
* \param param user parameter.
* \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.
*
* \threadsafety It is safe to call this function from any thread.
*
* \since This function is available since SDL 3.0.0.
*/
extern SDL_DECLSPEC int SDLCALL SDL_SendAndroidMessage(Uint32 command, int param);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SendAndroidMessage(Uint32 command, int param);
#endif /* SDL_PLATFORM_ANDROID */
@ -794,12 +794,12 @@ typedef struct XUser *XUserHandle;
* leak.
*
* \param outTaskQueue a pointer to be filled in with task queue handle.
* \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.
*/
extern SDL_DECLSPEC int SDLCALL SDL_GetGDKTaskQueue(XTaskQueueHandle *outTaskQueue);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetGDKTaskQueue(XTaskQueueHandle *outTaskQueue);
/**
* Gets a reference to the default user handle for GDK.
@ -809,12 +809,12 @@ extern SDL_DECLSPEC int SDLCALL SDL_GetGDKTaskQueue(XTaskQueueHandle *outTaskQue
*
* \param outUserHandle a pointer to be filled in with the default user
* handle.
* \returns 0 if success or a negative error code on failure; call
* SDL_GetError() for more information.
* \returns SDL_TRUE if success or SDL_FALSE on failure; call SDL_GetError()
* for more information.
*
* \since This function is available since SDL 3.0.0.
*/
extern SDL_DECLSPEC int SDLCALL SDL_GetGDKDefaultUser(XUserHandle *outUserHandle);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetGDKDefaultUser(XUserHandle *outUserHandle);
#endif

View File

@ -252,10 +252,10 @@ extern SDL_DECLSPEC SDL_Thread * SDLCALL SDL_CreateThread(SDL_ThreadFunction fn,
*/
extern SDL_DECLSPEC SDL_Thread * SDLCALL SDL_CreateThreadWithProperties(SDL_PropertiesID props);
#define SDL_PROP_THREAD_CREATE_ENTRY_FUNCTION_POINTER "entry_function"
#define SDL_PROP_THREAD_CREATE_NAME_STRING "name"
#define SDL_PROP_THREAD_CREATE_USERDATA_POINTER "userdata"
#define SDL_PROP_THREAD_CREATE_STACKSIZE_NUMBER "stacksize"
#define SDL_PROP_THREAD_CREATE_ENTRY_FUNCTION_POINTER "SDL.thread.create.entry_function"
#define SDL_PROP_THREAD_CREATE_NAME_STRING "SDL.thread.create.name"
#define SDL_PROP_THREAD_CREATE_USERDATA_POINTER "SDL.thread.create.userdata"
#define SDL_PROP_THREAD_CREATE_STACKSIZE_NUMBER "SDL.thread.create.stacksize"
/* end wiki documentation for macros that are meant to look like functions. */
#endif
@ -320,10 +320,10 @@ extern SDL_DECLSPEC SDL_Thread * SDLCALL SDL_CreateThreadWithPropertiesRuntime(S
#define SDL_CreateThread(fn, name, data) SDL_CreateThreadRuntime((fn), (name), (data), (SDL_FunctionPointer) (SDL_BeginThreadFunction), (SDL_FunctionPointer) (SDL_EndThreadFunction))
#define SDL_CreateThreadWithProperties(props) SDL_CreateThreadWithPropertiesRuntime((props), (SDL_FunctionPointer) (SDL_BeginThreadFunction), (SDL_FunctionPointer) (SDL_EndThreadFunction))
#define SDL_PROP_THREAD_CREATE_ENTRY_FUNCTION_POINTER "entry_function"
#define SDL_PROP_THREAD_CREATE_NAME_STRING "name"
#define SDL_PROP_THREAD_CREATE_USERDATA_POINTER "userdata"
#define SDL_PROP_THREAD_CREATE_STACKSIZE_NUMBER "stacksize"
#define SDL_PROP_THREAD_CREATE_ENTRY_FUNCTION_POINTER "SDL.thread.create.entry_function"
#define SDL_PROP_THREAD_CREATE_NAME_STRING "SDL.thread.create.name"
#define SDL_PROP_THREAD_CREATE_USERDATA_POINTER "SDL.thread.create.userdata"
#define SDL_PROP_THREAD_CREATE_STACKSIZE_NUMBER "SDL.thread.create.stacksize"
#endif
@ -381,12 +381,12 @@ extern SDL_DECLSPEC SDL_ThreadID SDLCALL SDL_GetThreadID(SDL_Thread *thread);
* an administrator account. Be prepared for this to fail.
*
* \param priority the SDL_ThreadPriority to set.
* \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.
*/
extern SDL_DECLSPEC int SDLCALL SDL_SetThreadPriority(SDL_ThreadPriority priority);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetThreadPriority(SDL_ThreadPriority priority);
/**
* Wait for a thread to finish.
@ -504,8 +504,8 @@ typedef void (SDLCALL *SDL_TLSDestructorCallback)(void *value);
* \param value the value to associate with the ID for the current thread.
* \param destructor a function called when the thread exits, to free the
* value, may be NULL.
* \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.
*
* \threadsafety It is safe to call this function from any thread.
*
@ -513,7 +513,7 @@ typedef void (SDLCALL *SDL_TLSDestructorCallback)(void *value);
*
* \sa SDL_GetTLS
*/
extern SDL_DECLSPEC int SDLCALL SDL_SetTLS(SDL_TLSID *id, const void *value, SDL_TLSDestructorCallback destructor);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetTLS(SDL_TLSID *id, const void *value, SDL_TLSDestructorCallback destructor);
/**
* Cleanup all TLS data for this thread.

View File

@ -95,24 +95,24 @@ typedef enum SDL_TimeFormat
* format, may be NULL.
* \param timeFormat a pointer to the SDL_TimeFormat to hold the returned time
* format, may be NULL.
* \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.
*/
extern SDL_DECLSPEC int SDLCALL SDL_GetDateTimeLocalePreferences(SDL_DateFormat *dateFormat, SDL_TimeFormat *timeFormat);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetDateTimeLocalePreferences(SDL_DateFormat *dateFormat, SDL_TimeFormat *timeFormat);
/**
* Gets the current value of the system realtime clock in nanoseconds since
* Jan 1, 1970 in Universal Coordinated Time (UTC).
*
* \param ticks the SDL_Time to hold the returned tick count.
* \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.
*/
extern SDL_DECLSPEC int SDLCALL SDL_GetCurrentTime(SDL_Time *ticks);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetCurrentTime(SDL_Time *ticks);
/**
* Converts an SDL_Time in nanoseconds since the epoch to a calendar time in
@ -123,12 +123,12 @@ extern SDL_DECLSPEC int SDLCALL SDL_GetCurrentTime(SDL_Time *ticks);
* \param localTime the resulting SDL_DateTime will be expressed in local time
* if true, otherwise it will be in Universal Coordinated
* Time (UTC).
* \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.
*/
extern SDL_DECLSPEC int SDLCALL SDL_TimeToDateTime(SDL_Time ticks, SDL_DateTime *dt, SDL_bool localTime);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_TimeToDateTime(SDL_Time ticks, SDL_DateTime *dt, SDL_bool localTime);
/**
* Converts a calendar time to an SDL_Time in nanoseconds since the epoch.
@ -138,12 +138,12 @@ extern SDL_DECLSPEC int SDLCALL SDL_TimeToDateTime(SDL_Time ticks, SDL_DateTime
*
* \param dt the source SDL_DateTime.
* \param ticks the resulting SDL_Time.
* \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.
*/
extern SDL_DECLSPEC int SDLCALL SDL_DateTimeToTime(const SDL_DateTime *dt, SDL_Time *ticks);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_DateTimeToTime(const SDL_DateTime *dt, SDL_Time *ticks);
/**
* Converts an SDL time into a Windows FILETIME (100-nanosecond intervals
@ -181,8 +181,8 @@ extern SDL_DECLSPEC SDL_Time SDLCALL SDL_TimeFromWindows(Uint32 dwLowDateTime, U
*
* \param year the year.
* \param month the month [1-12].
* \returns the number of days in the requested month or a negative error code
* on failure; call SDL_GetError() for more information.
* \returns the number of days in the requested month or -1 on failure; call
* SDL_GetError() for more information.
*
* \since This function is available since SDL 3.0.0.
*/
@ -194,8 +194,8 @@ extern SDL_DECLSPEC int SDLCALL SDL_GetDaysInMonth(int year, int month);
* \param year the year component of the date.
* \param month the month component of the date.
* \param day the day component of the date.
* \returns the day of year [0-365] if the date is valid or a negative error
* code on failure; call SDL_GetError() for more information.
* \returns the day of year [0-365] if the date is valid or -1 on failure;
* call SDL_GetError() for more information.
*
* \since This function is available since SDL 3.0.0.
*/
@ -207,9 +207,8 @@ extern SDL_DECLSPEC int SDLCALL SDL_GetDayOfYear(int year, int month, int day);
* \param year the year component of the date.
* \param month the month component of the date.
* \param day the day component of the date.
* \returns a value between 0 and 6 (0 being Sunday) if the date is valid or a
* negative error code on failure; call SDL_GetError() for more
* information.
* \returns a value between 0 and 6 (0 being Sunday) if the date is valid or
* -1 on failure; call SDL_GetError() for more information.
*
* \since This function is available since SDL 3.0.0.
*/

View File

@ -137,7 +137,8 @@ typedef Uint32 SDL_TimerID;
* The callback function is passed the current timer interval and returns the
* next timer interval, in milliseconds. If the returned value is the same as
* the one passed in, the periodic alarm continues, otherwise a new alarm is
* scheduled. If the callback returns 0, the periodic alarm is cancelled.
* scheduled. If the callback returns 0, the periodic alarm is canceled and
* will be removed.
*
* \param userdata an arbitrary pointer provided by the app through
* SDL_AddTimer, for its own use.
@ -164,7 +165,7 @@ typedef Uint32 (SDLCALL *SDL_TimerCallback)(void *userdata, SDL_TimerID timerID,
* The callback function is passed the current timer interval and the user
* supplied parameter from the SDL_AddTimer() call and should return the next
* timer interval. If the value returned from the callback is 0, the timer is
* canceled.
* canceled and will be removed.
*
* The callback is run on a separate thread, and for short timeouts can
* potentially be called before this function returns.
@ -200,7 +201,8 @@ extern SDL_DECLSPEC SDL_TimerID SDLCALL SDL_AddTimer(Uint32 interval, SDL_TimerC
* The callback function is passed the current timer interval and returns the
* next timer interval, in nanoseconds. If the returned value is the same as
* the one passed in, the periodic alarm continues, otherwise a new alarm is
* scheduled. If the callback returns 0, the periodic alarm is cancelled.
* scheduled. If the callback returns 0, the periodic alarm is canceled and
* will be removed.
*
* \param userdata an arbitrary pointer provided by the app through
* SDL_AddTimer, for its own use.
@ -227,7 +229,7 @@ typedef Uint64 (SDLCALL *SDL_NSTimerCallback)(void *userdata, SDL_TimerID timerI
* The callback function is passed the current timer interval and the user
* supplied parameter from the SDL_AddTimerNS() call and should return the
* next timer interval. If the value returned from the callback is 0, the
* timer is canceled.
* timer is canceled and will be removed.
*
* The callback is run on a separate thread, and for short timeouts can
* potentially be called before this function returns.
@ -261,14 +263,14 @@ extern SDL_DECLSPEC SDL_TimerID SDLCALL SDL_AddTimerNS(Uint64 interval, SDL_NSTi
* Remove a timer created with SDL_AddTimer().
*
* \param id the ID of the timer to remove.
* \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_AddTimer
*/
extern SDL_DECLSPEC int SDLCALL SDL_RemoveTimer(SDL_TimerID id);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_RemoveTimer(SDL_TimerID id);
/* Ends C function definitions when using C++ */

View File

@ -95,15 +95,15 @@ struct VkAllocationCallbacks;
* library version.
*
* \param path the platform dependent Vulkan loader library name or NULL.
* \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_Vulkan_GetVkGetInstanceProcAddr
* \sa SDL_Vulkan_UnloadLibrary
*/
extern SDL_DECLSPEC int SDLCALL SDL_Vulkan_LoadLibrary(const char *path);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_Vulkan_LoadLibrary(const char *path);
/**
* Get the address of the `vkGetInstanceProcAddr` function.
@ -175,18 +175,18 @@ extern SDL_DECLSPEC char const * const * SDLCALL SDL_Vulkan_GetInstanceExtension
* allocator that creates the surface. Can be NULL.
* \param surface a pointer to a VkSurfaceKHR handle to output the newly
* created surface.
* \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_Vulkan_GetInstanceExtensions
* \sa SDL_Vulkan_DestroySurface
*/
extern SDL_DECLSPEC int SDLCALL SDL_Vulkan_CreateSurface(SDL_Window *window,
VkInstance instance,
const struct VkAllocationCallbacks *allocator,
VkSurfaceKHR* surface);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_Vulkan_CreateSurface(SDL_Window *window,
VkInstance instance,
const struct VkAllocationCallbacks *allocator,
VkSurfaceKHR* surface);
/**
* Destroy the Vulkan rendering surface of a window.

View File

@ -0,0 +1,68 @@
#!/bin/bash
set -x
set -e
cd `dirname "$0"`
shadernames=(FullscreenVert BlitFrom2D BlitFrom2DArray BlitFrom3D BlitFromCube)
generate_shaders()
{
fileplatform=$1
compileplatform=$2
sdkplatform=$3
minversion=$4
for shadername in "${shadernames[@]}"; do
xcrun -sdk $sdkplatform metal -c -std=$compileplatform-metal1.1 -m$sdkplatform-version-min=$minversion -Wall -O3 -D COMPILE_$shadername -o ./$shadername.air ./Metal_Blit.metal || exit $?
xcrun -sdk $sdkplatform metallib -o $shadername.metallib $shadername.air || exit $?
xxd -i $shadername.metallib | perl -w -p -e 's/\Aunsigned /const unsigned /;' >./${shadername}_$fileplatform.h
rm -f $shadername.air $shadername.metallib
done
}
generate_shaders macos macos macosx 10.11
generate_shaders ios ios iphoneos 8.0
generate_shaders iphonesimulator ios iphonesimulator 8.0
generate_shaders tvos ios appletvos 9.0
generate_shaders tvsimulator ios appletvsimulator 9.0
# Bundle together one mega-header
catShaders()
{
target=$1
for shadername in "${shadernames[@]}"; do
cat ${shadername}_$target.h >> Metal_Blit.h
done
}
rm -f Metal_Blit.h
echo "#if defined(SDL_PLATFORM_IOS)" >> Metal_Blit.h
echo "#if TARGET_OS_SIMULATOR" >> Metal_Blit.h
catShaders iphonesimulator
echo "#else" >> Metal_Blit.h
catShaders ios
echo "#endif" >> Metal_Blit.h
echo "#elif defined(SDL_PLATFORM_TVOS)" >> Metal_Blit.h
echo "#if TARGET_OS_SIMULATOR" >> Metal_Blit.h
catShaders tvsimulator
echo "#else" >> Metal_Blit.h
catShaders tvos
echo "#endif" >> Metal_Blit.h
echo "#else" >> Metal_Blit.h
catShaders macos
echo "#endif" >> Metal_Blit.h
# Clean up
cleanupShaders()
{
target=$1
for shadername in "${shadernames[@]}"; do
rm -f ${shadername}_$target.h
done
}
cleanupShaders iphonesimulator
cleanupShaders ios
cleanupShaders tvsimulator
cleanupShaders tvos
cleanupShaders macos

View File

@ -43,6 +43,7 @@
#include <SDL3/SDL_events.h>
#include <SDL3/SDL_filesystem.h>
#include <SDL3/SDL_gamepad.h>
#include <SDL3/SDL_gpu.h>
#include <SDL3/SDL_guid.h>
#include <SDL3/SDL_haptic.h>
#include <SDL3/SDL_hidapi.h>

View File

@ -303,9 +303,6 @@ extern SDL_DECLSPEC SDL_AssertState SDLCALL SDL_ReportAssertion(SDL_AssertData *
* "break" so that your debugger takes control as soon as assert is triggered,
* instead of risking a bad UI interaction (deadlock, etc) in the application.
*
* Note that SDL_ASSERT is an _environment variable_ and not an SDL hint!
* Please refer to your platform's documentation for how to set it!
*
* \param condition boolean value to test.
*
* \since This macro is available since SDL 3.0.0.
@ -335,9 +332,7 @@ extern SDL_DECLSPEC SDL_AssertState SDLCALL SDL_ReportAssertion(SDL_AssertData *
* an assertion in a background thread, it might be desirable to set this to
* "break" so that your debugger takes control as soon as assert is triggered,
* instead of risking a bad UI interaction (deadlock, etc) in the application.
*
* Note that SDL_ASSERT is an _environment variable_ and not an SDL hint!
* Please refer to your platform's documentation for how to set it!
* *
*
* \param condition boolean value to test.
*
@ -366,18 +361,14 @@ extern SDL_DECLSPEC SDL_AssertState SDLCALL SDL_ReportAssertion(SDL_AssertData *
* "break" so that your debugger takes control as soon as assert is triggered,
* instead of risking a bad UI interaction (deadlock, etc) in the application.
*
* Note that SDL_ASSERT is an _environment variable_ and not an SDL hint!
* Please refer to your platform's documentation for how to set it!
*
* \param condition boolean value to test.
*
* \since This macro is available since SDL 3.0.0.
*/
#define SDL_assert_paranoid(condition) SDL_disabled_assert(condition)
#endif
/* Enable various levels of assertions. */
#if SDL_ASSERT_LEVEL == 0 /* assertions disabled */
#elif SDL_ASSERT_LEVEL == 0 /* assertions disabled */
# define SDL_assert(condition) SDL_disabled_assert(condition)
# define SDL_assert_release(condition) SDL_disabled_assert(condition)
# define SDL_assert_paranoid(condition) SDL_disabled_assert(condition)
@ -412,9 +403,6 @@ extern SDL_DECLSPEC SDL_AssertState SDLCALL SDL_ReportAssertion(SDL_AssertData *
* "break" so that your debugger takes control as soon as assert is triggered,
* instead of risking a bad UI interaction (deadlock, etc) in the application.
*
* Note that SDL_ASSERT is an _environment variable_ and not an SDL hint!
* Please refer to your platform's documentation for how to set it!
*
* \param condition boolean value to test.
*
* \since This macro is available since SDL 3.0.0.

View File

@ -455,8 +455,8 @@ extern SDL_DECLSPEC int SDLCALL SDL_AtomicAdd(SDL_AtomicInt *a, int v);
* \since This function is available since SDL 3.0.0.
*
* \sa SDL_AtomicCompareAndSwap
* \sa SDL_AtomicGetPtr
* \sa SDL_AtomicSetPtr
* \sa SDL_AtomicGetPointer
* \sa SDL_AtomicSetPointer
*/
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_AtomicCompareAndSwapPointer(void **a, void *oldval, void *newval);
@ -475,9 +475,9 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_AtomicCompareAndSwapPointer(void **a, v
* \since This function is available since SDL 3.0.0.
*
* \sa SDL_AtomicCompareAndSwapPointer
* \sa SDL_AtomicGetPtr
* \sa SDL_AtomicGetPointer
*/
extern SDL_DECLSPEC void * SDLCALL SDL_AtomicSetPtr(void **a, void *v);
extern SDL_DECLSPEC void * SDLCALL SDL_AtomicSetPointer(void **a, void *v);
/**
* Get the value of a pointer atomically.
@ -493,9 +493,9 @@ extern SDL_DECLSPEC void * SDLCALL SDL_AtomicSetPtr(void **a, void *v);
* \since This function is available since SDL 3.0.0.
*
* \sa SDL_AtomicCompareAndSwapPointer
* \sa SDL_AtomicSetPtr
* \sa SDL_AtomicSetPointer
*/
extern SDL_DECLSPEC void * SDLCALL SDL_AtomicGetPtr(void **a);
extern SDL_DECLSPEC void * SDLCALL SDL_AtomicGetPointer(void **a);
/* Ends C function definitions when using C++ */
#ifdef __cplusplus

View File

@ -127,6 +127,7 @@ extern "C" {
*/
typedef enum SDL_AudioFormat
{
SDL_AUDIO_UNKNOWN = 0x0000u, /**< Unspecified audio format */
SDL_AUDIO_U8 = 0x0008u, /**< Unsigned 8-bit samples */
/* SDL_DEFINE_AUDIO_FORMAT(0, 0, 0, 8), */
SDL_AUDIO_S8 = 0x8008u, /**< Signed 8-bit samples */
@ -531,14 +532,14 @@ extern SDL_DECLSPEC const char * SDLCALL SDL_GetAudioDeviceName(SDL_AudioDeviceI
* \param spec on return, will be filled with device details.
* \param sample_frames pointer to store device buffer size, in sample frames.
* Can be NULL.
* \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.
*
* \threadsafety It is safe to call this function from any thread.
*
* \since This function is available since SDL 3.0.0.
*/
extern SDL_DECLSPEC int SDLCALL SDL_GetAudioDeviceFormat(SDL_AudioDeviceID devid, SDL_AudioSpec *spec, int *sample_frames);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetAudioDeviceFormat(SDL_AudioDeviceID devid, SDL_AudioSpec *spec, int *sample_frames);
/**
* Get the current channel map of an audio device.
@ -658,8 +659,8 @@ extern SDL_DECLSPEC SDL_AudioDeviceID SDLCALL SDL_OpenAudioDevice(SDL_AudioDevic
* created through SDL_OpenAudioDevice() can be.
*
* \param dev a device opened by SDL_OpenAudioDevice().
* \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.
*
* \threadsafety It is safe to call this function from any thread.
*
@ -668,7 +669,7 @@ extern SDL_DECLSPEC SDL_AudioDeviceID SDLCALL SDL_OpenAudioDevice(SDL_AudioDevic
* \sa SDL_ResumeAudioDevice
* \sa SDL_AudioDevicePaused
*/
extern SDL_DECLSPEC int SDLCALL SDL_PauseAudioDevice(SDL_AudioDeviceID dev);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_PauseAudioDevice(SDL_AudioDeviceID dev);
/**
* Use this function to unpause audio playback on a specified device.
@ -686,8 +687,8 @@ extern SDL_DECLSPEC int SDLCALL SDL_PauseAudioDevice(SDL_AudioDeviceID dev);
* created through SDL_OpenAudioDevice() can be.
*
* \param dev a device opened by SDL_OpenAudioDevice().
* \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.
*
* \threadsafety It is safe to call this function from any thread.
*
@ -696,7 +697,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_PauseAudioDevice(SDL_AudioDeviceID dev);
* \sa SDL_AudioDevicePaused
* \sa SDL_PauseAudioDevice
*/
extern SDL_DECLSPEC int SDLCALL SDL_ResumeAudioDevice(SDL_AudioDeviceID dev);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_ResumeAudioDevice(SDL_AudioDeviceID dev);
/**
* Use this function to query if an audio device is paused.
@ -766,8 +767,8 @@ extern SDL_DECLSPEC float SDLCALL SDL_GetAudioDeviceGain(SDL_AudioDeviceID devid
*
* \param devid the audio device on which to change gain.
* \param gain the gain. 1.0f is no change, 0.0f is silence.
* \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.
*
* \threadsafety It is safe to call this function from any thread, as it holds
* a stream-specific mutex while running.
@ -776,7 +777,7 @@ extern SDL_DECLSPEC float SDLCALL SDL_GetAudioDeviceGain(SDL_AudioDeviceID devid
*
* \sa SDL_GetAudioDeviceGain
*/
extern SDL_DECLSPEC int SDLCALL SDL_SetAudioDeviceGain(SDL_AudioDeviceID devid, float gain);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetAudioDeviceGain(SDL_AudioDeviceID devid, float gain);
/**
* Close a previously-opened audio device.
@ -823,8 +824,8 @@ extern SDL_DECLSPEC void SDLCALL SDL_CloseAudioDevice(SDL_AudioDeviceID devid);
* \param devid an audio device to bind a stream to.
* \param streams an array of audio streams to bind.
* \param num_streams number streams listed in the `streams` array.
* \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.
*
* \threadsafety It is safe to call this function from any thread.
*
@ -834,7 +835,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_CloseAudioDevice(SDL_AudioDeviceID devid);
* \sa SDL_UnbindAudioStream
* \sa SDL_GetAudioStreamDevice
*/
extern SDL_DECLSPEC int SDLCALL SDL_BindAudioStreams(SDL_AudioDeviceID devid, SDL_AudioStream **streams, int num_streams);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_BindAudioStreams(SDL_AudioDeviceID devid, SDL_AudioStream **streams, int num_streams);
/**
* Bind a single audio stream to an audio device.
@ -844,8 +845,8 @@ extern SDL_DECLSPEC int SDLCALL SDL_BindAudioStreams(SDL_AudioDeviceID devid, SD
*
* \param devid an audio device to bind a stream to.
* \param stream an audio stream to bind to a device.
* \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.
*
* \threadsafety It is safe to call this function from any thread.
*
@ -855,7 +856,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_BindAudioStreams(SDL_AudioDeviceID devid, SD
* \sa SDL_UnbindAudioStream
* \sa SDL_GetAudioStreamDevice
*/
extern SDL_DECLSPEC int SDLCALL SDL_BindAudioStream(SDL_AudioDeviceID devid, SDL_AudioStream *stream);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_BindAudioStream(SDL_AudioDeviceID devid, SDL_AudioStream *stream);
/**
* Unbind a list of audio streams from their audio devices.
@ -952,8 +953,8 @@ extern SDL_DECLSPEC SDL_PropertiesID SDLCALL SDL_GetAudioStreamProperties(SDL_Au
* \param stream the SDL_AudioStream to query.
* \param src_spec where to store the input audio format; ignored if NULL.
* \param dst_spec where to store the output audio format; ignored if NULL.
* \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.
*
* \threadsafety It is safe to call this function from any thread, as it holds
* a stream-specific mutex while running.
@ -962,9 +963,7 @@ extern SDL_DECLSPEC SDL_PropertiesID SDLCALL SDL_GetAudioStreamProperties(SDL_Au
*
* \sa SDL_SetAudioStreamFormat
*/
extern SDL_DECLSPEC int SDLCALL SDL_GetAudioStreamFormat(SDL_AudioStream *stream,
SDL_AudioSpec *src_spec,
SDL_AudioSpec *dst_spec);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetAudioStreamFormat(SDL_AudioStream *stream, SDL_AudioSpec *src_spec, SDL_AudioSpec *dst_spec);
/**
* Change the input and output formats of an audio stream.
@ -984,8 +983,8 @@ extern SDL_DECLSPEC int SDLCALL SDL_GetAudioStreamFormat(SDL_AudioStream *stream
* changed.
* \param dst_spec the new format of the audio output; if NULL, it is not
* changed.
* \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.
*
* \threadsafety It is safe to call this function from any thread, as it holds
* a stream-specific mutex while running.
@ -995,9 +994,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_GetAudioStreamFormat(SDL_AudioStream *stream
* \sa SDL_GetAudioStreamFormat
* \sa SDL_SetAudioStreamFrequencyRatio
*/
extern SDL_DECLSPEC int SDLCALL SDL_SetAudioStreamFormat(SDL_AudioStream *stream,
const SDL_AudioSpec *src_spec,
const SDL_AudioSpec *dst_spec);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetAudioStreamFormat(SDL_AudioStream *stream, const SDL_AudioSpec *src_spec, const SDL_AudioSpec *dst_spec);
/**
* Get the frequency ratio of an audio stream.
@ -1030,8 +1027,8 @@ extern SDL_DECLSPEC float SDLCALL SDL_GetAudioStreamFrequencyRatio(SDL_AudioStre
* \param stream the stream the frequency ratio is being changed.
* \param ratio the frequency ratio. 1.0 is normal speed. Must be between 0.01
* and 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.
*
* \threadsafety It is safe to call this function from any thread, as it holds
* a stream-specific mutex while running.
@ -1041,7 +1038,7 @@ extern SDL_DECLSPEC float SDLCALL SDL_GetAudioStreamFrequencyRatio(SDL_AudioStre
* \sa SDL_GetAudioStreamFrequencyRatio
* \sa SDL_SetAudioStreamFormat
*/
extern SDL_DECLSPEC int SDLCALL SDL_SetAudioStreamFrequencyRatio(SDL_AudioStream *stream, float ratio);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetAudioStreamFrequencyRatio(SDL_AudioStream *stream, float ratio);
/**
* Get the gain of an audio stream.
@ -1077,8 +1074,8 @@ extern SDL_DECLSPEC float SDLCALL SDL_GetAudioStreamGain(SDL_AudioStream *stream
*
* \param stream the stream on which the gain is being changed.
* \param gain the gain. 1.0f is no change, 0.0f is silence.
* \returns 0 on successor 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.
*
* \threadsafety It is safe to call this function from any thread, as it holds
* a stream-specific mutex while running.
@ -1087,7 +1084,7 @@ extern SDL_DECLSPEC float SDLCALL SDL_GetAudioStreamGain(SDL_AudioStream *stream
*
* \sa SDL_GetAudioStreamGain
*/
extern SDL_DECLSPEC int SDLCALL SDL_SetAudioStreamGain(SDL_AudioStream *stream, float gain);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetAudioStreamGain(SDL_AudioStream *stream, float gain);
/**
* Get the current input channel map of an audio stream.
@ -1174,8 +1171,8 @@ extern SDL_DECLSPEC int * SDLCALL SDL_GetAudioStreamOutputChannelMap(SDL_AudioSt
* \param stream the SDL_AudioStream to change.
* \param chmap the new channel map, NULL to reset to default.
* \param count The number of channels in the map.
* \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.
*
* \threadsafety It is safe to call this function from any thread, as it holds
* a stream-specific mutex while running. Don't change the
@ -1186,7 +1183,7 @@ extern SDL_DECLSPEC int * SDLCALL SDL_GetAudioStreamOutputChannelMap(SDL_AudioSt
*
* \sa SDL_SetAudioStreamInputChannelMap
*/
extern SDL_DECLSPEC int SDLCALL SDL_SetAudioStreamInputChannelMap(SDL_AudioStream *stream, const int *chmap, int count);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetAudioStreamInputChannelMap(SDL_AudioStream *stream, const int *chmap, int count);
/**
* Set the current output channel map of an audio stream.
@ -1221,8 +1218,8 @@ extern SDL_DECLSPEC int SDLCALL SDL_SetAudioStreamInputChannelMap(SDL_AudioStrea
* \param stream the SDL_AudioStream to change.
* \param chmap the new channel map, NULL to reset to default.
* \param count The number of channels in the map.
* \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.
*
* \threadsafety It is safe to call this function from any thread, as it holds
* a stream-specific mutex while running. Don't change the
@ -1233,7 +1230,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_SetAudioStreamInputChannelMap(SDL_AudioStrea
*
* \sa SDL_SetAudioStreamInputChannelMap
*/
extern SDL_DECLSPEC int SDLCALL SDL_SetAudioStreamOutputChannelMap(SDL_AudioStream *stream, const int *chmap, int count);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetAudioStreamOutputChannelMap(SDL_AudioStream *stream, const int *chmap, int count);
/**
* Add data to the stream.
@ -1249,8 +1246,8 @@ extern SDL_DECLSPEC int SDLCALL SDL_SetAudioStreamOutputChannelMap(SDL_AudioStre
* \param stream the stream the audio data is being added to.
* \param buf a pointer to the audio data to add.
* \param len the number of bytes to write to the stream.
* \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.
*
* \threadsafety It is safe to call this function from any thread, but if the
* stream has a callback set, the caller might need to manage
@ -1263,7 +1260,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_SetAudioStreamOutputChannelMap(SDL_AudioStre
* \sa SDL_GetAudioStreamData
* \sa SDL_GetAudioStreamQueued
*/
extern SDL_DECLSPEC int SDLCALL SDL_PutAudioStreamData(SDL_AudioStream *stream, const void *buf, int len);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_PutAudioStreamData(SDL_AudioStream *stream, const void *buf, int len);
/**
* Get converted/resampled data from the stream.
@ -1280,8 +1277,8 @@ extern SDL_DECLSPEC int SDLCALL SDL_PutAudioStreamData(SDL_AudioStream *stream,
* \param stream the stream the audio is being requested from.
* \param buf a buffer to fill with audio data.
* \param len the maximum number of bytes to fill.
* \returns the number of bytes read from the stream or a negative error code
* on failure; call SDL_GetError() for more information.
* \returns the number of bytes read from the stream or -1 on failure; call
* SDL_GetError() for more information.
*
* \threadsafety It is safe to call this function from any thread, but if the
* stream has a callback set, the caller might need to manage
@ -1309,7 +1306,8 @@ extern SDL_DECLSPEC int SDLCALL SDL_GetAudioStreamData(SDL_AudioStream *stream,
* clamped.
*
* \param stream the audio stream to query.
* \returns the number of converted/resampled bytes available.
* \returns the number of converted/resampled bytes available or -1 on
* failure; call SDL_GetError() for more information.
*
* \threadsafety It is safe to call this function from any thread.
*
@ -1341,7 +1339,8 @@ extern SDL_DECLSPEC int SDLCALL SDL_GetAudioStreamAvailable(SDL_AudioStream *str
* clamped.
*
* \param stream the audio stream to query.
* \returns the number of bytes queued.
* \returns the number of bytes queued or -1 on failure; call SDL_GetError()
* for more information.
*
* \threadsafety It is safe to call this function from any thread.
*
@ -1362,8 +1361,8 @@ extern SDL_DECLSPEC int SDLCALL SDL_GetAudioStreamQueued(SDL_AudioStream *stream
* input, so the complete output becomes available.
*
* \param stream the audio stream to flush.
* \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.
*
* \threadsafety It is safe to call this function from any thread.
*
@ -1371,7 +1370,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_GetAudioStreamQueued(SDL_AudioStream *stream
*
* \sa SDL_PutAudioStreamData
*/
extern SDL_DECLSPEC int SDLCALL SDL_FlushAudioStream(SDL_AudioStream *stream);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_FlushAudioStream(SDL_AudioStream *stream);
/**
* Clear any pending data in the stream.
@ -1380,8 +1379,8 @@ extern SDL_DECLSPEC int SDLCALL SDL_FlushAudioStream(SDL_AudioStream *stream);
* stream until more is added.
*
* \param stream the audio stream to clear.
* \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.
*
* \threadsafety It is safe to call this function from any thread.
*
@ -1392,7 +1391,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_FlushAudioStream(SDL_AudioStream *stream);
* \sa SDL_GetAudioStreamQueued
* \sa SDL_PutAudioStreamData
*/
extern SDL_DECLSPEC int SDLCALL SDL_ClearAudioStream(SDL_AudioStream *stream);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_ClearAudioStream(SDL_AudioStream *stream);
/**
* Use this function to pause audio playback on the audio device associated
@ -1407,8 +1406,8 @@ extern SDL_DECLSPEC int SDLCALL SDL_ClearAudioStream(SDL_AudioStream *stream);
* loading, etc.
*
* \param stream the audio stream associated with the audio 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.
*
* \threadsafety It is safe to call this function from any thread.
*
@ -1416,7 +1415,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_ClearAudioStream(SDL_AudioStream *stream);
*
* \sa SDL_ResumeAudioStreamDevice
*/
extern SDL_DECLSPEC int SDLCALL SDL_PauseAudioStreamDevice(SDL_AudioStream *stream);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_PauseAudioStreamDevice(SDL_AudioStream *stream);
/**
* Use this function to unpause audio playback on the audio device associated
@ -1427,8 +1426,8 @@ extern SDL_DECLSPEC int SDLCALL SDL_PauseAudioStreamDevice(SDL_AudioStream *stre
* to progress again, and audio can be generated.
*
* \param stream the audio stream associated with the audio device to resume.
* \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.
*
* \threadsafety It is safe to call this function from any thread.
*
@ -1436,7 +1435,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_PauseAudioStreamDevice(SDL_AudioStream *stre
*
* \sa SDL_PauseAudioStreamDevice
*/
extern SDL_DECLSPEC int SDLCALL SDL_ResumeAudioStreamDevice(SDL_AudioStream *stream);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_ResumeAudioStreamDevice(SDL_AudioStream *stream);
/**
* Lock an audio stream for serialized access.
@ -1455,8 +1454,8 @@ extern SDL_DECLSPEC int SDLCALL SDL_ResumeAudioStreamDevice(SDL_AudioStream *str
* all the same attributes (recursive locks are allowed, etc).
*
* \param stream the audio stream to lock.
* \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.
*
* \threadsafety It is safe to call this function from any thread.
*
@ -1464,7 +1463,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_ResumeAudioStreamDevice(SDL_AudioStream *str
*
* \sa SDL_UnlockAudioStream
*/
extern SDL_DECLSPEC int SDLCALL SDL_LockAudioStream(SDL_AudioStream *stream);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_LockAudioStream(SDL_AudioStream *stream);
/**
@ -1473,8 +1472,8 @@ extern SDL_DECLSPEC int SDLCALL SDL_LockAudioStream(SDL_AudioStream *stream);
* This unlocks an audio stream after a call to SDL_LockAudioStream.
*
* \param stream the audio stream to unlock.
* \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.
*
* \threadsafety You should only call this from the same thread that
* previously called SDL_LockAudioStream.
@ -1483,7 +1482,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_LockAudioStream(SDL_AudioStream *stream);
*
* \sa SDL_LockAudioStream
*/
extern SDL_DECLSPEC int SDLCALL SDL_UnlockAudioStream(SDL_AudioStream *stream);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_UnlockAudioStream(SDL_AudioStream *stream);
/**
* A callback that fires when data passes through an SDL_AudioStream.
@ -1558,13 +1557,12 @@ typedef void (SDLCALL *SDL_AudioStreamCallback)(void *userdata, SDL_AudioStream
* Setting a NULL function turns off the callback.
*
* \param stream the audio stream to set the new callback on.
* \param callback the new callback function to call when data is added to the
* stream.
* \param callback the new callback function to call when data is requested
* from the stream.
* \param userdata an opaque pointer provided to the callback for its own
* personal use.
* \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information. This only fails if `stream`
* is NULL.
* \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError()
* for more information. This only fails if `stream` is NULL.
*
* \threadsafety It is safe to call this function from any thread.
*
@ -1572,7 +1570,7 @@ typedef void (SDLCALL *SDL_AudioStreamCallback)(void *userdata, SDL_AudioStream
*
* \sa SDL_SetAudioStreamPutCallback
*/
extern SDL_DECLSPEC int SDLCALL SDL_SetAudioStreamGetCallback(SDL_AudioStream *stream, SDL_AudioStreamCallback callback, void *userdata);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetAudioStreamGetCallback(SDL_AudioStream *stream, SDL_AudioStreamCallback callback, void *userdata);
/**
* Set a callback that runs when data is added to an audio stream.
@ -1612,9 +1610,8 @@ extern SDL_DECLSPEC int SDLCALL SDL_SetAudioStreamGetCallback(SDL_AudioStream *s
* stream.
* \param userdata an opaque pointer provided to the callback for its own
* personal use.
* \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information. This only fails if `stream`
* is NULL.
* \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError()
* for more information. This only fails if `stream` is NULL.
*
* \threadsafety It is safe to call this function from any thread.
*
@ -1622,7 +1619,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_SetAudioStreamGetCallback(SDL_AudioStream *s
*
* \sa SDL_SetAudioStreamGetCallback
*/
extern SDL_DECLSPEC int SDLCALL SDL_SetAudioStreamPutCallback(SDL_AudioStream *stream, SDL_AudioStreamCallback callback, void *userdata);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetAudioStreamPutCallback(SDL_AudioStream *stream, SDL_AudioStreamCallback callback, void *userdata);
/**
@ -1791,14 +1788,14 @@ typedef void (SDLCALL *SDL_AudioPostmixCallback)(void *userdata, const SDL_Audio
* \param devid the ID of an opened audio device.
* \param callback a callback function to be called. Can be NULL.
* \param userdata app-controlled pointer passed to callback. Can be NULL.
* \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.
*
* \threadsafety It is safe to call this function from any thread.
*
* \since This function is available since SDL 3.0.0.
*/
extern SDL_DECLSPEC int SDLCALL SDL_SetAudioPostmixCallback(SDL_AudioDeviceID devid, SDL_AudioPostmixCallback callback, void *userdata);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetAudioPostmixCallback(SDL_AudioDeviceID devid, SDL_AudioPostmixCallback callback, void *userdata);
/**
@ -1861,13 +1858,13 @@ extern SDL_DECLSPEC int SDLCALL SDL_SetAudioPostmixCallback(SDL_AudioDeviceID de
* function.
* \param audio_len a pointer filled with the length of the audio data buffer
* in bytes.
* \returns 0 on success. `audio_buf` will be filled with a pointer to an
* allocated buffer containing the audio data, and `audio_len` is
* \returns SDL_TRUE on success. `audio_buf` will be filled with a pointer to
* an allocated buffer containing the audio data, and `audio_len` is
* filled with the length of that audio buffer in bytes.
*
* This function returns -1 if the .WAV file cannot be opened, uses
* an unknown data format, or is corrupt; call SDL_GetError() for
* more information.
* This function returns SDL_FALSE if the .WAV file cannot be opened,
* uses an unknown data format, or is corrupt; call SDL_GetError()
* for more information.
*
* When the application is done with the data returned in
* `audio_buf`, it should call SDL_free() to dispose of it.
@ -1879,9 +1876,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_SetAudioPostmixCallback(SDL_AudioDeviceID de
* \sa SDL_free
* \sa SDL_LoadWAV
*/
extern SDL_DECLSPEC int SDLCALL SDL_LoadWAV_IO(SDL_IOStream * src, SDL_bool closeio,
SDL_AudioSpec * spec, Uint8 ** audio_buf,
Uint32 * audio_len);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_LoadWAV_IO(SDL_IOStream *src, SDL_bool closeio, SDL_AudioSpec *spec, Uint8 **audio_buf, Uint32 *audio_len);
/**
* Loads a WAV from a file path.
@ -1889,7 +1884,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_LoadWAV_IO(SDL_IOStream * src, SDL_bool clos
* This is a convenience function that is effectively the same as:
*
* ```c
* SDL_LoadWAV_IO(SDL_IOFromFile(path, "rb"), 1, spec, audio_buf, audio_len);
* SDL_LoadWAV_IO(SDL_IOFromFile(path, "rb"), SDL_TRUE, spec, audio_buf, audio_len);
* ```
*
* \param path the file path of the WAV file to open.
@ -1899,13 +1894,13 @@ extern SDL_DECLSPEC int SDLCALL SDL_LoadWAV_IO(SDL_IOStream * src, SDL_bool clos
* function.
* \param audio_len a pointer filled with the length of the audio data buffer
* in bytes.
* \returns 0 on success. `audio_buf` will be filled with a pointer to an
* allocated buffer containing the audio data, and `audio_len` is
* \returns SDL_TRUE on success. `audio_buf` will be filled with a pointer to
* an allocated buffer containing the audio data, and `audio_len` is
* filled with the length of that audio buffer in bytes.
*
* This function returns -1 if the .WAV file cannot be opened, uses
* an unknown data format, or is corrupt; call SDL_GetError() for
* more information.
* This function returns SDL_FALSE if the .WAV file cannot be opened,
* uses an unknown data format, or is corrupt; call SDL_GetError()
* for more information.
*
* When the application is done with the data returned in
* `audio_buf`, it should call SDL_free() to dispose of it.
@ -1917,8 +1912,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_LoadWAV_IO(SDL_IOStream * src, SDL_bool clos
* \sa SDL_free
* \sa SDL_LoadWAV_IO
*/
extern SDL_DECLSPEC int SDLCALL SDL_LoadWAV(const char *path, SDL_AudioSpec * spec,
Uint8 ** audio_buf, Uint32 * audio_len);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_LoadWAV(const char *path, SDL_AudioSpec *spec, Uint8 **audio_buf, Uint32 *audio_len);
/**
* Mix audio data in a specified format.
@ -1947,17 +1941,14 @@ extern SDL_DECLSPEC int SDLCALL SDL_LoadWAV(const char *path, SDL_AudioSpec * sp
* \param len the length of the audio buffer in bytes.
* \param volume ranges from 0.0 - 1.0, and should be set to 1.0 for full
* audio volume.
* \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.
*
* \threadsafety It is safe to call this function from any thread.
*
* \since This function is available since SDL 3.0.0.
*/
extern SDL_DECLSPEC int SDLCALL SDL_MixAudio(Uint8 * dst,
const Uint8 * src,
SDL_AudioFormat format,
Uint32 len, float volume);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_MixAudio(Uint8 *dst, const Uint8 *src, SDL_AudioFormat format, Uint32 len, float volume);
/**
* Convert some audio data of one format to another format.
@ -1980,20 +1971,27 @@ extern SDL_DECLSPEC int SDLCALL SDL_MixAudio(Uint8 * dst,
* which should be freed with SDL_free(). On error, it will be
* NULL.
* \param dst_len will be filled with the len of dst_data.
* \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.
*
* \threadsafety It is safe to call this function from any thread.
*
* \since This function is available since SDL 3.0.0.
*/
extern SDL_DECLSPEC int SDLCALL SDL_ConvertAudioSamples(const SDL_AudioSpec *src_spec,
const Uint8 *src_data,
int src_len,
const SDL_AudioSpec *dst_spec,
Uint8 **dst_data,
int *dst_len);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_ConvertAudioSamples(const SDL_AudioSpec *src_spec, const Uint8 *src_data, int src_len, const SDL_AudioSpec *dst_spec, Uint8 **dst_data, int *dst_len);
/**
* Get the human readable name of an audio format.
*
* \param format the audio format to query.
* \returns the human readable name of the specified audio format or
* "SDL_AUDIO_UNKNOWN" if the format isn't recognized.
*
* \threadsafety It is safe to call this function from any thread.
*
* \since This function is available since SDL 3.0.0.
*/
extern SDL_DECLSPEC const char * SDLCALL SDL_GetAudioFormatName(SDL_AudioFormat format);
/**
* Get the appropriate memset value for silencing an audio format.

View File

@ -48,8 +48,7 @@ extern "C" {
*
* If the 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.
*
@ -367,15 +366,15 @@ extern SDL_DECLSPEC SDL_PropertiesID SDLCALL SDL_GetCameraProperties(SDL_Camera
* be converting to this format behind the scenes.
*
* If the system is waiting for the user to approve access to the camera, as
* some platforms require, this will return -1, but this isn't necessarily a
* fatal error; you should either wait for an SDL_EVENT_CAMERA_DEVICE_APPROVED
* (or SDL_EVENT_CAMERA_DEVICE_DENIED) event, or poll SDL_IsCameraApproved()
* occasionally until it returns non-zero.
* some platforms require, this will return SDL_FALSE, but this isn't
* necessarily a fatal error; you should either wait for an
* SDL_EVENT_CAMERA_DEVICE_APPROVED (or SDL_EVENT_CAMERA_DEVICE_DENIED) event,
* or poll SDL_IsCameraApproved() occasionally until it returns non-zero.
*
* \param camera opened camera device.
* \param spec the SDL_CameraSpec to be initialized by this function.
* \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.
*
* \threadsafety It is safe to call this function from any thread.
*
@ -383,7 +382,7 @@ extern SDL_DECLSPEC SDL_PropertiesID SDLCALL SDL_GetCameraProperties(SDL_Camera
*
* \sa SDL_OpenCamera
*/
extern SDL_DECLSPEC int SDLCALL SDL_GetCameraFormat(SDL_Camera *camera, SDL_CameraSpec *spec);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetCameraFormat(SDL_Camera *camera, SDL_CameraSpec *spec);
/**
* Acquire a frame.
@ -447,8 +446,6 @@ extern SDL_DECLSPEC SDL_Surface * SDLCALL SDL_AcquireCameraFrame(SDL_Camera *cam
*
* \param camera opened camera device.
* \param frame the video frame surface to release.
* \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information.
*
* \threadsafety It is safe to call this function from any thread.
*
@ -456,7 +453,7 @@ extern SDL_DECLSPEC SDL_Surface * SDLCALL SDL_AcquireCameraFrame(SDL_Camera *cam
*
* \sa SDL_AcquireCameraFrame
*/
extern SDL_DECLSPEC int SDLCALL SDL_ReleaseCameraFrame(SDL_Camera *camera, SDL_Surface *frame);
extern SDL_DECLSPEC void SDLCALL SDL_ReleaseCameraFrame(SDL_Camera *camera, SDL_Surface *frame);
/**
* Use this function to shut down camera processing and close the camera

View File

@ -46,15 +46,15 @@ extern "C" {
* Put UTF-8 text into the clipboard.
*
* \param text the text to store in the clipboard.
* \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_GetClipboardText
* \sa SDL_HasClipboardText
*/
extern SDL_DECLSPEC int SDLCALL SDL_SetClipboardText(const char *text);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetClipboardText(const char *text);
/**
* Get UTF-8 text from the clipboard.
@ -89,15 +89,15 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_HasClipboardText(void);
* Put UTF-8 text into the primary selection.
*
* \param text the text to store in the primary selection.
* \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_GetPrimarySelectionText
* \sa SDL_HasPrimarySelectionText
*/
extern SDL_DECLSPEC int SDLCALL SDL_SetPrimarySelectionText(const char *text);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetPrimarySelectionText(const char *text);
/**
* Get UTF-8 text from the primary selection.
@ -185,8 +185,8 @@ typedef void (SDLCALL *SDL_ClipboardCleanupCallback)(void *userdata);
* \param userdata an opaque pointer that will be forwarded to the callbacks.
* \param mime_types a list of mime-types that are being offered.
* \param num_mime_types the number of mime-types in the mime_types list.
* \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.
*
@ -194,19 +194,19 @@ typedef void (SDLCALL *SDL_ClipboardCleanupCallback)(void *userdata);
* \sa SDL_GetClipboardData
* \sa SDL_HasClipboardData
*/
extern SDL_DECLSPEC int SDLCALL SDL_SetClipboardData(SDL_ClipboardDataCallback callback, SDL_ClipboardCleanupCallback cleanup, void *userdata, const char **mime_types, size_t num_mime_types);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetClipboardData(SDL_ClipboardDataCallback callback, SDL_ClipboardCleanupCallback cleanup, void *userdata, const char **mime_types, size_t num_mime_types);
/**
* Clear the clipboard data.
*
* \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_SetClipboardData
*/
extern SDL_DECLSPEC int SDLCALL SDL_ClearClipboardData(void);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_ClearClipboardData(void);
/**
* Get the data from clipboard for a given mime type.

View File

@ -56,25 +56,25 @@ extern "C" {
* \param fmt a printf()-style message format string.
* \param ... additional parameters matching % tokens in the `fmt` string, if
* any.
* \returns -1.
* \returns SDL_FALSE.
*
* \since This function is available since SDL 3.0.0.
*
* \sa SDL_ClearError
* \sa SDL_GetError
*/
extern SDL_DECLSPEC int SDLCALL SDL_SetError(SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(1);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetError(SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(1);
/**
* Set an error indicating that memory allocation failed.
*
* This function does not do any memory allocation.
*
* \returns -1.
* \returns SDL_FALSE.
*
* \since This function is available since SDL 3.0.0.
*/
extern SDL_DECLSPEC int SDLCALL SDL_OutOfMemory(void);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_OutOfMemory(void);
/**
* Retrieve a message about the last error that occurred on the current
@ -114,14 +114,14 @@ extern SDL_DECLSPEC const char * SDLCALL SDL_GetError(void);
/**
* Clear any previous error message for this thread.
*
* \returns 0.
* \returns SDL_TRUE.
*
* \since This function is available since SDL 3.0.0.
*
* \sa SDL_GetError
* \sa SDL_SetError
*/
extern SDL_DECLSPEC int SDLCALL SDL_ClearError(void);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_ClearError(void);
/**
* \name Internal error functions

View File

@ -151,8 +151,6 @@ typedef enum SDL_EventType
in an event watcher, the window handle is still valid and can still be used to retrieve any userdata
associated with the window. Otherwise, the handle has already been destroyed and all resources
associated with it are invalid */
SDL_EVENT_WINDOW_PEN_ENTER, /**< Window has gained focus of the pressure-sensitive pen with ID "data1" */
SDL_EVENT_WINDOW_PEN_LEAVE, /**< Window has lost focus of the pressure-sensitive pen with ID "data1" */
SDL_EVENT_WINDOW_HDR_STATE_CHANGED, /**< Window HDR properties have changed */
SDL_EVENT_WINDOW_FIRST = SDL_EVENT_WINDOW_SHOWN,
SDL_EVENT_WINDOW_LAST = SDL_EVENT_WINDOW_HDR_STATE_CHANGED,
@ -227,11 +225,14 @@ typedef enum SDL_EventType
SDL_EVENT_SENSOR_UPDATE = 0x1200, /**< A sensor was updated */
/* Pressure-sensitive pen events */
SDL_EVENT_PEN_DOWN = 0x1300, /**< Pressure-sensitive pen touched drawing surface */
SDL_EVENT_PEN_PROXIMITY_IN = 0x1300, /**< Pressure-sensitive pen has become available */
SDL_EVENT_PEN_PROXIMITY_OUT, /**< Pressure-sensitive pen has become unavailable */
SDL_EVENT_PEN_DOWN, /**< Pressure-sensitive pen touched drawing surface */
SDL_EVENT_PEN_UP, /**< Pressure-sensitive pen stopped touching drawing surface */
SDL_EVENT_PEN_MOTION, /**< Pressure-sensitive pen moved, or angle/pressure changed */
SDL_EVENT_PEN_BUTTON_DOWN, /**< Pressure-sensitive pen button pressed */
SDL_EVENT_PEN_BUTTON_UP, /**< Pressure-sensitive pen button released */
SDL_EVENT_PEN_MOTION, /**< Pressure-sensitive pen is moving on the tablet */
SDL_EVENT_PEN_AXIS, /**< Pressure-sensitive pen angle/pressure/etc changed */
/* Camera hotplug events */
SDL_EVENT_CAMERA_DEVICE_ADDED = 0x1400, /**< A new camera device is available */
@ -426,7 +427,7 @@ typedef struct SDL_MouseMotionEvent
Uint32 reserved;
Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
SDL_WindowID windowID; /**< The window with mouse focus, if any */
SDL_MouseID which; /**< The mouse instance id, SDL_TOUCH_MOUSEID, or SDL_PEN_MOUSEID */
SDL_MouseID which; /**< The mouse instance id or SDL_TOUCH_MOUSEID */
SDL_MouseButtonFlags state; /**< The current button state */
float x; /**< X coordinate, relative to window */
float y; /**< Y coordinate, relative to window */
@ -445,7 +446,7 @@ typedef struct SDL_MouseButtonEvent
Uint32 reserved;
Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
SDL_WindowID windowID; /**< The window with mouse focus, if any */
SDL_MouseID which; /**< The mouse instance id, SDL_TOUCH_MOUSEID, or SDL_PEN_MOUSEID */
SDL_MouseID which; /**< The mouse instance id, SDL_TOUCH_MOUSEID */
Uint8 button; /**< The mouse button index */
Uint8 state; /**< SDL_PRESSED or SDL_RELEASED */
Uint8 clicks; /**< 1 for single-click, 2 for double-click, etc. */
@ -465,7 +466,7 @@ typedef struct SDL_MouseWheelEvent
Uint32 reserved;
Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
SDL_WindowID windowID; /**< The window with mouse focus, if any */
SDL_MouseID which; /**< The mouse instance id, SDL_TOUCH_MOUSEID, or SDL_PEN_MOUSEID */
SDL_MouseID which; /**< The mouse instance id, SDL_TOUCH_MOUSEID */
float x; /**< The amount scrolled horizontally, positive to the right and negative to the left */
float y; /**< The amount scrolled vertically, positive away from the user and negative toward the user */
SDL_MouseWheelDirection direction; /**< Set to one of the SDL_MOUSEWHEEL_* defines. When FLIPPED the values in X and Y will be opposite. Multiply by -1 to change them back */
@ -714,67 +715,118 @@ typedef struct SDL_TouchFingerEvent
SDL_WindowID windowID; /**< The window underneath the finger, if any */
} SDL_TouchFingerEvent;
/**
* Pressure-sensitive pen touched or stopped touching surface (event.ptip.*)
* Pressure-sensitive pen proximity event structure (event.pmotion.*)
*
* When a pen becomes visible to the system (it is close enough to a tablet,
* etc), SDL will send an SDL_EVENT_PEN_PROXIMITY_IN event with the new pen's
* ID. This ID is valid until the pen leaves proximity again (has been removed
* from the tablet's area, the tablet has been unplugged, etc). If the same
* pen reenters proximity again, it will be given a new ID.
*
* Note that "proximity" means "close enough for the tablet to know the tool
* is there." The pen touching and lifting off from the tablet while not
* leaving the area are handled by SDL_EVENT_PEN_DOWN and SDL_EVENT_PEN_UP.
*
* \since This struct is available since SDL 3.0.0.
*/
typedef struct SDL_PenTipEvent
typedef struct SDL_PenProximityEvent
{
SDL_EventType type; /**< SDL_EVENT_PEN_PROXIMITY_IN or SDL_EVENT_PEN_PROXIMITY_OUT */
Uint32 reserved;
Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
SDL_WindowID windowID; /**< The window with mouse focus, if any */
SDL_PenID which; /**< The pen instance id */
} SDL_PenProximityEvent;
/**
* Pressure-sensitive pen motion event structure (event.pmotion.*)
*
* Depending on the hardware, you may get motion events when the pen is not
* touching a tablet, for tracking a pen even when it isn't drawing. You
* should listen for SDL_EVENT_PEN_DOWN and SDL_EVENT_PEN_UP events, or check
* `pen_state & SDL_PEN_INPUT_DOWN` to decide if a pen is "drawing" when
* dealing with pen motion.
*
* \since This struct is available since SDL 3.0.0.
*/
typedef struct SDL_PenMotionEvent
{
SDL_EventType type; /**< SDL_EVENT_PEN_MOTION */
Uint32 reserved;
Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
SDL_WindowID windowID; /**< The window with mouse focus, if any */
SDL_PenID which; /**< The pen instance id */
SDL_PenInputFlags pen_state; /**< Complete pen input state at time of event */
float x; /**< X position of pen on tablet */
float y; /**< Y position of pen on tablet */
} SDL_PenMotionEvent;
/**
* Pressure-sensitive pen touched event structure (event.ptouch.*)
*
* These events come when a pen touches a surface (a tablet, etc), or lifts
* off from one.
*
* \since This struct is available since SDL 3.0.0.
*/
typedef struct SDL_PenTouchEvent
{
SDL_EventType type; /**< SDL_EVENT_PEN_DOWN or SDL_EVENT_PEN_UP */
Uint32 reserved;
Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
SDL_WindowID windowID; /**< The window with pen focus, if any */
SDL_PenID which; /**< The pen instance id */
Uint8 tip; /**< SDL_PEN_TIP_INK when using a regular pen tip, or SDL_PEN_TIP_ERASER if the pen is being used as an eraser (e.g., flipped to use the eraser tip) */
Uint8 state; /**< SDL_PRESSED on SDL_EVENT_PEN_DOWN and SDL_RELEASED on SDL_EVENT_PEN_UP */
Uint16 pen_state; /**< Pen button masks (where SDL_BUTTON(1) is the first button, SDL_BUTTON(2) is the second button etc.), SDL_PEN_DOWN_MASK is set if the pen is touching the surface, and SDL_PEN_ERASER_MASK is set if the pen is (used as) an eraser. */
float x; /**< X coordinate, relative to window */
float y; /**< Y coordinate, relative to window */
float axes[SDL_PEN_NUM_AXES]; /**< Pen axes such as pressure and tilt (ordered as per SDL_PenAxis) */
} SDL_PenTipEvent;
/**
* Pressure-sensitive pen motion / pressure / angle event structure
* (event.pmotion.*)
*
* \since This struct is available since SDL 3.0.0.
*/
typedef struct SDL_PenMotionEvent
{
SDL_EventType type; /**< SDL_EVENT_PEN_MOTION */
Uint32 reserved;
Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
SDL_WindowID windowID; /**< The window with pen focus, if any */
SDL_PenID which; /**< The pen instance id */
Uint8 padding1;
Uint8 padding2;
Uint16 pen_state; /**< Pen button masks (where SDL_BUTTON(1) is the first button, SDL_BUTTON(2) is the second button etc.), SDL_PEN_DOWN_MASK is set if the pen is touching the surface, and SDL_PEN_ERASER_MASK is set if the pen is (used as) an eraser. */
float x; /**< X coordinate, relative to window */
float y; /**< Y coordinate, relative to window */
float axes[SDL_PEN_NUM_AXES]; /**< Pen axes such as pressure and tilt (ordered as per SDL_PenAxis) */
} SDL_PenMotionEvent;
SDL_PenInputFlags pen_state; /**< Complete pen input state at time of event */
float x; /**< X position of pen on tablet */
float y; /**< Y position of pen on tablet */
Uint8 eraser; /**< Non-zero if eraser end is used (not all pens support this). */
Uint8 state; /**< SDL_PRESSED (pen is touching) or SDL_RELEASED (pen is lifted off) */
} SDL_PenTouchEvent;
/**
* Pressure-sensitive pen button event structure (event.pbutton.*)
*
* This is for buttons on the pen itself that the user might click. The pen
* itself pressing down to draw triggers a SDL_EVENT_PEN_DOWN event instead.
*
* \since This struct is available since SDL 3.0.0.
*/
typedef struct SDL_PenButtonEvent
{
SDL_EventType type; /**< SDL_EVENT_PEN_BUTTON_DOWN or SDL_EVENT_PEN_BUTTON_UP */
SDL_EventType type; /**< SDL_EVENT_PEN_BUTTON_DOWN or SDL_EVENT_PEN_BUTTON_UP */
Uint32 reserved;
Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
SDL_WindowID windowID; /**< The window with mouse focus, if any */
SDL_PenID which; /**< The pen instance id */
SDL_PenInputFlags pen_state; /**< Complete pen input state at time of event */
float x; /**< X position of pen on tablet */
float y; /**< Y position of pen on tablet */
Uint8 button; /**< The pen button index (first button is 1). */
Uint8 state; /**< SDL_PRESSED or SDL_RELEASED */
} SDL_PenButtonEvent;
/**
* Pressure-sensitive pen pressure / angle event structure (event.paxis.*)
*
* You might get some of these events even if the pen isn't touching the
* tablet.
*
* \since This struct is available since SDL 3.0.0.
*/
typedef struct SDL_PenAxisEvent
{
SDL_EventType type; /**< SDL_EVENT_PEN_AXIS */
Uint32 reserved;
Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
SDL_WindowID windowID; /**< The window with pen focus, if any */
SDL_PenID which; /**< The pen instance id */
Uint8 button; /**< The pen button index (1 represents the pen tip for compatibility with mouse events) */
Uint8 state; /**< SDL_PRESSED or SDL_RELEASED */
Uint16 pen_state; /**< Pen button masks (where SDL_BUTTON(1) is the first button, SDL_BUTTON(2) is the second button etc.), SDL_PEN_DOWN_MASK is set if the pen is touching the surface, and SDL_PEN_ERASER_MASK is set if the pen is (used as) an eraser. */
float x; /**< X coordinate, relative to window */
float y; /**< Y coordinate, relative to window */
float axes[SDL_PEN_NUM_AXES]; /**< Pen axes such as pressure and tilt (ordered as per SDL_PenAxis) */
} SDL_PenButtonEvent;
SDL_PenInputFlags pen_state; /**< Complete pen input state at time of event */
float x; /**< X position of pen on tablet */
float y; /**< Y position of pen on tablet */
SDL_PenAxis axis; /**< Axis that has changed */
float value; /**< New value of axis */
} SDL_PenAxisEvent;
/**
* An event used to drop text or request a file open by the system
@ -894,9 +946,11 @@ typedef union SDL_Event
SDL_QuitEvent quit; /**< Quit request event data */
SDL_UserEvent user; /**< Custom event data */
SDL_TouchFingerEvent tfinger; /**< Touch finger event data */
SDL_PenTipEvent ptip; /**< Pen tip touching or leaving drawing surface */
SDL_PenMotionEvent pmotion; /**< Pen change in position, pressure, or angle */
SDL_PenButtonEvent pbutton; /**< Pen button press */
SDL_PenProximityEvent pproximity; /**< Pen proximity event data */
SDL_PenTouchEvent ptouch; /**< Pen tip touching event data */
SDL_PenMotionEvent pmotion; /**< Pen motion event data */
SDL_PenButtonEvent pbutton; /**< Pen button event data */
SDL_PenAxisEvent paxis; /**< Pen axis event data */
SDL_DropEvent drop; /**< Drag and drop event data */
SDL_ClipboardEvent clipboard; /**< Clipboard event data */
@ -985,8 +1039,8 @@ typedef enum SDL_EventAction
* SDL_EVENT_FIRST is a safe choice.
* \param maxType maximum value of the event type to be considered;
* SDL_EVENT_LAST is a safe choice.
* \returns the number of events actually stored or a negative error code on
* failure; call SDL_GetError() for more information.
* \returns the number of events actually stored or -1 on failure; call
* SDL_GetError() for more information.
*
* \since This function is available since SDL 3.0.0.
*
@ -1200,9 +1254,9 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_WaitEventTimeout(SDL_Event *event, Sint
* its own custom event types.
*
* \param event the SDL_Event to be added to the queue.
* \returns 1 on success, 0 if the event was filtered, or a negative error
* code on failure; call SDL_GetError() for more information. A
* common reason for error is the event queue being full.
* \returns SDL_TRUE on success, SDL_FALSE if the event was filtered or on
* failure; call SDL_GetError() for more information. A common reason
* for error is the event queue being full.
*
* \since This function is available since SDL 3.0.0.
*
@ -1210,7 +1264,7 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_WaitEventTimeout(SDL_Event *event, Sint
* \sa SDL_PollEvent
* \sa SDL_RegisterEvents
*/
extern SDL_DECLSPEC int SDLCALL SDL_PushEvent(SDL_Event *event);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_PushEvent(SDL_Event *event);
/**
* A function pointer used for callbacks that watch the event queue.
@ -1218,8 +1272,9 @@ extern SDL_DECLSPEC int SDLCALL SDL_PushEvent(SDL_Event *event);
* \param userdata what was passed as `userdata` to SDL_SetEventFilter() or
* SDL_AddEventWatch, etc.
* \param event the event that triggered the callback.
* \returns 1 to permit event to be added to the queue, and 0 to disallow it.
* When used with SDL_AddEventWatch, the return value is ignored.
* \returns SDL_TRUE to permit event to be added to the queue, and SDL_FALSE
* to disallow it. When used with SDL_AddEventWatch, the return value
* is ignored.
*
* \threadsafety SDL may call this callback at any time from any thread; the
* application is responsible for locking resources the callback
@ -1230,16 +1285,16 @@ extern SDL_DECLSPEC int SDLCALL SDL_PushEvent(SDL_Event *event);
* \sa SDL_SetEventFilter
* \sa SDL_AddEventWatch
*/
typedef int (SDLCALL *SDL_EventFilter)(void *userdata, SDL_Event *event);
typedef SDL_bool (SDLCALL *SDL_EventFilter)(void *userdata, SDL_Event *event);
/**
* Set up a filter to process all events before they change internal state and
* are posted to the internal event queue.
*
* If the filter function returns 1 when called, then the event will be added
* to the internal queue. If it returns 0, then the event will be dropped from
* the queue, but the internal state will still be updated. This allows
* selective filtering of dynamically arriving events.
* If the filter function returns SDL_TRUE when called, then the event will be
* added to the internal queue. If it returns SDL_FALSE, then the event will
* be dropped from the queue, but the internal state will still be updated.
* This allows selective filtering of dynamically arriving events.
*
* **WARNING**: Be very careful of what you do in the event filter function,
* as it may run in a different thread!
@ -1317,17 +1372,17 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetEventFilter(SDL_EventFilter *filter,
*
* \param filter an SDL_EventFilter function to call when an event happens.
* \param userdata a pointer that is passed to `filter`.
* \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.
*
* \threadsafety It is safe to call this function from any thread.
*
* \since This function is available since SDL 3.0.0.
*
* \sa SDL_DelEventWatch
* \sa SDL_RemoveEventWatch
* \sa SDL_SetEventFilter
*/
extern SDL_DECLSPEC int SDLCALL SDL_AddEventWatch(SDL_EventFilter filter, void *userdata);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_AddEventWatch(SDL_EventFilter filter, void *userdata);
/**
* Remove an event watch callback added with SDL_AddEventWatch().
@ -1342,11 +1397,11 @@ extern SDL_DECLSPEC int SDLCALL SDL_AddEventWatch(SDL_EventFilter filter, void *
*
* \sa SDL_AddEventWatch
*/
extern SDL_DECLSPEC void SDLCALL SDL_DelEventWatch(SDL_EventFilter filter, void *userdata);
extern SDL_DECLSPEC void SDLCALL SDL_RemoveEventWatch(SDL_EventFilter filter, void *userdata);
/**
* Run a specific filter function on the current event queue, removing any
* events for which the filter returns 0.
* events for which the filter returns SDL_FALSE.
*
* See SDL_SetEventFilter() for more information. Unlike SDL_SetEventFilter(),
* this function does not change the filter permanently, it only uses the

View File

@ -266,12 +266,12 @@ typedef Uint32 SDL_GlobFlags;
* Create a directory.
*
* \param path the path of the directory to create.
* \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.
*/
extern SDL_DECLSPEC int SDLCALL SDL_CreateDirectory(const char *path);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_CreateDirectory(const char *path);
/* Callback for directory enumeration. Return 1 to keep enumerating,
0 to stop enumerating (no error), -1 to stop enumerating and
@ -289,47 +289,47 @@ typedef int (SDLCALL *SDL_EnumerateDirectoryCallback)(void *userdata, const char
* \param path the path of the directory to enumerate.
* \param callback a function that is called for each entry in the directory.
* \param userdata a pointer that is passed to `callback`.
* \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.
*/
extern SDL_DECLSPEC int SDLCALL SDL_EnumerateDirectory(const char *path, SDL_EnumerateDirectoryCallback callback, void *userdata);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_EnumerateDirectory(const char *path, SDL_EnumerateDirectoryCallback callback, void *userdata);
/**
* Remove a file or an empty directory.
*
* \param path the path of the directory to enumerate.
* \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.
*/
extern SDL_DECLSPEC int SDLCALL SDL_RemovePath(const char *path);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_RemovePath(const char *path);
/**
* Rename a file or directory.
*
* \param oldpath the old path.
* \param newpath the new path.
* \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.
*/
extern SDL_DECLSPEC int SDLCALL SDL_RenamePath(const char *oldpath, const char *newpath);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_RenamePath(const char *oldpath, const char *newpath);
/**
* Copy a file.
*
* \param oldpath the old path.
* \param newpath the new path.
* \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.
*/
extern SDL_DECLSPEC int SDLCALL SDL_CopyFile(const char *oldpath, const char *newpath);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_CopyFile(const char *oldpath, const char *newpath);
/**
* Get information about a filesystem path.
@ -337,12 +337,12 @@ extern SDL_DECLSPEC int SDLCALL SDL_CopyFile(const char *oldpath, const char *ne
* \param path the path to query.
* \param info a pointer filled in with information about the path, or NULL to
* check for the existence of a file.
* \returns 0 on success or a negative error code if the file doesn't exist,
* or another failure; call SDL_GetError() for more information.
* \returns SDL_TRUE on success or SDL_FALSE if the file doesn't exist, or
* another failure; call SDL_GetError() for more information.
*
* \since This function is available since SDL 3.0.0.
*/
extern SDL_DECLSPEC int SDLCALL SDL_GetPathInfo(const char *path, SDL_PathInfo *info);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetPathInfo(const char *path, SDL_PathInfo *info);
/**
* Enumerate a directory tree, filtered by pattern, and return a list.

View File

@ -379,12 +379,12 @@ extern SDL_DECLSPEC int SDLCALL SDL_AddGamepadMappingsFromFile(const char *file)
*
* This will generate gamepad events as needed if device mappings change.
*
* \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.
*/
extern SDL_DECLSPEC int SDLCALL SDL_ReloadGamepadMappings(void);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_ReloadGamepadMappings(void);
/**
* Get the current gamepad mappings.
@ -442,15 +442,15 @@ extern SDL_DECLSPEC char * SDLCALL SDL_GetGamepadMapping(SDL_Gamepad *gamepad);
* \param instance_id the joystick instance ID.
* \param mapping the mapping to use for this device, or NULL to clear the
* mapping.
* \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_AddGamepadMapping
* \sa SDL_GetGamepadMapping
*/
extern SDL_DECLSPEC int SDLCALL SDL_SetGamepadMapping(SDL_JoystickID instance_id, const char *mapping);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetGamepadMapping(SDL_JoystickID instance_id, const char *mapping);
/**
* Return whether a gamepad is currently connected.
@ -813,14 +813,14 @@ extern SDL_DECLSPEC int SDLCALL SDL_GetGamepadPlayerIndex(SDL_Gamepad *gamepad);
* \param gamepad the gamepad object to adjust.
* \param player_index player index to assign to this gamepad, or -1 to clear
* the player index and turn off player LEDs.
* \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_GetGamepadPlayerIndex
*/
extern SDL_DECLSPEC int SDLCALL SDL_SetGamepadPlayerIndex(SDL_Gamepad *gamepad, int player_index);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetGamepadPlayerIndex(SDL_Gamepad *gamepad, int player_index);
/**
* Get the USB vendor ID of an opened gamepad, if available.
@ -1257,14 +1257,14 @@ extern SDL_DECLSPEC int SDLCALL SDL_GetNumGamepadTouchpadFingers(SDL_Gamepad *ga
* \param y filled with y position, normalized 0 to 1, with the origin in the
* upper left.
* \param pressure filled with pressure value.
* \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_GetNumGamepadTouchpadFingers
*/
extern SDL_DECLSPEC int SDLCALL SDL_GetGamepadTouchpadFinger(SDL_Gamepad *gamepad, int touchpad, int finger, Uint8 *state, float *x, float *y, float *pressure);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetGamepadTouchpadFinger(SDL_Gamepad *gamepad, int touchpad, int finger, Uint8 *state, float *x, float *y, float *pressure);
/**
* Return whether a gamepad has a particular sensor.
@ -1287,15 +1287,15 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GamepadHasSensor(SDL_Gamepad *gamepad,
* \param gamepad the gamepad to update.
* \param type the type of sensor to enable/disable.
* \param enabled whether data reporting should be enabled.
* \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_GamepadHasSensor
* \sa SDL_GamepadSensorEnabled
*/
extern SDL_DECLSPEC int SDLCALL SDL_SetGamepadSensorEnabled(SDL_Gamepad *gamepad, SDL_SensorType type, SDL_bool enabled);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetGamepadSensorEnabled(SDL_Gamepad *gamepad, SDL_SensorType type, SDL_bool enabled);
/**
* Query whether sensor data reporting is enabled for a gamepad.
@ -1331,12 +1331,12 @@ extern SDL_DECLSPEC float SDLCALL SDL_GetGamepadSensorDataRate(SDL_Gamepad *game
* \param type the type of sensor to query.
* \param data a pointer filled with the current sensor state.
* \param num_values the number of values to write to data.
* \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.
*/
extern SDL_DECLSPEC int SDLCALL SDL_GetGamepadSensorData(SDL_Gamepad *gamepad, SDL_SensorType type, float *data, int num_values);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetGamepadSensorData(SDL_Gamepad *gamepad, SDL_SensorType type, float *data, int num_values);
/**
* Start a rumble effect on a gamepad.
@ -1353,11 +1353,12 @@ extern SDL_DECLSPEC int SDLCALL SDL_GetGamepadSensorData(SDL_Gamepad *gamepad, S
* \param high_frequency_rumble the intensity of the high frequency (right)
* rumble motor, from 0 to 0xFFFF.
* \param duration_ms the duration of the rumble effect, in milliseconds.
* \returns 0, or -1 if rumble isn't supported on this gamepad.
* \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.
*/
extern SDL_DECLSPEC int SDLCALL SDL_RumbleGamepad(SDL_Gamepad *gamepad, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble, Uint32 duration_ms);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_RumbleGamepad(SDL_Gamepad *gamepad, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble, Uint32 duration_ms);
/**
* Start a rumble effect in the gamepad's triggers.
@ -1378,14 +1379,14 @@ extern SDL_DECLSPEC int SDLCALL SDL_RumbleGamepad(SDL_Gamepad *gamepad, Uint16 l
* \param right_rumble the intensity of the right trigger rumble motor, from 0
* to 0xFFFF.
* \param duration_ms the duration of the rumble effect, 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_RumbleGamepad
*/
extern SDL_DECLSPEC int SDLCALL SDL_RumbleGamepadTriggers(SDL_Gamepad *gamepad, Uint16 left_rumble, Uint16 right_rumble, Uint32 duration_ms);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_RumbleGamepadTriggers(SDL_Gamepad *gamepad, Uint16 left_rumble, Uint16 right_rumble, Uint32 duration_ms);
/**
* Update a gamepad's LED color.
@ -1400,12 +1401,12 @@ extern SDL_DECLSPEC int SDLCALL SDL_RumbleGamepadTriggers(SDL_Gamepad *gamepad,
* \param red the intensity of the red LED.
* \param green the intensity of the green LED.
* \param blue the intensity of the blue LED.
* \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.
*/
extern SDL_DECLSPEC int SDLCALL SDL_SetGamepadLED(SDL_Gamepad *gamepad, Uint8 red, Uint8 green, Uint8 blue);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetGamepadLED(SDL_Gamepad *gamepad, Uint8 red, Uint8 green, Uint8 blue);
/**
* Send a gamepad specific effect packet.
@ -1413,12 +1414,12 @@ extern SDL_DECLSPEC int SDLCALL SDL_SetGamepadLED(SDL_Gamepad *gamepad, Uint8 re
* \param gamepad the gamepad to affect.
* \param data the data to send to the gamepad.
* \param size the size of the data to send to the gamepad.
* \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.
*/
extern SDL_DECLSPEC int SDLCALL SDL_SendGamepadEffect(SDL_Gamepad *gamepad, const void *data, int size);
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SendGamepadEffect(SDL_Gamepad *gamepad, const void *data, int size);
/**
* Close a gamepad previously opened with SDL_OpenGamepad().

Some files were not shown because too many files have changed in this diff Show More