Update SDL3

This commit is contained in:
2024-12-28 21:39:48 +02:00
committed by Ari Vuollet
parent e0bd0df0d5
commit a6804cfbfd
82 changed files with 1250 additions and 321 deletions

View File

@@ -1,4 +1,4 @@
Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages

View File

@@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
@@ -20,7 +20,7 @@
*/
/**
* Main include header for the SDL library, version 3.1.7
* Main include header for the SDL library, version 3.1.11
*
* It is almost always best to include just this one header instead of
* picking out individual headers included here. There are exceptions to

View File

@@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
@@ -118,8 +118,7 @@ extern "C" {
*
* If the program is not running under a debugger, SDL_TriggerBreakpoint will
* likely terminate the app, possibly without warning. If the current platform
* isn't supported (SDL doesn't know how to trigger a breakpoint), this macro
* does nothing.
* isn't supported, this macro is left undefined.
*
* \threadsafety It is safe to call this macro from any thread.
*
@@ -127,15 +126,19 @@ extern "C" {
*/
#define SDL_TriggerBreakpoint() TriggerABreakpointInAPlatformSpecificManner
#elif defined(_MSC_VER)
#elif defined(_MSC_VER) && _MSC_VER >= 1310
/* Don't include intrin.h here because it contains C++ code */
extern void __cdecl __debugbreak(void);
#define SDL_TriggerBreakpoint() __debugbreak()
#elif defined(_MSC_VER) && defined(_M_IX86)
#define SDL_TriggerBreakpoint() { _asm { int 0x03 } }
#elif defined(ANDROID)
#include <assert.h>
#define SDL_TriggerBreakpoint() assert(0)
#elif SDL_HAS_BUILTIN(__builtin_debugtrap)
#define SDL_TriggerBreakpoint() __builtin_debugtrap()
#elif SDL_HAS_BUILTIN(__builtin_trap)
#define SDL_TriggerBreakpoint() __builtin_trap()
#elif (defined(__GNUC__) || defined(__clang__)) && (defined(__i386__) || defined(__x86_64__))
#define SDL_TriggerBreakpoint() __asm__ __volatile__ ( "int $3\n\t" )
#elif (defined(__GNUC__) || defined(__clang__)) && defined(__riscv)
@@ -152,8 +155,7 @@ extern "C" {
#include <signal.h>
#define SDL_TriggerBreakpoint() raise(SIGTRAP)
#else
/* How do we trigger breakpoints on this platform? */
#define SDL_TriggerBreakpoint()
/* SDL_TriggerBreakpoint is intentionally left undefined on unknown platforms. */
#endif
#ifdef SDL_WIKI_DOCUMENTATION_SECTION

View File

@@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
@@ -67,14 +67,14 @@
*
* ## Best Practices
*
* Simple non-blocking i/o--for an app that just wants to pick up data
* Simple non-blocking I/O--for an app that just wants to pick up data
* whenever it's ready without losing framerate waiting on disks to spin--can
* use whatever pattern works well for the program. In this case, simply call
* SDL_ReadAsyncIO, or maybe SDL_LoadFileAsync, as needed. Once a frame, call
* SDL_GetAsyncIOResult to check for any completed tasks and deal with the
* data as it arrives.
*
* If two separate pieces of the same program need their own i/o, it is legal
* If two separate pieces of the same program need their own I/O, it is legal
* for each to create their own queue. This will prevent either piece from
* accidentally consuming the other's completed tasks. Each queue does require
* some amount of resources, but it is not an overwhelming cost. Do not make a
@@ -83,7 +83,7 @@
* were submitted, so it doesn't generally matter what order tasks are
* started.
*
* One async i/o queue can be shared by multiple threads, or one thread can
* One async I/O queue can be shared by multiple threads, or one thread can
* have more than one queue, but the most efficient way--if ruthless
* efficiency is the goal--is to have one queue per thread, with multiple
* threads working in parallel, and attempt to keep each queue loaded with
@@ -117,7 +117,7 @@ extern "C" {
* This operates as an opaque handle. One can then request read or write
* operations on it.
*
* \since This struct is available since SDL 3.0.0.
* \since This struct is available since SDL 3.2.0.
*
* \sa SDL_AsyncIOFromFile
*/
@@ -126,7 +126,7 @@ typedef struct SDL_AsyncIO SDL_AsyncIO;
/**
* Types of asynchronous I/O tasks.
*
* \since This enum is available since SDL 3.0.0.
* \since This enum is available since SDL 3.2.0.
*/
typedef enum SDL_AsyncIOTaskType
{
@@ -138,19 +138,19 @@ typedef enum SDL_AsyncIOTaskType
/**
* Possible outcomes of an asynchronous I/O task.
*
* \since This enum is available since SDL 3.0.0.
* \since This enum is available since SDL 3.2.0.
*/
typedef enum SDL_AsyncIOResult
{
SDL_ASYNCIO_COMPLETE, /**< request was completed without error */
SDL_ASYNCIO_FAILURE, /**< request failed for some reason; check SDL_GetError()! */
SDL_ASYNCIO_CANCELLED /**< request was cancelled before completing. */
SDL_ASYNCIO_CANCELED /**< request was canceled before completing. */
} SDL_AsyncIOResult;
/**
* Information about a completed asynchronous I/O request.
*
* \since This struct is available since SDL 3.0.0.
* \since This struct is available since SDL 3.2.0.
*/
typedef struct SDL_AsyncIOOutcome
{
@@ -172,7 +172,7 @@ typedef struct SDL_AsyncIOOutcome
* allowing an app to manage multiple pending tasks in one place, in whatever
* order they complete.
*
* \since This struct is available since SDL 3.0.0.
* \since This struct is available since SDL 3.2.0.
*
* \sa SDL_CreateAsyncIOQueue
* \sa SDL_ReadAsyncIO
@@ -213,7 +213,7 @@ typedef struct SDL_AsyncIOQueue SDL_AsyncIOQueue;
* \returns a pointer to the SDL_AsyncIO structure that is created or NULL on
* failure; call SDL_GetError() for more information.
*
* \since This function is available since SDL 3.2.0.
* \since This function is available since SDL 3.1.8.
*
* \sa SDL_CloseAsyncIO
* \sa SDL_ReadAsyncIO
@@ -234,7 +234,7 @@ extern SDL_DECLSPEC SDL_AsyncIO * SDLCALL SDL_AsyncIOFromFile(const char *file,
*
* \threadsafety It is safe to call this function from any thread.
*
* \since This function is available since SDL 3.2.0.
* \since This function is available since SDL 3.1.8.
*/
extern SDL_DECLSPEC Sint64 SDLCALL SDL_GetAsyncIOSize(SDL_AsyncIO *asyncio);
@@ -269,7 +269,7 @@ extern SDL_DECLSPEC Sint64 SDLCALL SDL_GetAsyncIOSize(SDL_AsyncIO *asyncio);
*
* \threadsafety It is safe to call this function from any thread.
*
* \since This function is available since SDL 3.2.0.
* \since This function is available since SDL 3.1.8.
*
* \sa SDL_WriteAsyncIO
* \sa SDL_CreateAsyncIOQueue
@@ -306,7 +306,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_ReadAsyncIO(SDL_AsyncIO *asyncio, void *ptr
*
* \threadsafety It is safe to call this function from any thread.
*
* \since This function is available since SDL 3.2.0.
* \since This function is available since SDL 3.1.8.
*
* \sa SDL_ReadAsyncIO
* \sa SDL_CreateAsyncIOQueue
@@ -358,7 +358,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_WriteAsyncIO(SDL_AsyncIO *asyncio, void *pt
* \threadsafety It is safe to call this function from any thread, but two
* threads should not attempt to close the same object.
*
* \since This function is available since SDL 3.2.0.
* \since This function is available since SDL 3.1.8.
*/
extern SDL_DECLSPEC bool SDLCALL SDL_CloseAsyncIO(SDL_AsyncIO *asyncio, bool flush, SDL_AsyncIOQueue *queue, void *userdata);
@@ -373,7 +373,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_CloseAsyncIO(SDL_AsyncIO *asyncio, bool flu
*
* \threadsafety It is safe to call this function from any thread.
*
* \since This function is available since SDL 3.2.0.
* \since This function is available since SDL 3.1.8.
*
* \sa SDL_DestroyAsyncIOQueue
* \sa SDL_GetAsyncIOResult
@@ -407,7 +407,7 @@ extern SDL_DECLSPEC SDL_AsyncIOQueue * SDLCALL SDL_CreateAsyncIOQueue(void);
* no other thread is waiting on the queue with
* SDL_WaitAsyncIOResult.
*
* \since This function is available since SDL 3.2.0.
* \since This function is available since SDL 3.1.8.
*/
extern SDL_DECLSPEC void SDLCALL SDL_DestroyAsyncIOQueue(SDL_AsyncIOQueue *queue);
@@ -431,7 +431,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_DestroyAsyncIOQueue(SDL_AsyncIOQueue *queue
*
* \threadsafety It is safe to call this function from any thread.
*
* \since This function is available since SDL 3.2.0.
* \since This function is available since SDL 3.1.8.
*
* \sa SDL_WaitAsyncIOResult
*/
@@ -475,7 +475,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_GetAsyncIOResult(SDL_AsyncIOQueue *queue, S
*
* \threadsafety It is safe to call this function from any thread.
*
* \since This function is available since SDL 3.2.0.
* \since This function is available since SDL 3.1.8.
*
* \sa SDL_SignalAsyncIOQueue
*/
@@ -499,7 +499,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_WaitAsyncIOResult(SDL_AsyncIOQueue *queue,
*
* \threadsafety It is safe to call this function from any thread.
*
* \since This function is available since SDL 3.2.0.
* \since This function is available since SDL 3.1.8.
*
* \sa SDL_WaitAsyncIOResult
*/
@@ -531,7 +531,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_SignalAsyncIOQueue(SDL_AsyncIOQueue *queue)
* \returns true on success or false on failure; call SDL_GetError() for more
* information.
*
* \since This function is available since SDL 3.2.0.
* \since This function is available since SDL 3.1.8.
*
* \sa SDL_LoadFile_IO
*/

View File

@@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages

View File

@@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
@@ -745,7 +745,7 @@ extern SDL_DECLSPEC SDL_AudioDeviceID SDLCALL SDL_OpenAudioDevice(SDL_AudioDevic
*
* \threadsafety It is safe to call this function from any thread.
*
* \since This function is available since SDL 3.2.0.
* \since This function is available since SDL 3.1.8.
*/
extern SDL_DECLSPEC bool SDLCALL SDL_IsAudioDevicePhysical(SDL_AudioDeviceID devid);
@@ -759,7 +759,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_IsAudioDevicePhysical(SDL_AudioDeviceID dev
*
* \threadsafety It is safe to call this function from any thread.
*
* \since This function is available since SDL 3.2.0.
* \since This function is available since SDL 3.1.8.
*/
extern SDL_DECLSPEC bool SDLCALL SDL_IsAudioDevicePlayback(SDL_AudioDeviceID devid);
@@ -942,7 +942,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_CloseAudioDevice(SDL_AudioDeviceID devid);
* Binding a stream to a device will set its output format for playback
* devices, and its input format for recording devices, so they match the
* device's settings. The caller is welcome to change the other end of the
* stream's format at any time.
* stream's format at any time with SDL_SetAudioStreamFormat().
*
* \param devid an audio device to bind a stream to.
* \param streams an array of audio streams to bind.
@@ -958,7 +958,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_CloseAudioDevice(SDL_AudioDeviceID devid);
* \sa SDL_UnbindAudioStream
* \sa SDL_GetAudioStreamDevice
*/
extern SDL_DECLSPEC bool SDLCALL SDL_BindAudioStreams(SDL_AudioDeviceID devid, SDL_AudioStream **streams, int num_streams);
extern SDL_DECLSPEC bool SDLCALL SDL_BindAudioStreams(SDL_AudioDeviceID devid, SDL_AudioStream * const *streams, int num_streams);
/**
* Bind a single audio stream to an audio device.
@@ -990,7 +990,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_BindAudioStream(SDL_AudioDeviceID devid, SD
*
* Unbinding a stream that isn't bound to a device is a legal no-op.
*
* \param streams an array of audio streams to unbind.
* \param streams an array of audio streams to unbind. Can be NULL or contain
* NULL.
* \param num_streams number streams listed in the `streams` array.
*
* \threadsafety It is safe to call this function from any thread.
@@ -999,7 +1000,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_BindAudioStream(SDL_AudioDeviceID devid, SD
*
* \sa SDL_BindAudioStreams
*/
extern SDL_DECLSPEC void SDLCALL SDL_UnbindAudioStreams(SDL_AudioStream **streams, int num_streams);
extern SDL_DECLSPEC void SDLCALL SDL_UnbindAudioStreams(SDL_AudioStream * const *streams, int num_streams);
/**
* Unbind a single audio stream from its audio device.
@@ -1007,7 +1008,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_UnbindAudioStreams(SDL_AudioStream **stream
* This is a convenience function, equivalent to calling
* `SDL_UnbindAudioStreams(&stream, 1)`.
*
* \param stream an audio stream to unbind from a device.
* \param stream an audio stream to unbind from a device. Can be NULL.
*
* \threadsafety It is safe to call this function from any thread.
*
@@ -1103,6 +1104,12 @@ extern SDL_DECLSPEC bool SDLCALL SDL_GetAudioStreamFormat(SDL_AudioStream *strea
* next sound file, and start putting that new data while the previous sound
* file is still queued, and everything will still play back correctly.
*
* If a stream is bound to a device, then the format of the side of the stream
* bound to a device cannot be changed (src_spec for recording devices,
* dst_spec for playback devices). Attempts to make a change to this side will
* be ignored, but this will not report an error. The other side's format can
* be changed.
*
* \param stream the stream the format is being changed.
* \param src_spec the new format of the audio input; if NULL, it is not
* changed.
@@ -1297,6 +1304,11 @@ extern SDL_DECLSPEC int * SDLCALL SDL_GetAudioStreamOutputChannelMap(SDL_AudioSt
* race condition hasn't changed the format while this call is setting the
* channel map.
*
* Unlike attempting to change the stream's format, the input channel map on a
* stream bound to a recording device is permitted to change at any time; any
* data added to the stream from the device after this call will have the new
* mapping, but previously-added data will still have the prior mapping.
*
* \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.
@@ -1348,6 +1360,13 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SetAudioStreamInputChannelMap(SDL_AudioStre
* race condition hasn't changed the format while this call is setting the
* channel map.
*
* Unlike attempting to change the stream's format, the output channel map on
* a stream bound to a recording device is permitted to change at any time;
* any data added to the stream after this call will have the new mapping, but
* previously-added data will still have the prior mapping. When the channel
* map doesn't match the hardware's channel layout, SDL will convert the data
* before feeding it to the device for playback.
*
* \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.
@@ -1576,6 +1595,26 @@ extern SDL_DECLSPEC bool SDLCALL SDL_PauseAudioStreamDevice(SDL_AudioStream *str
*/
extern SDL_DECLSPEC bool SDLCALL SDL_ResumeAudioStreamDevice(SDL_AudioStream *stream);
/**
* Use this function to query if an audio device associated with a stream is
* paused.
*
* Unlike in SDL2, audio devices start in an _unpaused_ state, since an app
* has to bind a stream before any audio will flow.
*
* \param stream the audio stream associated with the audio device to query.
* \returns true if device is valid and paused, false otherwise.
*
* \threadsafety It is safe to call this function from any thread.
*
* \since This function is available since SDL 3.1.10.
*
* \sa SDL_PauseAudioStreamDevice
* \sa SDL_ResumeAudioStreamDevice
*/
extern SDL_DECLSPEC bool SDLCALL SDL_AudioStreamDevicePaused(SDL_AudioStream *stream);
/**
* Lock an audio stream for serialized access.
*

View File

@@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages

View File

@@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
@@ -78,7 +78,7 @@ SDL_FORCE_INLINE int SDL_MostSignificantBitIndex32(Uint32 x)
return -1;
}
return _SDL_bsr_watcom(x);
#elif defined(_MSC_VER)
#elif defined(_MSC_VER) && _MSC_VER >= 1400
unsigned long index;
if (_BitScanReverse(&index, x)) {
return (int)index;

View File

@@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages

View File

@@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages

View File

@@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages

View File

@@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages

View File

@@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages

View File

@@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages

View File

@@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
@@ -94,6 +94,10 @@ typedef struct SDL_DialogFileFilter
* no filter was selected or if the platform or method doesn't support
* fetching the selected filter.
*
* In Android, the `filelist` are `content://` URIs. They should be opened
* using SDL_IOFromFile() with appropriate modes. This applies both to open
* and save file dialog.
*
* \param userdata an app-provided pointer, for the callback's use.
* \param filelist the file(s) chosen by the user.
* \param filter index of the selected filter.
@@ -308,7 +312,7 @@ typedef enum SDL_FileDialogType
* callback may be invoked from the same thread or from a
* different one, depending on the OS's constraints.
*
* \since This function is available since SDL 3.2.0.
* \since This function is available since SDL 3.1.8.
*
* \sa SDL_FileDialogType
* \sa SDL_DialogFileCallback

View File

@@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages

View File

@@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages

View File

@@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages

View File

@@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
@@ -38,10 +38,10 @@
* at all).
*
* There is other forms of control, too: SDL_PeepEvents() has more
* functionality at the cost of more complexity, and SDL_WaitEvents() can
* block the process until something interesting happens, which might be
* beneficial for certain types of programs on low-power hardware. One may
* also call SDL_AddEventWatch() to set a callback when new events arrive.
* functionality at the cost of more complexity, and SDL_WaitEvent() can block
* the process until something interesting happens, which might be beneficial
* for certain types of programs on low-power hardware. One may also call
* SDL_AddEventWatch() to set a callback when new events arrive.
*
* The app is free to generate their own events, too: SDL_PushEvent allows the
* app to put events onto the queue for later retrieval; SDL_RegisterEvents
@@ -212,6 +212,7 @@ typedef enum SDL_EventType
SDL_EVENT_FINGER_DOWN = 0x700,
SDL_EVENT_FINGER_UP,
SDL_EVENT_FINGER_MOTION,
SDL_EVENT_FINGER_CANCELED,
/* 0x800, 0x801, and 0x802 were the Gesture events from SDL2. Do not reuse these values! sdl2-compat needs them! */
@@ -764,7 +765,7 @@ typedef struct SDL_RenderEvent
*/
typedef struct SDL_TouchFingerEvent
{
SDL_EventType type; /**< SDL_EVENT_FINGER_MOTION or SDL_EVENT_FINGER_DOWN or SDL_EVENT_FINGER_UP */
SDL_EventType type; /**< SDL_EVENT_FINGER_DOWN, SDL_EVENT_FINGER_UP, SDL_EVENT_FINGER_MOTION, or SDL_EVENT_FINGER_CANCELED */
Uint32 reserved;
Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
SDL_TouchID touchID; /**< The touch device id */
@@ -919,8 +920,8 @@ typedef struct SDL_ClipboardEvent
SDL_EventType type; /**< SDL_EVENT_CLIPBOARD_UPDATE */
Uint32 reserved;
Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
bool owner; /**< are we owning the clipboard (internal update) */
Sint32 n_mime_types; /**< number of mime types */
bool owner; /**< are we owning the clipboard (internal update) */
Sint32 num_mime_types; /**< number of mime types */
const char **mime_types; /**< current mime types */
} SDL_ClipboardEvent;
@@ -1376,8 +1377,11 @@ extern SDL_DECLSPEC bool SDLCALL SDL_PushEvent(SDL_Event *event);
typedef 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.
* Set up a filter to process all events before they are added to the internal
* event queue.
*
* If you just want to see events without modifying them or preventing them
* from being queued, you should use SDL_AddEventWatch() instead.
*
* If the filter function returns true when called, then the event will be
* added to the internal queue. If it returns false, then the event will be
@@ -1391,17 +1395,9 @@ typedef bool (SDLCALL *SDL_EventFilter)(void *userdata, SDL_Event *event);
* interrupt signal (e.g. pressing Ctrl-C), it will be delivered to the
* application at the next event poll.
*
* There is one caveat when dealing with the SDL_QuitEvent event type. The
* event filter is only called when the window manager desires to close the
* application window. If the event filter returns 1, then the window will be
* closed, otherwise the window will remain open if possible.
*
* Note: Disabled events never make it to the event filter function; see
* SDL_SetEventEnabled().
*
* Note: If you just want to inspect events without filtering, you should use
* SDL_AddEventWatch() instead.
*
* Note: Events pushed onto the queue with SDL_PushEvent() get passed through
* the event filter, but events pushed onto the queue with SDL_PeepEvents() do
* not.

View File

@@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
@@ -22,7 +22,23 @@
/**
* # CategoryFilesystem
*
* SDL Filesystem API.
* SDL offers an API for examining and manipulating the system's filesystem.
* This covers most things one would need to do with directories, except for
* actual file I/O (which is covered by [CategoryIOStream](CategoryIOStream)
* and [CategoryAsyncIO](CategoryAsyncIO) instead).
*
* There are functions to answer necessary path questions:
*
* - Where is my app's data? SDL_GetBasePath().
* - Where can I safely write files? SDL_GetPrefPath().
* - Where are paths like Downloads, Desktop, Music? SDL_GetUserFolder().
* - What is this thing at this location? SDL_GetPathInfo().
* - What items live in this folder? SDL_EnumerateDirectory().
* - What items live in this folder by wildcard? SDL_GlobDirectory().
* - What is my current working directory? SDL_GetCurrentDirectory().
*
* SDL also offers functions to manipulate the directory tree: renaming,
* removing, copying files.
*/
#ifndef SDL_filesystem_h_
@@ -297,6 +313,9 @@ typedef enum SDL_EnumerationResult
* terminate the enumeration early, and dictate the return value of the
* enumeration function itself.
*
* `dirname` is guaranteed to end with a path separator ('\\' on Windows, '/'
* on most other platforms).
*
* \param userdata an app-controlled pointer that is passed to the callback.
* \param dirname the directory that is being enumerated.
* \param fname the next entry in the enumeration.
@@ -425,10 +444,10 @@ extern SDL_DECLSPEC bool SDLCALL SDL_GetPathInfo(const char *path, SDL_PathInfo
* Enumerate a directory tree, filtered by pattern, and return a list.
*
* Files are filtered out if they don't match the string in `pattern`, which
* may contain wildcard characters '*' (match everything) and '?' (match one
* may contain wildcard characters '\*' (match everything) and '?' (match one
* character). If pattern is NULL, no filtering is done and all results are
* returned. Subdirectories are permitted, and are specified with a path
* separator of '/'. Wildcard characters '*' and '?' never match a path
* separator of '/'. Wildcard characters '\*' and '?' never match a path
* separator.
*
* `flags` may be set to SDL_GLOB_CASEINSENSITIVE to make the pattern matching
@@ -464,11 +483,14 @@ extern SDL_DECLSPEC char ** SDLCALL SDL_GlobDirectory(const char *path, const ch
* platforms without this concept, this would cause surprises with file access
* outside of SDL.
*
* The returned path is guaranteed to end with a path separator ('\\' on
* Windows, '/' on most other platforms).
*
* \returns a UTF-8 string of the current working directory in
* platform-dependent notation. NULL if there's a problem. This
* should be freed with SDL_free() when it is no longer needed.
*
* \since This function is available since SDL 3.2.0.
* \since This function is available since SDL 3.1.8.
*/
extern SDL_DECLSPEC char * SDLCALL SDL_GetCurrentDirectory(void);

View File

@@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
@@ -63,6 +63,12 @@
* By default SDL will try to use the most capable driver available, but you
* can tune which OS drivers to use with the various joystick hints in
* SDL_hints.h.
*
* Your application should always support gamepad hotplugging. On some
* platforms like Xbox, Steam Deck, etc., this is a requirement for
* certification. On other platforms, like macOS and Windows when using
* Windows.Gaming.Input, controllers may not be available at startup and will
* come in at some point after you've started processing events.
*/
#ifndef SDL_gamepad_h_

View File

@@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
@@ -149,6 +149,29 @@
* [here](https://github.com/TheSpydog/SDL_gpu_examples)
* .
*
* ## Performance considerations
*
* Here are some basic tips for maximizing your rendering performance.
*
* - Beginning a new render pass is relatively expensive. Use as few render
* passes as you can.
* - Minimize the amount of state changes. For example, binding a pipeline is
* relatively cheap, but doing it hundreds of times when you don't need to
* will slow the performance significantly.
* - Perform your data uploads as early as possible in the frame.
* - Don't churn resources. Creating and releasing resources is expensive.
* It's better to create what you need up front and cache it.
* - Don't use uniform buffers for large amounts of data (more than a matrix
* or so). Use a storage buffer instead.
* - Use cycling correctly. There is a detailed explanation of cycling further
* below.
* - Use culling techniques to minimize pixel writes. The less writing the GPU
* has to do the better. Culling can be a very advanced topic but even
* simple culling techniques can boost performance significantly.
*
* In general try to remember the golden rule of performance: doing things is
* more expensive than not doing things. Don't Touch The Driver!
*
* ## FAQ
*
* **Question: When are you adding more advanced features, like ray tracing or
@@ -174,6 +197,16 @@
* reflection to extract the required information from the shader
* automatically instead of manually filling in the struct's values.
*
* **Question: My application isn't performing very well. Is this the GPU
* API's fault?**
*
* Answer: No. Long answer: The GPU API is a relatively thin layer over the
* underlying graphics API. While it's possible that we have done something
* inefficiently, it's very unlikely especially if you are relatively
* inexperienced with GPU rendering. Please see the performance tips above and
* make sure you are following them. Additionally, tools like RenderDoc can be
* very helpful for diagnosing incorrect behavior and performance issues.
*
* ## System Requirements
*
* **Vulkan:** Supported on Windows, Linux, Nintendo Switch, and certain
@@ -301,7 +334,6 @@ typedef struct SDL_GPUDevice SDL_GPUDevice;
* \since This struct is available since SDL 3.1.3
*
* \sa SDL_CreateGPUBuffer
* \sa SDL_SetGPUBufferName
* \sa SDL_UploadToGPUBuffer
* \sa SDL_DownloadFromGPUBuffer
* \sa SDL_CopyGPUBufferToBuffer
@@ -341,7 +373,6 @@ typedef struct SDL_GPUTransferBuffer SDL_GPUTransferBuffer;
* \since This struct is available since SDL 3.1.3
*
* \sa SDL_CreateGPUTexture
* \sa SDL_SetGPUTextureName
* \sa SDL_UploadToGPUTexture
* \sa SDL_DownloadFromGPUTexture
* \sa SDL_CopyGPUTextureToTexture
@@ -484,6 +515,20 @@ typedef struct SDL_GPUFence SDL_GPUFence;
/**
* Specifies the primitive topology of a graphics pipeline.
*
* If you are using POINTLIST you must include a point size output in the
* vertex shader.
*
* - For HLSL compiling to SPIRV you must decorate a float output with
* [[vk::builtin("PointSize")]].
* - For GLSL you must set the gl_PointSize builtin.
* - For MSL you must include a float output with the [[point_size]]
* decorator.
*
* Note that sized point topology is totally unsupported on D3D12. Any size
* other than 1 will be ignored. In general, you should avoid using point
* topology for both compatibility and performance reasons. You WILL regret
* using it.
*
* \since This enum is available since SDL 3.1.3
*
* \sa SDL_CreateGPUGraphicsPipeline
@@ -1386,8 +1431,10 @@ typedef struct SDL_GPUBufferRegion
*
* Note that the `first_vertex` and `first_instance` parameters are NOT
* compatible with built-in vertex/instance ID variables in shaders (for
* example, SV_VertexID). If your shader depends on these variables, the
* correlating draw call parameter MUST be 0.
* example, SV_VertexID); GPU APIs and shader languages do not define these
* built-in variables consistently, so if your shader depends on them, the
* only way to keep behavior consistent and portable is to always pass 0 for
* the correlating parameter in the draw calls.
*
* \since This struct is available since SDL 3.1.3
*
@@ -1406,8 +1453,10 @@ typedef struct SDL_GPUIndirectDrawCommand
*
* Note that the `first_vertex` and `first_instance` parameters are NOT
* compatible with built-in vertex/instance ID variables in shaders (for
* example, SV_VertexID). If your shader depends on these variables, the
* correlating draw call parameter MUST be 0.
* example, SV_VertexID); GPU APIs and shader languages do not define these
* built-in variables consistently, so if your shader depends on them, the
* only way to keep behavior consistent and portable is to always pass 0 for
* the correlating parameter in the draw calls.
*
* \since This struct is available since SDL 3.1.3
*
@@ -1518,6 +1567,8 @@ typedef struct SDL_GPUVertexAttribute
* \since This struct is available since SDL 3.1.3
*
* \sa SDL_GPUGraphicsPipelineCreateInfo
* \sa SDL_GPUVertexBufferDescription
* \sa SDL_GPUVertexAttribute
*/
typedef struct SDL_GPUVertexInputState
{
@@ -1597,6 +1648,10 @@ typedef struct SDL_GPUShaderCreateInfo
* \since This struct is available since SDL 3.1.3
*
* \sa SDL_CreateGPUTexture
* \sa SDL_GPUTextureType
* \sa SDL_GPUTextureFormat
* \sa SDL_GPUTextureUsageFlags
* \sa SDL_GPUSampleCount
*/
typedef struct SDL_GPUTextureCreateInfo
{
@@ -2075,7 +2130,7 @@ extern SDL_DECLSPEC SDL_GPUDevice *SDLCALL SDL_CreateGPUDevice(
* provide SPIR-V shaders if applicable.
* - `SDL_PROP_GPU_DEVICE_CREATE_SHADERS_DXBC_BOOLEAN`: The app is able to
* provide DXBC shaders if applicable
* `SDL_PROP_GPU_DEVICE_CREATE_SHADERS_DXIL_BOOLEAN`: The app is able to
* - `SDL_PROP_GPU_DEVICE_CREATE_SHADERS_DXIL_BOOLEAN`: The app is able to
* provide DXIL shaders if applicable.
* - `SDL_PROP_GPU_DEVICE_CREATE_SHADERS_MSL_BOOLEAN`: The app is able to
* provide MSL shaders if applicable.
@@ -2204,6 +2259,12 @@ extern SDL_DECLSPEC SDL_GPUShaderFormat SDLCALL SDL_GetGPUShaderFormats(SDL_GPUD
* - [[texture]]: Sampled textures, followed by read-only storage textures,
* followed by read-write storage textures
*
* There are optional properties that can be provided through `props`. These
* are the supported properties:
*
* - `SDL_PROP_GPU_COMPUTEPIPELINE_CREATE_NAME_STRING`: a name that can be
* displayed in debugging tools.
*
* \param device a GPU Context.
* \param createinfo a struct describing the state of the compute pipeline to
* create.
@@ -2219,9 +2280,17 @@ extern SDL_DECLSPEC SDL_GPUComputePipeline *SDLCALL SDL_CreateGPUComputePipeline
SDL_GPUDevice *device,
const SDL_GPUComputePipelineCreateInfo *createinfo);
#define SDL_PROP_GPU_COMPUTEPIPELINE_CREATE_NAME_STRING "SDL.gpu.computepipeline.create.name"
/**
* Creates a pipeline object to be used in a graphics workflow.
*
* There are optional properties that can be provided through `props`. These
* are the supported properties:
*
* - `SDL_PROP_GPU_GRAPHICSPIPELINE_CREATE_NAME_STRING`: a name that can be
* displayed in debugging tools.
*
* \param device a GPU Context.
* \param createinfo a struct describing the state of the graphics pipeline to
* create.
@@ -2238,10 +2307,18 @@ extern SDL_DECLSPEC SDL_GPUGraphicsPipeline *SDLCALL SDL_CreateGPUGraphicsPipeli
SDL_GPUDevice *device,
const SDL_GPUGraphicsPipelineCreateInfo *createinfo);
#define SDL_PROP_GPU_GRAPHICSPIPELINE_CREATE_NAME_STRING "SDL.gpu.graphicspipeline.create.name"
/**
* Creates a sampler object to be used when binding textures in a graphics
* workflow.
*
* There are optional properties that can be provided through `props`. These
* are the supported properties:
*
* - `SDL_PROP_GPU_SAMPLER_CREATE_NAME_STRING`: a name that can be displayed
* in debugging tools.
*
* \param device a GPU Context.
* \param createinfo a struct describing the state of the sampler to create.
* \returns a sampler object on success, or NULL on failure; call
@@ -2257,6 +2334,8 @@ extern SDL_DECLSPEC SDL_GPUSampler *SDLCALL SDL_CreateGPUSampler(
SDL_GPUDevice *device,
const SDL_GPUSamplerCreateInfo *createinfo);
#define SDL_PROP_GPU_SAMPLER_CREATE_NAME_STRING "SDL.gpu.sampler.create.name"
/**
* Creates a shader to be used when creating a graphics pipeline.
*
@@ -2314,6 +2393,12 @@ extern SDL_DECLSPEC SDL_GPUSampler *SDLCALL SDL_CreateGPUSampler(
* SDL_PROP_GPU_DEVICE_CREATE_D3D12_SEMANTIC_NAME_STRING with
* SDL_CreateGPUDeviceWithProperties().
*
* There are optional properties that can be provided through `props`. These
* are the supported properties:
*
* - `SDL_PROP_GPU_SHADER_CREATE_NAME_STRING`: a name that can be displayed in
* debugging tools.
*
* \param device a GPU Context.
* \param createinfo a struct describing the state of the shader to create.
* \returns a shader object on success, or NULL on failure; call
@@ -2328,6 +2413,8 @@ extern SDL_DECLSPEC SDL_GPUShader *SDLCALL SDL_CreateGPUShader(
SDL_GPUDevice *device,
const SDL_GPUShaderCreateInfo *createinfo);
#define SDL_PROP_GPU_SHADER_CREATE_NAME_STRING "SDL.gpu.shader.create.name"
/**
* Creates a texture object to be used in graphics or compute workflows.
*
@@ -2344,27 +2431,26 @@ extern SDL_DECLSPEC SDL_GPUShader *SDLCALL SDL_CreateGPUShader(
* There are optional properties that can be provided through
* SDL_GPUTextureCreateInfo's `props`. These are the supported properties:
*
* - `SDL_PROP_PROCESS_CREATE_ARGS_POINTER`: an array of strings containing
* the program to run, any arguments, and a NULL pointer, e.g. const char
* *args[] = { "myprogram", "argument", NULL }. This is a required property.
* - `SDL_PROP_GPU_CREATETEXTURE_D3D12_CLEAR_R_FLOAT`: (Direct3D 12 only) if
* - `SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_R_FLOAT`: (Direct3D 12 only) if
* the texture usage is SDL_GPU_TEXTUREUSAGE_COLOR_TARGET, clear the texture
* to a color with this red intensity. Defaults to zero.
* - `SDL_PROP_GPU_CREATETEXTURE_D3D12_CLEAR_G_FLOAT`: (Direct3D 12 only) if
* - `SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_G_FLOAT`: (Direct3D 12 only) if
* the texture usage is SDL_GPU_TEXTUREUSAGE_COLOR_TARGET, clear the texture
* to a color with this green intensity. Defaults to zero.
* - `SDL_PROP_GPU_CREATETEXTURE_D3D12_CLEAR_B_FLOAT`: (Direct3D 12 only) if
* - `SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_B_FLOAT`: (Direct3D 12 only) if
* the texture usage is SDL_GPU_TEXTUREUSAGE_COLOR_TARGET, clear the texture
* to a color with this blue intensity. Defaults to zero.
* - `SDL_PROP_GPU_CREATETEXTURE_D3D12_CLEAR_A_FLOAT`: (Direct3D 12 only) if
* - `SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_A_FLOAT`: (Direct3D 12 only) if
* the texture usage is SDL_GPU_TEXTUREUSAGE_COLOR_TARGET, clear the texture
* to a color with this alpha intensity. Defaults to zero.
* - `SDL_PROP_GPU_CREATETEXTURE_D3D12_CLEAR_DEPTH_FLOAT`: (Direct3D 12 only)
* - `SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_DEPTH_FLOAT`: (Direct3D 12 only)
* if the texture usage is SDL_GPU_TEXTUREUSAGE_DEPTH_STENCIL_TARGET, clear
* the texture to a depth of this value. Defaults to zero.
* - `SDL_PROP_GPU_CREATETEXTURE_D3D12_CLEAR_STENCIL_UINT8`: (Direct3D 12
* - `SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_STENCIL_UINT8`: (Direct3D 12
* only) if the texture usage is SDL_GPU_TEXTUREUSAGE_DEPTH_STENCIL_TARGET,
* clear the texture to a stencil of this value. Defaults to zero.
* - `SDL_PROP_GPU_TEXTURE_CREATE_NAME_STRING`: a name that can be displayed
* in debugging tools.
*
* \param device a GPU Context.
* \param createinfo a struct describing the state of the texture to create.
@@ -2388,13 +2474,13 @@ extern SDL_DECLSPEC SDL_GPUTexture *SDLCALL SDL_CreateGPUTexture(
SDL_GPUDevice *device,
const SDL_GPUTextureCreateInfo *createinfo);
#define SDL_PROP_GPU_CREATETEXTURE_D3D12_CLEAR_R_FLOAT "SDL.gpu.createtexture.d3d12.clear.r"
#define SDL_PROP_GPU_CREATETEXTURE_D3D12_CLEAR_G_FLOAT "SDL.gpu.createtexture.d3d12.clear.g"
#define SDL_PROP_GPU_CREATETEXTURE_D3D12_CLEAR_B_FLOAT "SDL.gpu.createtexture.d3d12.clear.b"
#define SDL_PROP_GPU_CREATETEXTURE_D3D12_CLEAR_A_FLOAT "SDL.gpu.createtexture.d3d12.clear.a"
#define SDL_PROP_GPU_CREATETEXTURE_D3D12_CLEAR_DEPTH_FLOAT "SDL.gpu.createtexture.d3d12.clear.depth"
#define SDL_PROP_GPU_CREATETEXTURE_D3D12_CLEAR_STENCIL_UINT8 "SDL.gpu.createtexture.d3d12.clear.stencil"
#define SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_R_FLOAT "SDL.gpu.texture.create.d3d12.clear.r"
#define SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_G_FLOAT "SDL.gpu.texture.create.d3d12.clear.g"
#define SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_B_FLOAT "SDL.gpu.texture.create.d3d12.clear.b"
#define SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_A_FLOAT "SDL.gpu.texture.create.d3d12.clear.a"
#define SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_DEPTH_FLOAT "SDL.gpu.texture.create.d3d12.clear.depth"
#define SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_STENCIL_UINT8 "SDL.gpu.texture.create.d3d12.clear.stencil"
#define SDL_PROP_GPU_TEXTURE_CREATE_NAME_STRING "SDL.gpu.texture.create.name"
/**
* Creates a buffer object to be used in graphics or compute workflows.
@@ -2410,6 +2496,12 @@ extern SDL_DECLSPEC SDL_GPUTexture *SDLCALL SDL_CreateGPUTexture(
* [this blog post](https://moonside.games/posts/sdl-gpu-concepts-cycling/)
* .
*
* There are optional properties that can be provided through `props`. These
* are the supported properties:
*
* - `SDL_PROP_GPU_BUFFER_CREATE_NAME_STRING`: a name that can be displayed in
* debugging tools.
*
* \param device a GPU Context.
* \param createinfo a struct describing the state of the buffer to create.
* \returns a buffer object on success, or NULL on failure; call
@@ -2417,7 +2509,6 @@ extern SDL_DECLSPEC SDL_GPUTexture *SDLCALL SDL_CreateGPUTexture(
*
* \since This function is available since SDL 3.1.3.
*
* \sa SDL_SetGPUBufferName
* \sa SDL_UploadToGPUBuffer
* \sa SDL_DownloadFromGPUBuffer
* \sa SDL_CopyGPUBufferToBuffer
@@ -2435,6 +2526,8 @@ extern SDL_DECLSPEC SDL_GPUBuffer *SDLCALL SDL_CreateGPUBuffer(
SDL_GPUDevice *device,
const SDL_GPUBufferCreateInfo *createinfo);
#define SDL_PROP_GPU_BUFFER_CREATE_NAME_STRING "SDL.gpu.buffer.create.name"
/**
* Creates a transfer buffer to be used when uploading to or downloading from
* graphics resources.
@@ -2442,6 +2535,12 @@ extern SDL_DECLSPEC SDL_GPUBuffer *SDLCALL SDL_CreateGPUBuffer(
* Download buffers can be particularly expensive to create, so it is good
* practice to reuse them if data will be downloaded regularly.
*
* There are optional properties that can be provided through `props`. These
* are the supported properties:
*
* - `SDL_PROP_GPU_TRANSFERBUFFER_CREATE_NAME_STRING`: a name that can be
* displayed in debugging tools.
*
* \param device a GPU Context.
* \param createinfo a struct describing the state of the transfer buffer to
* create.
@@ -2460,18 +2559,26 @@ extern SDL_DECLSPEC SDL_GPUTransferBuffer *SDLCALL SDL_CreateGPUTransferBuffer(
SDL_GPUDevice *device,
const SDL_GPUTransferBufferCreateInfo *createinfo);
#define SDL_PROP_GPU_TRANSFERBUFFER_CREATE_NAME_STRING "SDL.gpu.transferbuffer.create.name"
/* Debug Naming */
/**
* Sets an arbitrary string constant to label a buffer.
*
* Useful for debugging.
* You should use SDL_PROP_GPU_BUFFER_CREATE_NAME_STRING with
* SDL_CreateGPUBuffer instead of this function to avoid thread safety issues.
*
* \param device a GPU Context.
* \param buffer a buffer to attach the name to.
* \param text a UTF-8 string constant to mark as the name of the buffer.
*
* \threadsafety This function is not thread safe, you must make sure the
* buffer is not simultaneously used by any other thread.
*
* \since This function is available since SDL 3.1.3.
*
* \sa SDL_CreateGPUBuffer
*/
extern SDL_DECLSPEC void SDLCALL SDL_SetGPUBufferName(
SDL_GPUDevice *device,
@@ -2481,13 +2588,20 @@ extern SDL_DECLSPEC void SDLCALL SDL_SetGPUBufferName(
/**
* Sets an arbitrary string constant to label a texture.
*
* Useful for debugging.
* You should use SDL_PROP_GPU_TEXTURE_CREATE_NAME_STRING with
* SDL_CreateGPUTexture instead of this function to avoid thread safety
* issues.
*
* \param device a GPU Context.
* \param texture a texture to attach the name to.
* \param text a UTF-8 string constant to mark as the name of the texture.
*
* \threadsafety This function is not thread safe, you must make sure the
* texture is not simultaneously used by any other thread.
*
* \since This function is available since SDL 3.1.3.
*
* \sa SDL_CreateGPUTexture
*/
extern SDL_DECLSPEC void SDLCALL SDL_SetGPUTextureName(
SDL_GPUDevice *device,
@@ -2986,8 +3100,10 @@ extern SDL_DECLSPEC void SDLCALL SDL_BindGPUFragmentStorageBuffers(
*
* Note that the `first_vertex` and `first_instance` parameters are NOT
* compatible with built-in vertex/instance ID variables in shaders (for
* example, SV_VertexID). If your shader depends on these variables, the
* correlating draw call parameter MUST be 0.
* example, SV_VertexID); GPU APIs and shader languages do not define these
* built-in variables consistently, so if your shader depends on them, the
* only way to keep behavior consistent and portable is to always pass 0 for
* the correlating parameter in the draw calls.
*
* \param render_pass a render pass handle.
* \param num_indices the number of indices to draw per instance.
@@ -3014,8 +3130,10 @@ extern SDL_DECLSPEC void SDLCALL SDL_DrawGPUIndexedPrimitives(
*
* Note that the `first_vertex` and `first_instance` parameters are NOT
* compatible with built-in vertex/instance ID variables in shaders (for
* example, SV_VertexID). If your shader depends on these variables, the
* correlating draw call parameter MUST be 0.
* example, SV_VertexID); GPU APIs and shader languages do not define these
* built-in variables consistently, so if your shader depends on them, the
* only way to keep behavior consistent and portable is to always pass 0 for
* the correlating parameter in the draw calls.
*
* \param render_pass a render pass handle.
* \param num_vertices the number of vertices to draw.
@@ -3617,7 +3735,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SetGPUSwapchainParameters(
* \returns true if successful, false on error; call SDL_GetError() for more
* information.
*
* \since This function is available since SDL 3.2.0.
* \since This function is available since SDL 3.1.8.
*/
extern SDL_DECLSPEC bool SDLCALL SDL_SetGPUAllowedFramesInFlight(
SDL_GPUDevice *device,
@@ -3702,7 +3820,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_AcquireGPUSwapchainTexture(
* \threadsafety This function should only be called from the thread that
* created the window.
*
* \since This function is available since SDL 3.2.0.
* \since This function is available since SDL 3.1.8.
*
* \sa SDL_AcquireGPUSwapchainTexture
* \sa SDL_WaitAndAcquireGPUSwapchainTexture
@@ -3745,7 +3863,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_WaitForGPUSwapchain(
* \threadsafety This function should only be called from the thread that
* created the window.
*
* \since This function is available since SDL 3.2.0.
* \since This function is available since SDL 3.1.8.
*
* \sa SDL_SubmitGPUCommandBuffer
* \sa SDL_SubmitGPUCommandBufferAndAcquireFence

View File

@@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages

View File

@@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages

View File

@@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages

View File

@@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
@@ -730,6 +730,7 @@ extern "C" {
* - "#document": the javascript document object
* - "#screen": the javascript window.screen object
* - "#canvas": the WebGL canvas element
* - "#none": Don't bind anything at all
* - any other string without a leading # sign applies to the element on the
* page with that ID.
*
@@ -1264,6 +1265,31 @@ extern "C" {
*/
#define SDL_HINT_JOYSTICK_DEVICE "SDL_JOYSTICK_DEVICE"
/**
* A variable controlling whether enhanced reports should be used for
* controllers when using the HIDAPI driver.
*
* Enhanced reports allow rumble and effects on Bluetooth PlayStation
* controllers and gyro on Nintendo Switch controllers, but break Windows
* DirectInput for other applications that don't use SDL.
*
* Once enhanced reports are enabled, they can't be disabled on PlayStation
* controllers without power cycling the controller.
*
* The variable can be set to the following values:
*
* - "0": enhanced reports are not enabled.
* - "1": enhanced reports are enabled. (default)
* - "auto": enhanced features are advertised to the application, but SDL
* doesn't change the controller report mode unless the application uses
* them.
*
* This hint can be enabled anytime.
*
* \since This hint is available since SDL 3.1.8.
*/
#define SDL_HINT_JOYSTICK_ENHANCED_REPORTS "SDL_JOYSTICK_ENHANCED_REPORTS"
/**
* A variable containing a list of flightstick style controllers.
*
@@ -1571,32 +1597,6 @@ extern "C" {
*/
#define SDL_HINT_JOYSTICK_HIDAPI_PS4_REPORT_INTERVAL "SDL_JOYSTICK_HIDAPI_PS4_REPORT_INTERVAL"
/**
* A variable controlling whether extended input reports should be used for
* PS4 controllers when using the HIDAPI driver.
*
* The variable can be set to the following values:
*
* - "0": extended reports are not enabled. (default)
* - "1": extended reports are enabled.
*
* Extended input reports allow rumble on Bluetooth PS4 controllers, but break
* DirectInput handling for applications that don't use SDL.
*
* Once extended reports are enabled, they can not be disabled without power
* cycling the controller.
*
* For compatibility with applications written for versions of SDL prior to
* the introduction of PS5 controller support, this value will also control
* the state of extended reports on PS5 controllers when the
* SDL_HINT_JOYSTICK_HIDAPI_PS5_RUMBLE hint is not explicitly set.
*
* This hint can be enabled anytime.
*
* \since This hint is available since SDL 3.1.3.
*/
#define SDL_HINT_JOYSTICK_HIDAPI_PS4_RUMBLE "SDL_JOYSTICK_HIDAPI_PS4_RUMBLE"
/**
* A variable controlling whether the HIDAPI driver for PS5 controllers should
* be used.
@@ -1627,31 +1627,6 @@ extern "C" {
*/
#define SDL_HINT_JOYSTICK_HIDAPI_PS5_PLAYER_LED "SDL_JOYSTICK_HIDAPI_PS5_PLAYER_LED"
/**
* A variable controlling whether extended input reports should be used for
* PS5 controllers when using the HIDAPI driver.
*
* The variable can be set to the following values:
*
* - "0": extended reports are not enabled. (default)
* - "1": extended reports.
*
* Extended input reports allow rumble on Bluetooth PS5 controllers, but break
* DirectInput handling for applications that don't use SDL.
*
* Once extended reports are enabled, they can not be disabled without power
* cycling the controller.
*
* For compatibility with applications written for versions of SDL prior to
* the introduction of PS5 controller support, this value defaults to the
* value of SDL_HINT_JOYSTICK_HIDAPI_PS4_RUMBLE.
*
* This hint can be enabled anytime.
*
* \since This hint is available since SDL 3.1.3.
*/
#define SDL_HINT_JOYSTICK_HIDAPI_PS5_RUMBLE "SDL_JOYSTICK_HIDAPI_PS5_RUMBLE"
/**
* A variable controlling whether the HIDAPI driver for NVIDIA SHIELD
* controllers should be used.
@@ -2098,8 +2073,8 @@ extern "C" {
*
* The variable can be set to the following values:
*
* - "0": A separate thread is not used. (default)
* - "1": A separate thread is used for handling raw input messages.
* - "0": A separate thread is not used.
* - "1": A separate thread is used for handling raw input messages. (default)
*
* This hint should be set before SDL is initialized.
*
@@ -2373,6 +2348,31 @@ extern "C" {
*/
#define SDL_HINT_MAC_OPENGL_ASYNC_DISPATCH "SDL_MAC_OPENGL_ASYNC_DISPATCH"
/**
* A variable controlling whether the Option () key on macOS should be
* remapped to act as the Alt key.
*
* The variable can be set to the following values:
*
* - "none": The Option key is not remapped to Alt. (default)
* - "only_left": Only the left Option key is remapped to Alt.
* - "only_right": Only the right Option key is remapped to Alt.
* - "both": Both Option keys are remapped to Alt.
*
* This will prevent the triggering of key compositions that rely on the
* Option key, but will still send the Alt modifier for keyboard events. In
* the case that both Alt and Option are pressed, the Option key will be
* ignored. This is particularly useful for applications like terminal
* emulators and graphical user interfaces (GUIs) that rely on Alt key
* functionality for shortcuts or navigation. This does not apply to
* SDL_GetKeyFromScancode and only has an effect if IME is enabled.
*
* This hint can be set anytime.
*
* \since This hint is available since 3.2.0
*/
#define SDL_HINT_MAC_OPTION_AS_ALT "SDL_MAC_OPTION_AS_ALT"
/**
* A variable controlling whether SDL_EVENT_MOUSE_WHEEL event values will have
* momentum on macOS.
@@ -2391,13 +2391,21 @@ extern "C" {
/**
* Request SDL_AppIterate() be called at a specific rate.
*
* This number is in Hz, so "60" means try to iterate 60 times per second.
* If this is set to a number, it represents Hz, so "60" means try to iterate
* 60 times per second. "0" means to iterate as fast as possible. Negative
* values are illegal, but reserved, in case they are useful in a future
* revision of SDL.
*
* There are other strings that have special meaning. If set to "waitevent",
* SDL_AppIterate will not be called until new event(s) have arrived (and been
* processed by SDL_AppEvent). This can be useful for apps that are completely
* idle except in response to input.
*
* On some platforms, or if you are using SDL_main instead of SDL_AppIterate,
* this hint is ignored. When the hint can be used, it is allowed to be
* changed at any time.
*
* This defaults to 60, and specifying NULL for the hint's value will restore
* This defaults to 0, and specifying NULL for the hint's value will restore
* the default.
*
* This hint can be set anytime.
@@ -2552,7 +2560,7 @@ extern "C" {
* - "1": Relative mouse motion will be scaled using the system mouse
* acceleration curve.
*
* If SDL_HINT_MOUSE_RELATIVE_SPEED_SCALE is set, that will override the
* If SDL_HINT_MOUSE_RELATIVE_SPEED_SCALE is set, that will be applied after
* system speed scale.
*
* This hint can be set anytime.
@@ -2653,12 +2661,25 @@ extern "C" {
* Specify the OpenGL library to load.
*
* This hint should be set before creating an OpenGL window or creating an
* OpenGL context.
* OpenGL context. If this hint isn't set, SDL will choose a reasonable
* default.
*
* \since This hint is available since SDL 3.1.3.
*/
#define SDL_HINT_OPENGL_LIBRARY "SDL_OPENGL_LIBRARY"
/**
* Specify the EGL library to load.
*
* This hint should be set before creating an OpenGL window or creating an
* OpenGL context. This hint is only considered if SDL is using EGL to manage
* OpenGL contexts. If this hint isn't set, SDL will choose a reasonable
* default.
*
* \since This hint is available since SDL 3.2.0.
*/
#define SDL_HINT_EGL_LIBRARY "SDL_EGL_LIBRARY"
/**
* A variable controlling what driver to use for OpenGL ES contexts.
*
@@ -2775,6 +2796,10 @@ extern "C" {
* - "1": SDL will send a quit event when the last window is requesting to
* close. (default)
*
* If there is at least one active system tray icon, SDL_EVENT_QUIT will
* instead be sent when both the last window will be closed and the last tray
* icon will be destroyed.
*
* This hint can be set anytime.
*
* \since This hint is available since SDL 3.1.3.
@@ -3331,6 +3356,27 @@ extern "C" {
*/
#define SDL_HINT_VIDEO_MAC_FULLSCREEN_SPACES "SDL_VIDEO_MAC_FULLSCREEN_SPACES"
/**
* A variable that specifies the menu visibility when a window is fullscreen
* in Spaces on macOS.
*
* The variable can be set to the following values:
*
* - "0": The menu will be hidden when the window is in a fullscreen space,
* and not accessible by moving the mouse to the top of the screen.
* - "1": The menu will be accessible when the window is in a fullscreen
* space.
* - "auto": The menu will be hidden if fullscreen mode was toggled on
* programmatically via `SDL_SetWindowFullscreen()`, and accessible if
* fullscreen was entered via the "fullscreen" button on the window title
* bar. (default)
*
* This hint can be set anytime.
*
* \since This hint is available since SDL 3.1.9.
*/
#define SDL_HINT_VIDEO_MAC_FULLSCREEN_MENU_VISIBILITY "SDL_VIDEO_MAC_FULLSCREEN_MENU_VISIBILITY"
/**
* A variable controlling whether fullscreen windows are minimized when they
* lose focus.
@@ -3485,6 +3531,8 @@ extern "C" {
*
* - Rounding errors can result with odd window sizes and/or desktop scales,
* which can cause the window contents to appear slightly blurry.
* - Positioning the window may be imprecise due to unit conversions and
* rounding.
* - The window may be unusably small on scaled desktops.
* - The window may jump in size when moving between displays of different
* scale factors.
@@ -4163,6 +4211,36 @@ extern "C" {
*/
#define SDL_HINT_ASSERT "SDL_ASSERT"
/**
* A variable controlling whether pen events should generate synthetic mouse
* events.
*
* The variable can be set to the following values:
*
* - "0": Pen events will not generate mouse events.
* - "1": Pen events will generate mouse events. (default)
*
* This hint can be set anytime.
*
* \since This hint is available since SDL 3.2.0.
*/
#define SDL_HINT_PEN_MOUSE_EVENTS "SDL_PEN_MOUSE_EVENTS"
/**
* A variable controlling whether pen events should generate synthetic touch
* events.
*
* The variable can be set to the following values:
*
* - "0": Pen events will not generate touch events.
* - "1": Pen events will generate touch events. (default)
*
* This hint can be set anytime.
*
* \since This hint is available since SDL 3.2.0.
*/
#define SDL_HINT_PEN_TOUCH_EVENTS "SDL_PEN_TOUCH_EVENTS"
/**
* An enumeration of hint priorities.

View File

@@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
@@ -313,7 +313,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_Quit(void);
*
* \threadsafety It is safe to call this function from any thread.
*
* \since This function is available since SDL 3.2.0.
* \since This function is available since SDL 3.1.8.
*
* \sa SDL_RunOnMainThread
*/
@@ -350,7 +350,7 @@ typedef void (SDLCALL *SDL_MainThreadCallback)(void *userdata);
*
* \threadsafety It is safe to call this function from any thread.
*
* \since This function is available since SDL 3.2.0.
* \since This function is available since SDL 3.1.8.
*
* \sa SDL_IsMainThread
*/

View File

@@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages

View File

@@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
@@ -25,7 +25,7 @@
* # CategoryIOStream
*
* SDL provides an abstract interface for reading and writing data streams. It
* offers implementations for files, memory, etc, and the app can provideo
* offers implementations for files, memory, etc, and the app can provide
* their own implementations, too.
*
* SDL_IOStream is not related to the standard C++ iostream class, other than
@@ -260,6 +260,8 @@ typedef struct SDL_IOStream SDL_IOStream;
* \returns a pointer to the SDL_IOStream structure that is created or NULL on
* failure; call SDL_GetError() for more information.
*
* \threadsafety This function is not thread safe.
*
* \since This function is available since SDL 3.1.3.
*
* \sa SDL_CloseIO
@@ -303,6 +305,8 @@ extern SDL_DECLSPEC SDL_IOStream * SDLCALL SDL_IOFromFile(const char *file, cons
* \returns a pointer to a new SDL_IOStream structure or NULL 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.1.3.
*
* \sa SDL_IOFromConstMem
@@ -347,6 +351,8 @@ extern SDL_DECLSPEC SDL_IOStream * SDLCALL SDL_IOFromMem(void *mem, size_t size)
* \returns a pointer to a new SDL_IOStream structure or NULL 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.1.3.
*
* \sa SDL_IOFromMem
@@ -375,6 +381,8 @@ extern SDL_DECLSPEC SDL_IOStream * SDLCALL SDL_IOFromConstMem(const void *mem, s
* \returns a pointer to a new SDL_IOStream structure or NULL 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.1.3.
*
* \sa SDL_CloseIO
@@ -408,6 +416,8 @@ extern SDL_DECLSPEC SDL_IOStream * SDLCALL SDL_IOFromDynamicMem(void);
* \returns a pointer to the allocated memory on success or NULL 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.1.3.
*
* \sa SDL_CloseIO
@@ -442,6 +452,8 @@ extern SDL_DECLSPEC SDL_IOStream * SDLCALL SDL_OpenIO(const SDL_IOStreamInterfac
* \returns true on success or false on failure; call SDL_GetError() for more
* information.
*
* \threadsafety This function is not thread safe.
*
* \since This function is available since SDL 3.1.3.
*
* \sa SDL_OpenIO
@@ -455,6 +467,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_CloseIO(SDL_IOStream *context);
* \returns a valid property ID on success or 0 on failure; call
* SDL_GetError() for more information.
*
* \threadsafety This function is not thread safe.
*
* \since This function is available since SDL 3.1.3.
*/
extern SDL_DECLSPEC SDL_PropertiesID SDLCALL SDL_GetIOProperties(SDL_IOStream *context);
@@ -473,8 +487,7 @@ extern SDL_DECLSPEC SDL_PropertiesID SDLCALL SDL_GetIOProperties(SDL_IOStream *c
* \param context the SDL_IOStream to query.
* \returns an SDL_IOStatus enum with the current state.
*
* \threadsafety This function should not be called at the same time that
* another thread is operating on the same SDL_IOStream.
* \threadsafety This function is not thread safe.
*
* \since This function is available since SDL 3.1.3.
*/
@@ -488,6 +501,8 @@ extern SDL_DECLSPEC SDL_IOStatus SDLCALL SDL_GetIOStatus(SDL_IOStream *context);
* negative error code on failure; call SDL_GetError() for more
* information.
*
* \threadsafety This function is not thread safe.
*
* \since This function is available since SDL 3.1.3.
*/
extern SDL_DECLSPEC Sint64 SDLCALL SDL_GetIOSize(SDL_IOStream *context);
@@ -513,6 +528,8 @@ extern SDL_DECLSPEC Sint64 SDLCALL SDL_GetIOSize(SDL_IOStream *context);
* \returns the final offset in the data stream after the seek or -1 on
* failure; call SDL_GetError() for more information.
*
* \threadsafety This function is not thread safe.
*
* \since This function is available since SDL 3.1.3.
*
* \sa SDL_TellIO
@@ -531,6 +548,8 @@ extern SDL_DECLSPEC Sint64 SDLCALL SDL_SeekIO(SDL_IOStream *context, Sint64 offs
* \returns the current offset in the stream, or -1 if the information can not
* be determined.
*
* \threadsafety This function is not thread safe.
*
* \since This function is available since SDL 3.1.3.
*
* \sa SDL_SeekIO
@@ -554,6 +573,8 @@ extern SDL_DECLSPEC Sint64 SDLCALL SDL_TellIO(SDL_IOStream *context);
* \returns the number of bytes read, or 0 on end of file or other failure;
* call SDL_GetError() for more information.
*
* \threadsafety This function is not thread safe.
*
* \since This function is available since SDL 3.1.3.
*
* \sa SDL_WriteIO
@@ -581,6 +602,8 @@ extern SDL_DECLSPEC size_t SDLCALL SDL_ReadIO(SDL_IOStream *context, void *ptr,
* \returns the number of bytes written, which will be less than `size` on
* failure; call SDL_GetError() for more information.
*
* \threadsafety This function is not thread safe.
*
* \since This function is available since SDL 3.1.3.
*
* \sa SDL_IOprintf
@@ -603,6 +626,8 @@ extern SDL_DECLSPEC size_t SDLCALL SDL_WriteIO(SDL_IOStream *context, const void
* \returns the number of bytes written or 0 on failure; call SDL_GetError()
* for more information.
*
* \threadsafety This function is not thread safe.
*
* \since This function is available since SDL 3.1.3.
*
* \sa SDL_IOvprintf
@@ -621,6 +646,8 @@ extern SDL_DECLSPEC size_t SDLCALL SDL_IOprintf(SDL_IOStream *context, SDL_PRINT
* \returns the number of bytes written or 0 on failure; call SDL_GetError()
* for more information.
*
* \threadsafety This function is not thread safe.
*
* \since This function is available since SDL 3.1.3.
*
* \sa SDL_IOprintf
@@ -639,6 +666,8 @@ extern SDL_DECLSPEC size_t SDLCALL SDL_IOvprintf(SDL_IOStream *context, SDL_PRIN
* \returns true on success or false on failure; call SDL_GetError() for more
* information.
*
* \threadsafety This function is not thread safe.
*
* \since This function is available since SDL 3.1.3.
*
* \sa SDL_OpenIO
@@ -663,6 +692,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_FlushIO(SDL_IOStream *context);
* \returns the data or NULL on failure; call SDL_GetError() for more
* information.
*
* \threadsafety This function is not thread safe.
*
* \since This function is available since SDL 3.1.3.
*
* \sa SDL_LoadFile
@@ -684,6 +715,8 @@ extern SDL_DECLSPEC void * SDLCALL SDL_LoadFile_IO(SDL_IOStream *src, size_t *da
* \returns the data or NULL on failure; call SDL_GetError() for more
* information.
*
* \threadsafety This function is not thread safe.
*
* \since This function is available since SDL 3.1.3.
*
* \sa SDL_LoadFile_IO
@@ -703,7 +736,9 @@ extern SDL_DECLSPEC void * SDLCALL SDL_LoadFile(const char *file, size_t *datasi
* \returns true on success or false on failure; call SDL_GetError() for more
* information.
*
* \since This function is available since SDL 3.2.0.
* \threadsafety This function is not thread safe.
*
* \since This function is available since SDL 3.1.8.
*
* \sa SDL_SaveFile
* \sa SDL_LoadFile_IO
@@ -713,14 +748,16 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SaveFile_IO(SDL_IOStream *src, const void *
/**
* Save all the data into a file path.
*
* \param file the path to read all available data from.
* \param file the path to write all available data into.
* \param data the data to be written. If datasize is 0, may be NULL or a
* invalid pointer.
* \param datasize the number of bytes to be written.
* \returns true on success or false on failure; call SDL_GetError() for more
* information.
*
* \since This function is available since SDL 3.2.0.
* \threadsafety This function is not thread safe.
*
* \since This function is available since SDL 3.1.8.
*
* \sa SDL_SaveFile_IO
* \sa SDL_LoadFile
@@ -747,6 +784,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SaveFile(const char *file, const void *data
* \returns true on success or false on failure or EOF; call SDL_GetError()
* for more information.
*
* \threadsafety This function is not thread safe.
*
* \since This function is available since SDL 3.1.3.
*/
extern SDL_DECLSPEC bool SDLCALL SDL_ReadU8(SDL_IOStream *src, Uint8 *value);
@@ -764,6 +803,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_ReadU8(SDL_IOStream *src, Uint8 *value);
* \returns true on success or false on failure; call SDL_GetError() for more
* information.
*
* \threadsafety This function is not thread safe.
*
* \since This function is available since SDL 3.1.3.
*/
extern SDL_DECLSPEC bool SDLCALL SDL_ReadS8(SDL_IOStream *src, Sint8 *value);
@@ -785,6 +826,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_ReadS8(SDL_IOStream *src, Sint8 *value);
* \returns true on successful write or false on failure; call SDL_GetError()
* for more information.
*
* \threadsafety This function is not thread safe.
*
* \since This function is available since SDL 3.1.3.
*/
extern SDL_DECLSPEC bool SDLCALL SDL_ReadU16LE(SDL_IOStream *src, Uint16 *value);
@@ -806,6 +849,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_ReadU16LE(SDL_IOStream *src, Uint16 *value)
* \returns true on successful write or false on failure; call SDL_GetError()
* for more information.
*
* \threadsafety This function is not thread safe.
*
* \since This function is available since SDL 3.1.3.
*/
extern SDL_DECLSPEC bool SDLCALL SDL_ReadS16LE(SDL_IOStream *src, Sint16 *value);
@@ -827,6 +872,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_ReadS16LE(SDL_IOStream *src, Sint16 *value)
* \returns true on successful write or false on failure; call SDL_GetError()
* for more information.
*
* \threadsafety This function is not thread safe.
*
* \since This function is available since SDL 3.1.3.
*/
extern SDL_DECLSPEC bool SDLCALL SDL_ReadU16BE(SDL_IOStream *src, Uint16 *value);
@@ -848,6 +895,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_ReadU16BE(SDL_IOStream *src, Uint16 *value)
* \returns true on successful write or false on failure; call SDL_GetError()
* for more information.
*
* \threadsafety This function is not thread safe.
*
* \since This function is available since SDL 3.1.3.
*/
extern SDL_DECLSPEC bool SDLCALL SDL_ReadS16BE(SDL_IOStream *src, Sint16 *value);
@@ -869,6 +918,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_ReadS16BE(SDL_IOStream *src, Sint16 *value)
* \returns true on successful write or false on failure; call SDL_GetError()
* for more information.
*
* \threadsafety This function is not thread safe.
*
* \since This function is available since SDL 3.1.3.
*/
extern SDL_DECLSPEC bool SDLCALL SDL_ReadU32LE(SDL_IOStream *src, Uint32 *value);
@@ -890,6 +941,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_ReadU32LE(SDL_IOStream *src, Uint32 *value)
* \returns true on successful write or false on failure; call SDL_GetError()
* for more information.
*
* \threadsafety This function is not thread safe.
*
* \since This function is available since SDL 3.1.3.
*/
extern SDL_DECLSPEC bool SDLCALL SDL_ReadS32LE(SDL_IOStream *src, Sint32 *value);
@@ -911,6 +964,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_ReadS32LE(SDL_IOStream *src, Sint32 *value)
* \returns true on successful write or false on failure; call SDL_GetError()
* for more information.
*
* \threadsafety This function is not thread safe.
*
* \since This function is available since SDL 3.1.3.
*/
extern SDL_DECLSPEC bool SDLCALL SDL_ReadU32BE(SDL_IOStream *src, Uint32 *value);
@@ -932,6 +987,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_ReadU32BE(SDL_IOStream *src, Uint32 *value)
* \returns true on successful write or false on failure; call SDL_GetError()
* for more information.
*
* \threadsafety This function is not thread safe.
*
* \since This function is available since SDL 3.1.3.
*/
extern SDL_DECLSPEC bool SDLCALL SDL_ReadS32BE(SDL_IOStream *src, Sint32 *value);
@@ -953,6 +1010,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_ReadS32BE(SDL_IOStream *src, Sint32 *value)
* \returns true on successful write or false on failure; call SDL_GetError()
* for more information.
*
* \threadsafety This function is not thread safe.
*
* \since This function is available since SDL 3.1.3.
*/
extern SDL_DECLSPEC bool SDLCALL SDL_ReadU64LE(SDL_IOStream *src, Uint64 *value);
@@ -974,6 +1033,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_ReadU64LE(SDL_IOStream *src, Uint64 *value)
* \returns true on successful write or false on failure; call SDL_GetError()
* for more information.
*
* \threadsafety This function is not thread safe.
*
* \since This function is available since SDL 3.1.3.
*/
extern SDL_DECLSPEC bool SDLCALL SDL_ReadS64LE(SDL_IOStream *src, Sint64 *value);
@@ -995,6 +1056,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_ReadS64LE(SDL_IOStream *src, Sint64 *value)
* \returns true on successful write or false on failure; call SDL_GetError()
* for more information.
*
* \threadsafety This function is not thread safe.
*
* \since This function is available since SDL 3.1.3.
*/
extern SDL_DECLSPEC bool SDLCALL SDL_ReadU64BE(SDL_IOStream *src, Uint64 *value);
@@ -1016,6 +1079,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_ReadU64BE(SDL_IOStream *src, Uint64 *value)
* \returns true on successful write or false on failure; call SDL_GetError()
* for more information.
*
* \threadsafety This function is not thread safe.
*
* \since This function is available since SDL 3.1.3.
*/
extern SDL_DECLSPEC bool SDLCALL SDL_ReadS64BE(SDL_IOStream *src, Sint64 *value);
@@ -1036,6 +1101,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_ReadS64BE(SDL_IOStream *src, Sint64 *value)
* \returns true on successful write or false on failure; call SDL_GetError()
* for more information.
*
* \threadsafety This function is not thread safe.
*
* \since This function is available since SDL 3.1.3.
*/
extern SDL_DECLSPEC bool SDLCALL SDL_WriteU8(SDL_IOStream *dst, Uint8 value);
@@ -1048,6 +1115,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_WriteU8(SDL_IOStream *dst, Uint8 value);
* \returns true on successful write or false on failure; call SDL_GetError()
* for more information.
*
* \threadsafety This function is not thread safe.
*
* \since This function is available since SDL 3.1.3.
*/
extern SDL_DECLSPEC bool SDLCALL SDL_WriteS8(SDL_IOStream *dst, Sint8 value);
@@ -1065,6 +1134,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_WriteS8(SDL_IOStream *dst, Sint8 value);
* \returns true on successful write or false on failure; call SDL_GetError()
* for more information.
*
* \threadsafety This function is not thread safe.
*
* \since This function is available since SDL 3.1.3.
*/
extern SDL_DECLSPEC bool SDLCALL SDL_WriteU16LE(SDL_IOStream *dst, Uint16 value);
@@ -1082,6 +1153,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_WriteU16LE(SDL_IOStream *dst, Uint16 value)
* \returns true on successful write or false on failure; call SDL_GetError()
* for more information.
*
* \threadsafety This function is not thread safe.
*
* \since This function is available since SDL 3.1.3.
*/
extern SDL_DECLSPEC bool SDLCALL SDL_WriteS16LE(SDL_IOStream *dst, Sint16 value);
@@ -1098,6 +1171,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_WriteS16LE(SDL_IOStream *dst, Sint16 value)
* \returns true on successful write or false on failure; call SDL_GetError()
* for more information.
*
* \threadsafety This function is not thread safe.
*
* \since This function is available since SDL 3.1.3.
*/
extern SDL_DECLSPEC bool SDLCALL SDL_WriteU16BE(SDL_IOStream *dst, Uint16 value);
@@ -1114,6 +1189,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_WriteU16BE(SDL_IOStream *dst, Uint16 value)
* \returns true on successful write or false on failure; call SDL_GetError()
* for more information.
*
* \threadsafety This function is not thread safe.
*
* \since This function is available since SDL 3.1.3.
*/
extern SDL_DECLSPEC bool SDLCALL SDL_WriteS16BE(SDL_IOStream *dst, Sint16 value);
@@ -1131,6 +1208,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_WriteS16BE(SDL_IOStream *dst, Sint16 value)
* \returns true on successful write or false on failure; call SDL_GetError()
* for more information.
*
* \threadsafety This function is not thread safe.
*
* \since This function is available since SDL 3.1.3.
*/
extern SDL_DECLSPEC bool SDLCALL SDL_WriteU32LE(SDL_IOStream *dst, Uint32 value);
@@ -1148,6 +1227,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_WriteU32LE(SDL_IOStream *dst, Uint32 value)
* \returns true on successful write or false on failure; call SDL_GetError()
* for more information.
*
* \threadsafety This function is not thread safe.
*
* \since This function is available since SDL 3.1.3.
*/
extern SDL_DECLSPEC bool SDLCALL SDL_WriteS32LE(SDL_IOStream *dst, Sint32 value);
@@ -1164,6 +1245,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_WriteS32LE(SDL_IOStream *dst, Sint32 value)
* \returns true on successful write or false on failure; call SDL_GetError()
* for more information.
*
* \threadsafety This function is not thread safe.
*
* \since This function is available since SDL 3.1.3.
*/
extern SDL_DECLSPEC bool SDLCALL SDL_WriteU32BE(SDL_IOStream *dst, Uint32 value);
@@ -1180,6 +1263,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_WriteU32BE(SDL_IOStream *dst, Uint32 value)
* \returns true on successful write or false on failure; call SDL_GetError()
* for more information.
*
* \threadsafety This function is not thread safe.
*
* \since This function is available since SDL 3.1.3.
*/
extern SDL_DECLSPEC bool SDLCALL SDL_WriteS32BE(SDL_IOStream *dst, Sint32 value);
@@ -1197,6 +1282,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_WriteS32BE(SDL_IOStream *dst, Sint32 value)
* \returns true on successful write or false on failure; call SDL_GetError()
* for more information.
*
* \threadsafety This function is not thread safe.
*
* \since This function is available since SDL 3.1.3.
*/
extern SDL_DECLSPEC bool SDLCALL SDL_WriteU64LE(SDL_IOStream *dst, Uint64 value);
@@ -1214,6 +1301,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_WriteU64LE(SDL_IOStream *dst, Uint64 value)
* \returns true on successful write or false on failure; call SDL_GetError()
* for more information.
*
* \threadsafety This function is not thread safe.
*
* \since This function is available since SDL 3.1.3.
*/
extern SDL_DECLSPEC bool SDLCALL SDL_WriteS64LE(SDL_IOStream *dst, Sint64 value);
@@ -1230,6 +1319,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_WriteS64LE(SDL_IOStream *dst, Sint64 value)
* \returns true on successful write or false on failure; call SDL_GetError()
* for more information.
*
* \threadsafety This function is not thread safe.
*
* \since This function is available since SDL 3.1.3.
*/
extern SDL_DECLSPEC bool SDLCALL SDL_WriteU64BE(SDL_IOStream *dst, Uint64 value);
@@ -1246,6 +1337,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_WriteU64BE(SDL_IOStream *dst, Uint64 value)
* \returns true on successful write or false on failure; call SDL_GetError()
* for more information.
*
* \threadsafety This function is not thread safe.
*
* \since This function is available since SDL 3.1.3.
*/
extern SDL_DECLSPEC bool SDLCALL SDL_WriteS64BE(SDL_IOStream *dst, Sint64 value);

View File

@@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages

View File

@@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
@@ -318,6 +318,8 @@ extern SDL_DECLSPEC SDL_Scancode SDLCALL SDL_GetScancodeFromName(const char *nam
*
* If the key doesn't have a name, this function returns an empty string ("").
*
* Letters will be presented in their uppercase form, if applicable.
*
* \param key the desired SDL_Keycode to query.
* \returns a UTF-8 encoded string of the key name.
*

View File

@@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
@@ -47,11 +47,15 @@
* A special exception is the number keys at the top of the keyboard which map
* to SDLK_0...SDLK_9 on AZERTY layouts.
*
* Keys with the `SDLK_EXTENDED_MASK` bit set do not map to a scancode or
* unicode code point.
*
* \since This datatype is available since SDL 3.1.3.
*/
typedef Uint32 SDL_Keycode;
#define SDLK_SCANCODE_MASK (1u<<30)
#define SDLK_EXTENDED_MASK (1u << 29)
#define SDLK_SCANCODE_MASK (1u << 30)
#define SDL_SCANCODE_TO_KEYCODE(X) (X | SDLK_SCANCODE_MASK)
#define SDLK_UNKNOWN 0x00000000u /**< 0 */
#define SDLK_RETURN 0x0000000du /**< '\r' */
@@ -302,6 +306,13 @@ typedef Uint32 SDL_Keycode;
#define SDLK_SOFTRIGHT 0x40000120u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_SOFTRIGHT) */
#define SDLK_CALL 0x40000121u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CALL) */
#define SDLK_ENDCALL 0x40000122u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_ENDCALL) */
#define SDLK_LEFT_TAB 0x20000001u /**< Extended key Left Tab */
#define SDLK_LEVEL5_SHIFT 0x20000002u /**< Extended key Level 5 Shift */
#define SDLK_MULTI_KEY_COMPOSE 0x20000003u /**< Extended key Multi-key Compose */
#define SDLK_LMETA 0x20000004u /**< Extended key Left Meta */
#define SDLK_RMETA 0x20000005u /**< Extended key Right Meta */
#define SDLK_LHYPER 0x20000006u /**< Extended key Left Hyper */
#define SDLK_RHYPER 0x20000007u /**< Extended key Right Hyper */
/**
* Valid key modifiers (possibly OR'd together).
@@ -313,6 +324,7 @@ typedef Uint16 SDL_Keymod;
#define SDL_KMOD_NONE 0x0000u /**< no modifier is applicable. */
#define SDL_KMOD_LSHIFT 0x0001u /**< the left Shift key is down. */
#define SDL_KMOD_RSHIFT 0x0002u /**< the right Shift key is down. */
#define SDL_KMOD_LEVEL5 0x0004u /**< the Level 5 Shift key is down. */
#define SDL_KMOD_LCTRL 0x0040u /**< the left Ctrl (Control) key is down. */
#define SDL_KMOD_RCTRL 0x0080u /**< the right Ctrl (Control) key is down. */
#define SDL_KMOD_LALT 0x0100u /**< the left Alt key is down. */

View File

@@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages

View File

@@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages

View File

@@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages

View File

@@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages

View File

@@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages

View File

@@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
@@ -22,7 +22,18 @@
/**
* # CategoryMessagebox
*
* Message box support routines.
* SDL offers a simple message box API, which is useful for simple alerts,
* such as informing the user when something fatal happens at startup without
* the need to build a UI for it (or informing the user _before_ your UI is
* ready).
*
* These message boxes are native system dialogs where possible.
*
* There is both a customizable function (SDL_ShowMessageBox()) that offers
* lots of options for what to display and reports on what choice the user
* made, and also a much-simplified version (SDL_ShowSimpleMessageBox()),
* merely takes a text message and title, and waits until the user presses a
* single "OK" UI button. Often, this is all that is necessary.
*/
#ifndef SDL_messagebox_h_

View File

@@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
@@ -23,6 +23,10 @@
* # CategoryMetal
*
* Functions to creating Metal layers and views on SDL windows.
*
* This provides some platform-specific glue for Apple platforms. Most macOS
* and iOS apps can use SDL without these functions, but this API they can be
* useful for specific OS-level integration tasks.
*/
#ifndef SDL_metal_h_

View File

@@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages

View File

@@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
@@ -22,7 +22,36 @@
/**
* # CategoryMouse
*
* SDL mouse handling.
* Any GUI application has to deal with the mouse, and SDL provides functions
* to manage mouse input and the displayed cursor.
*
* Most interactions with the mouse will come through the event subsystem.
* Moving a mouse generates an SDL_EVENT_MOUSE_MOTION event, pushing a button
* generates SDL_EVENT_MOUSE_BUTTON_DOWN, etc, but one can also query the
* current state of the mouse at any time with SDL_GetMouseState().
*
* For certain games, it's useful to disassociate the mouse cursor from mouse
* input. An FPS, for example, would not want the player's motion to stop as
* the mouse hits the edge of the window. For these scenarios, use
* SDL_SetWindowRelativeMouseMode(), which hides the cursor, grabs mouse input
* to the window, and reads mouse input no matter how far it moves.
*
* Games that want the system to track the mouse but want to draw their own
* cursor can use SDL_HideCursor() and SDL_ShowCursor(). It might be more
* efficient to let the system manage the cursor, if possible, using
* SDL_SetCursor() with a custom image made through SDL_CreateColorCursor(),
* or perhaps just a specific system cursor from SDL_CreateSystemCursor().
*
* SDL can, on many platforms, differentiate between multiple connected mice,
* allowing for interesting input scenarios and multiplayer games. They can be
* enumerated with SDL_GetMice(), and SDL will send SDL_EVENT_MOUSE_ADDED and
* SDL_EVENT_MOUSE_REMOVED events as they are connected and unplugged.
*
* Since many apps only care about basic mouse input, SDL offers a virtual
* mouse device for touch and pen input, which often can make a desktop
* application work on a touchscreen phone without any code changes. Apps that
* care about touch/pen separately from mouse input should filter out events
* with a `which` field of SDL_TOUCH_MOUSEID/SDL_PEN_MOUSEID.
*/
#ifndef SDL_mouse_h_
@@ -359,6 +388,11 @@ extern SDL_DECLSPEC bool SDLCALL SDL_WarpMouseGlobal(float x, float y);
* report continuous relative mouse motion even if the mouse is at the edge of
* the window.
*
* If you'd like to keep the mouse position fixed while in relative mode you
* can use SDL_SetWindowMouseRect(). If you'd like the cursor to be at a
* specific location when relative mode ends, you should use
* SDL_WarpMouseInWindow() before disabling relative mode.
*
* This function will flush any pending mouse motion for this window.
*
* \param window the window to change.

View File

@@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
@@ -25,7 +25,19 @@
/**
* # CategoryMutex
*
* Functions to provide thread synchronization primitives.
* SDL offers several thread synchronization primitives. This document can't
* cover the complicated topic of thread safety, but reading up on what each
* of these primitives are, why they are useful, and how to correctly use them
* is vital to writing correct and safe multithreaded programs.
*
* - Mutexes: SDL_CreateMutex()
* - Read/Write locks: SDL_CreateRWLock()
* - Semaphores: SDL_CreateSemaphore()
* - Condition variables: SDL_CreateCondition()
*
* SDL also offers a datatype, SDL_InitState, which can be used to make sure
* only one thread initializes/deinitializes some resource that several
* threads might try to use for the first time simultaneously.
*/
#include <SDL3/SDL_stdinc.h>
@@ -963,7 +975,7 @@ typedef enum SDL_InitStatus
* {
* if (!SDL_ShouldQuit(&init)) {
* // The system is not initialized
* return true;
* return;
* }
*
* // At this point, you should not leave this function without calling SDL_SetInitialized()

View File

@@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
@@ -307,6 +307,8 @@
#define SDL_HINT_DIRECTINPUT_ENABLED SDL_HINT_JOYSTICK_DIRECTINPUT
#define SDL_HINT_GDK_TEXTINPUT_DEFAULT SDL_HINT_GDK_TEXTINPUT_DEFAULT_TEXT
#define SDL_HINT_JOYSTICK_GAMECUBE_RUMBLE_BRAKE SDL_HINT_JOYSTICK_HIDAPI_GAMECUBE_RUMBLE_BRAKE
#define SDL_HINT_JOYSTICK_HIDAPI_PS4_RUMBLE SDL_HINT_JOYSTICK_ENHANCED_REPORTS
#define SDL_HINT_JOYSTICK_HIDAPI_PS5_RUMBLE SDL_HINT_JOYSTICK_ENHANCED_REPORTS
#define SDL_HINT_LINUX_DIGITAL_HATS SDL_HINT_JOYSTICK_LINUX_DIGITAL_HATS
#define SDL_HINT_LINUX_HAT_DEADZONES SDL_HINT_JOYSTICK_LINUX_HAT_DEADZONES
#define SDL_HINT_LINUX_JOYSTICK_CLASSIC SDL_HINT_JOYSTICK_LINUX_CLASSIC
@@ -949,6 +951,8 @@
#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
#define SDL_HINT_JOYSTICK_GAMECUBE_RUMBLE_BRAKE SDL_HINT_JOYSTICK_GAMECUBE_RUMBLE_BRAKE_renamed_SDL_HINT_JOYSTICK_HIDAPI_GAMECUBE_RUMBLE_BRAKE
#define SDL_HINT_JOYSTICK_HIDAPI_PS4_RUMBLE SDL_HINT_JOYSTICK_HIDAPI_PS4_RUMBLE_renamed_SDL_HINT_JOYSTICK_ENHANCED_REPORTS
#define SDL_HINT_JOYSTICK_HIDAPI_PS5_RUMBLE SDL_HINT_JOYSTICK_HIDAPI_PS5_RUMBLE_renamed_SDL_HINT_JOYSTICK_ENHANCED_REPORTS
#define SDL_HINT_LINUX_DIGITAL_HATS SDL_HINT_LINUX_DIGITAL_HATS_renamed_SDL_HINT_JOYSTICK_LINUX_DIGITAL_HATS
#define SDL_HINT_LINUX_HAT_DEADZONES SDL_HINT_LINUX_HAT_DEADZONES_renamed_SDL_HINT_JOYSTICK_LINUX_HAT_DEADZONES
#define SDL_HINT_LINUX_JOYSTICK_CLASSIC SDL_HINT_LINUX_JOYSTICK_CLASSIC_renamed_SDL_HINT_JOYSTICK_LINUX_CLASSIC

View File

@@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages

View File

@@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages

View File

@@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages

View File

@@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
@@ -40,6 +40,8 @@
#define SDL_pen_h_
#include <SDL3/SDL_stdinc.h>
#include <SDL3/SDL_mouse.h>
#include <SDL3/SDL_touch.h>
/* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus
@@ -59,6 +61,20 @@ extern "C" {
*/
typedef Uint32 SDL_PenID;
/**
* The SDL_MouseID for mouse events simulated with pen input.
*
* \since This macro is available since SDL 3.1.3.
*/
#define SDL_PEN_MOUSEID ((SDL_MouseID)-2)
/**
* The SDL_TouchID for touch events simulated with pen input.
*
* \since This macro is available since SDL 3.1.3.
*/
#define SDL_PEN_TOUCHID ((SDL_TouchID)-2)
/**
* Pen input flags, as reported by various pen events' `pen_state` field.

View File

@@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages

View File

@@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages

View File

@@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
@@ -366,7 +366,7 @@
*/
#define SDL_WINAPI_FAMILY_PHONE (WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP)
#elif HAVE_WINAPIFAMILY_H && HAVE_WINAPIFAMILY_H
#elif defined(HAVE_WINAPIFAMILY_H) && HAVE_WINAPIFAMILY_H
#define SDL_WINAPI_FAMILY_PHONE (WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP)
#else
#define SDL_WINAPI_FAMILY_PHONE 0

View File

@@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
@@ -26,6 +26,15 @@
* # CategoryPower
*
* SDL power management routines.
*
* There is a single function in this category: SDL_GetPowerInfo().
*
* This function is useful for games on the go. This allows an app to know if
* it's running on a draining battery, which can be useful if the app wants to
* reduce processing, or perhaps framerate, to extend the duration of the
* battery's charge. Perhaps the app just wants to show a battery meter when
* fullscreen, or alert the user when the power is getting extremely low, so
* they can save their game.
*/
#include <SDL3/SDL_stdinc.h>

View File

@@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages

View File

@@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages

View File

@@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages

View File

@@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
@@ -1273,8 +1273,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_LockTexture(SDL_Texture *texture,
* `SDL_TEXTUREACCESS_STREAMING`.
* \param rect a pointer to the rectangle to lock for access. If the rect is
* NULL, the entire texture will be locked.
* \param surface this is filled in with an SDL surface representing the
* locked area.
* \param surface a pointer to an SDL surface of size **rect**. Don't assume
* any specific pixel content.
* \returns true on success or false on failure; call SDL_GetError() for more
* information.
*
@@ -1498,10 +1498,18 @@ extern SDL_DECLSPEC bool SDLCALL SDL_RenderCoordinatesToWindow(SDL_Renderer *ren
* - The scale (SDL_SetRenderScale)
* - The viewport (SDL_SetRenderViewport)
*
* Various event types are converted with this function: mouse, touch, pen,
* etc.
*
* Touch coordinates are converted from normalized coordinates in the window
* to non-normalized rendering coordinates.
*
* Once converted, the coordinates may be outside the rendering area.
* Relative mouse coordinates (xrel and yrel event fields) are _also_
* converted. Applications that do not want these fields converted should use
* SDL_RenderCoordinatesFromWindow() on the specific event fields instead of
* converting the entire event structure.
*
* Once converted, coordinates may be outside the rendering area.
*
* \param renderer the rendering context.
* \param event the event to modify.
@@ -2102,7 +2110,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_RenderTextureRotated(SDL_Renderer *renderer
*
* \threadsafety You may only call this function from the main thread.
*
* \since This function is available since SDL 3.2.0.
* \since This function is available since SDL 3.1.8.
*
* \sa SDL_RenderTexture
*/
@@ -2560,7 +2568,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_RenderDebugText(SDL_Renderer *renderer, flo
*
* \threadsafety This function should only be called on the main thread.
*
* \since This function is available since SDL 3.2.0.
* \since This function is available since SDL 3.1.8.
*
* \sa SDL_RenderDebugText
* \sa SDL_DEBUG_TEXT_FONT_CHARACTER_SIZE

View File

@@ -11,19 +11,19 @@
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
/**
* \file SDL_revision.h
*
* Header file containing the SDL revision.
*/
* \file SDL_revision.h
*
* Header file containing the SDL revision.
*/
#ifndef SDL_revision_h_
#define SDL_revision_h_
@@ -31,9 +31,9 @@
/* #undef SDL_VENDOR_INFO */
#ifdef SDL_VENDOR_INFO
#define SDL_REVISION "SDL-40f9fd8 (" SDL_VENDOR_INFO ")"
#define SDL_REVISION "SDL3-3.1.7-preview-3.1.6-509-g8cc4735d74 (" SDL_VENDOR_INFO ")"
#else
#define SDL_REVISION "SDL-40f9fd8"
#define SDL_REVISION "SDL3-3.1.7-preview-3.1.6-509-g8cc4735d74"
#endif
#endif /* SDL_revision_h_ */

View File

@@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages

View File

@@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
@@ -24,6 +24,8 @@
*
* SDL sensor management.
*
* These APIs grant access to gyros and accelerometers on various platforms.
*
* In order to use these functions, SDL_Init() must have been called with the
* SDL_INIT_SENSOR flag. This causes SDL to scan the system for sensors, and
* load appropriate drivers.

View File

@@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
@@ -22,11 +22,25 @@
/**
* # CategoryStdinc
*
* This is a general header that includes C language support. It implements a
* subset of the C runtime APIs, but with an `SDL_` prefix. For most common
* use cases, these should behave the same way as their C runtime equivalents,
* but they may differ in how or whether they handle certain edge cases. When
* in doubt, consult the documentation for details.
* SDL provides its own implementation of some of the most important C runtime
* functions.
*
* Using these functions allows an app to have access to common C
* functionality without depending on a specific C runtime (or a C runtime at
* all). More importantly, the SDL implementations work identically across
* platforms, so apps can avoid surprises like snprintf() behaving differently
* between Windows and Linux builds, or itoa() only existing on some
* platforms.
*
* For many of the most common functions, like SDL_memcpy, SDL might just call
* through to the usual C runtime behind the scenes, if it makes sense to do
* so (if it's faster and always available/reliable on a given platform),
* reducing library size and offering the most optimized option.
*
* SDL also offers other C-runtime-adjacent functionality in this header that
* either isn't, strictly speaking, part of any C runtime standards, like
* SDL_crc32() and SDL_reinterpret_cast, etc. It also offers a few better
* options, like SDL_strlcpy(), which functions as a safer form of strcpy().
*/
#ifndef SDL_stdinc_h_
@@ -45,6 +59,11 @@
#endif
#ifndef __cplusplus
#if defined(__has_include) && !defined(SDL_INCLUDE_STDBOOL_H)
#if __has_include(<stdbool.h>)
#define SDL_INCLUDE_STDBOOL_H
#endif
#endif
#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || \
(defined(_MSC_VER) && (_MSC_VER >= 1910 /* Visual Studio 2017 */)) || \
defined(SDL_INCLUDE_STDBOOL_H)
@@ -88,6 +107,32 @@ void *alloca(size_t);
# endif
#endif
#ifdef SDL_WIKI_DOCUMENTATION_SECTION
/**
* Don't let SDL use "long long" C types.
*
* SDL will define this if it believes the compiler doesn't understand the
* "long long" syntax for C datatypes. This can happen on older compilers.
*
* If _your_ compiler doesn't support "long long" but SDL doesn't know it, it
* is safe to define this yourself to build against the SDL headers.
*
* If this is defined, it will remove access to some C runtime support
* functions, like SDL_ulltoa and SDL_strtoll that refer to this datatype
* explicitly. The rest of SDL will still be available.
*
* SDL's own source code cannot be built with a compiler that has this
* defined, for various technical reasons.
*/
#define SDL_NOLONGLONG 1
#elif defined(_MSC_VER) && (_MSC_VER < 1310) /* long long introduced in Visual Studio.NET 2003 */
# define SDL_NOLONGLONG 1
#endif
#ifdef SDL_WIKI_DOCUMENTATION_SECTION
/**
@@ -734,7 +779,9 @@ typedef Sint64 SDL_Time;
#endif
/* Specifically for the `long long` -- SDL-specific. */
#ifdef SDL_PLATFORM_WINDOWS
#ifndef SDL_NOLONGLONG
SDL_COMPILE_TIME_ASSERT(longlong_size64, sizeof(long long) == 8); /* using I64 for windows - make sure `long long` is 64 bits. */
#endif
#define SDL_PRILL_PREFIX "I64"
#else
#define SDL_PRILL_PREFIX "ll"
@@ -1107,8 +1154,10 @@ SDL_COMPILE_TIME_ASSERT(uint32_size, sizeof(Uint32) == 4);
SDL_COMPILE_TIME_ASSERT(sint32_size, sizeof(Sint32) == 4);
SDL_COMPILE_TIME_ASSERT(uint64_size, sizeof(Uint64) == 8);
SDL_COMPILE_TIME_ASSERT(sint64_size, sizeof(Sint64) == 8);
#ifndef SDL_NOLONGLONG
SDL_COMPILE_TIME_ASSERT(uint64_longlong, sizeof(Uint64) <= sizeof(unsigned long long));
SDL_COMPILE_TIME_ASSERT(size_t_longlong, sizeof(size_t) <= sizeof(unsigned long long));
#endif
typedef struct SDL_alignment_test
{
Uint8 a;
@@ -3473,6 +3522,8 @@ extern SDL_DECLSPEC char * SDLCALL SDL_ltoa(long value, char *str, int radix);
*/
extern SDL_DECLSPEC char * SDLCALL SDL_ultoa(unsigned long value, char *str, int radix);
#ifndef SDL_NOLONGLONG
/**
* Convert a long long integer into a string.
*
@@ -3528,6 +3579,7 @@ extern SDL_DECLSPEC char * SDLCALL SDL_lltoa(long long value, char *str, int rad
* \sa SDL_ultoa
*/
extern SDL_DECLSPEC char * SDLCALL SDL_ulltoa(unsigned long long value, char *str, int radix);
#endif
/**
* Parse an `int` from a string.
@@ -3641,6 +3693,8 @@ extern SDL_DECLSPEC long SDLCALL SDL_strtol(const char *str, char **endp, int ba
*/
extern SDL_DECLSPEC unsigned long SDLCALL SDL_strtoul(const char *str, char **endp, int base);
#ifndef SDL_NOLONGLONG
/**
* Parse a `long long` from a string.
*
@@ -3707,6 +3761,7 @@ extern SDL_DECLSPEC long long SDLCALL SDL_strtoll(const char *str, char **endp,
* \sa SDL_ulltoa
*/
extern SDL_DECLSPEC unsigned long long SDLCALL SDL_strtoull(const char *str, char **endp, int base);
#endif
/**
* Parse a `double` from a string.

View File

@@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
@@ -22,7 +22,222 @@
/**
* # CategoryStorage
*
* SDL storage container management.
* The storage API is a high-level API designed to abstract away the
* portability issues that come up when using something lower-level (in SDL's
* case, this sits on top of the [Filesystem](CategoryFilesystem) and
* [IOStream](CategoryIOStream) subsystems). It is significantly more
* restrictive than a typical filesystem API, for a number of reasons:
*
* 1. **What to Access:** A common pitfall with existing filesystem APIs is
* the assumption that all storage is monolithic. However, many other
* platforms (game consoles in particular) are more strict about what _type_
* of filesystem is being accessed; for example, game content and user data
* are usually two separate storage devices with entirely different
* characteristics (and possibly different low-level APIs altogether!).
*
* 2. **How to Access:** Another common mistake is applications assuming that
* all storage is universally writeable - again, many platforms treat game
* content and user data as two separate storage devices, and only user data
* is writeable while game content is read-only.
*
* 3. **When to Access:** The most common portability issue with filesystem
* access is _timing_ - you cannot always assume that the storage device is
* always accessible all of the time, nor can you assume that there are no
* limits to how long you have access to a particular device.
*
* Consider the following example:
*
* ```c
* void ReadGameData(void)
* {
* extern char** fileNames;
* extern size_t numFiles;
* for (size_t i = 0; i < numFiles; i += 1) {
* FILE *data = fopen(fileNames[i], "rwb");
* if (data == NULL) {
* // Something bad happened!
* } else {
* // A bunch of stuff happens here
* fclose(data);
* }
* }
* }
*
* void ReadSave(void)
* {
* FILE *save = fopen("saves/save0.sav", "rb");
* if (save == NULL) {
* // Something bad happened!
* } else {
* // A bunch of stuff happens here
* fclose(save);
* }
* }
*
* void WriteSave(void)
* {
* FILE *save = fopen("saves/save0.sav", "wb");
* if (save == NULL) {
* // Something bad happened!
* } else {
* // A bunch of stuff happens here
* fclose(save);
* }
* }
* ```
*
* Going over the bullet points again:
*
* 1. **What to Access:** This code accesses a global filesystem; game data
* and saves are all presumed to be in the current working directory (which
* may or may not be the game's installation folder!).
*
* 2. **How to Access:** This code assumes that content paths are writeable,
* and that save data is also writeable despite being in the same location as
* the game data.
*
* 3. **When to Access:** This code assumes that they can be called at any
* time, since the filesystem is always accessible and has no limits on how
* long the filesystem is being accessed.
*
* Due to these assumptions, the filesystem code is not portable and will fail
* under these common scenarios:
*
* - The game is installed on a device that is read-only, both content loading
* and game saves will fail or crash outright
* - Game/User storage is not implicitly mounted, so no files will be found
* for either scenario when a platform requires explicitly mounting
* filesystems
* - Save data may not be safe since the I/O is not being flushed or
* validated, so an error occurring elsewhere in the program may result in
* missing/corrupted save data
*
* When using SDL_Storage, these types of problems are virtually impossible to
* trip over:
*
* ```c
* void ReadGameData(void)
* {
* extern char** fileNames;
* extern size_t numFiles;
*
* SDL_Storage *title = SDL_OpenTitleStorage(NULL, 0);
* if (title == NULL) {
* // Something bad happened!
* }
* while (!SDL_StorageReady(title)) {
* SDL_Delay(1);
* }
*
* for (size_t i = 0; i < numFiles; i += 1) {
* void* dst;
* Uint64 dstLen = 0;
*
* if (SDL_GetStorageFileSize(title, fileNames[i], &dstLen) && dstLen > 0) {
* dst = SDL_malloc(dstLen);
* if (SDL_ReadStorageFile(title, fileNames[i], dst, dstLen)) {
* // A bunch of stuff happens here
* } else {
* // Something bad happened!
* }
* SDL_free(dst);
* } else {
* // Something bad happened!
* }
* }
*
* SDL_CloseStorage(title);
* }
*
* void ReadSave(void)
* {
* SDL_Storage *user = SDL_OpenUserStorage("libsdl", "Storage Example", 0);
* if (user == NULL) {
* // Something bad happened!
* }
* while (!SDL_StorageReady(user)) {
* SDL_Delay(1);
* }
*
* Uint64 saveLen = 0;
* if (SDL_GetStorageFileSize(user, "save0.sav", &saveLen) && saveLen > 0) {
* void* dst = SDL_malloc(saveLen);
* if (SDL_ReadStorageFile(user, "save0.sav", dst, saveLen)) {
* // A bunch of stuff happens here
* } else {
* // Something bad happened!
* }
* SDL_free(dst);
* } else {
* // Something bad happened!
* }
*
* SDL_CloseStorage(user);
* }
*
* void WriteSave(void)
* {
* SDL_Storage *user = SDL_OpenUserStorage("libsdl", "Storage Example", 0);
* if (user == NULL) {
* // Something bad happened!
* }
* while (!SDL_StorageReady(user)) {
* SDL_Delay(1);
* }
*
* extern void *saveData; // A bunch of stuff happened here...
* extern Uint64 saveLen;
* if (!SDL_WriteStorageFile(user, "save0.sav", saveData, saveLen)) {
* // Something bad happened!
* }
*
* SDL_CloseStorage(user);
* }
* ```
*
* Note the improvements that SDL_Storage makes:
*
* 1. **What to Access:** This code explicitly reads from a title or user
* storage device based on the context of the function.
*
* 2. **How to Access:** This code explicitly uses either a read or write
* function based on the context of the function.
*
* 3. **When to Access:** This code explicitly opens the device when it needs
* to, and closes it when it is finished working with the filesystem.
*
* The result is an application that is significantly more robust against the
* increasing demands of platforms and their filesystems!
*
* A publicly available example of an SDL_Storage backend is the
* [Steam Cloud](https://partner.steamgames.com/doc/features/cloud)
* backend - you can initialize Steamworks when starting the program, and then
* SDL will recognize that Steamworks is initialized and automatically use
* ISteamRemoteStorage when the application opens user storage. More
* importantly, when you _open_ storage it knows to begin a "batch" of
* filesystem operations, and when you _close_ storage it knows to end and
* flush the batch. This is used by Steam to support
* [Dynamic Cloud Sync](https://steamcommunity.com/groups/steamworks/announcements/detail/3142949576401813670)
* ; users can save data on one PC, put the device to sleep, and then continue
* playing on another PC (and vice versa) with the save data fully
* synchronized across all devices, allowing for a seamless experience without
* having to do full restarts of the program.
*
* ## Notes on valid paths
*
* All paths in the Storage API use Unix-style path separators ('/'). Using a
* different path separator will not work, even if the underlying platform
* would otherwise accept it. This is to keep code using the Storage API
* portable between platforms and Storage implementations and simplify app
* code.
*
* Paths with relative directories ("." and "..") are forbidden by the Storage
* API.
*
* All valid UTF-8 strings (discounting the NULL terminator character and the
* '/' path separator) are usable for filenames, however, an underlying
* Storage implementation may not support particularly strange sequences and
* refuse to create files with those names, etc.
*/
#ifndef SDL_storage_h_
@@ -40,8 +255,6 @@
extern "C" {
#endif
/* !!! FIXME: Don't let this ship without async R/W support!!! */
/**
* Function interface for SDL_Storage.
*
@@ -266,6 +479,10 @@ extern SDL_DECLSPEC bool SDLCALL SDL_GetStorageFileSize(SDL_Storage *storage, co
* Synchronously read a file from a storage container into a client-provided
* buffer.
*
* The value of `length` must match the length of the file exactly; call
* SDL_GetStorageFileSize() to get this value. This behavior may be relaxed in
* a future release.
*
* \param storage a storage container to read from.
* \param path the relative path of the file to read.
* \param destination a client-provided buffer to read the file into.
@@ -326,8 +543,11 @@ extern SDL_DECLSPEC bool SDLCALL SDL_CreateStorageDirectory(SDL_Storage *storage
* returned SDL_ENUM_SUCCESS to halt enumeration, or all directory entries
* were enumerated.
*
* If `path` is NULL, this is treated as a request to enumerate the root of
* the storage container's tree. An empty string also works for this.
*
* \param storage a storage container.
* \param path the path of the directory to enumerate.
* \param path the path of the directory to enumerate, or NULL for the root.
* \param callback a function that is called for each entry in the directory.
* \param userdata a pointer that is passed to `callback`.
* \returns true on success or false on failure; call SDL_GetError() for more
@@ -429,8 +649,11 @@ extern SDL_DECLSPEC Uint64 SDLCALL SDL_GetStorageSpaceRemaining(SDL_Storage *sto
* convenience, but if `count` is non-NULL, on return it will contain the
* number of items in the array, not counting the NULL terminator.
*
* If `path` is NULL, this is treated as a request to enumerate the root of
* the storage container's tree. An empty string also works for this.
*
* \param storage a storage container.
* \param path the path of the directory to enumerate.
* \param path the path of the directory to enumerate, or NULL for the root.
* \param pattern the pattern that files in the directory must match. Can be
* NULL.
* \param flags `SDL_GLOB_*` bitflags that affect this search.

View File

@@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
@@ -1021,12 +1021,14 @@ extern SDL_DECLSPEC bool SDLCALL SDL_FillSurfaceRect(SDL_Surface *dst, const SDL
extern SDL_DECLSPEC 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.
* Performs a fast blit from the source surface to the destination surface
* with clipping.
*
* This assumes that the source and destination rectangles are the same size.
* If either `srcrect` or `dstrect` are NULL, the entire surface (`src` or
* `dst`) is copied. The final blit rectangles are saved in `srcrect` and
* `dstrect` after all clipping is performed.
* `dst`) is copied while ensuring clipping to `dst->clip_rect`.
*
* The final blit rectangles are saved in `srcrect` and `dstrect` after all
* clipping is performed.
*
* The blit function should not be called on a locked surface.
*

View File

@@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
@@ -22,7 +22,13 @@
/**
* # CategorySystem
*
* Platform-specific SDL API functions.
* Platform-specific SDL API functions. These are functions that deal with
* needs of specific operating systems, that didn't make sense to offer as
* platform-independent, generic APIs.
*
* Most apps can make do without these functions, but they can be useful for
* integrating with other parts of a specific system, adding platform-specific
* polish to an app, or solving problems that only affect one target.
*/
#ifndef SDL_system_h_

View File

@@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages

View File

@@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages

View File

@@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
@@ -139,6 +139,7 @@ typedef struct
int gl_accum_blue_size;
int gl_accum_alpha_size;
int gl_stereo;
int gl_release_behavior;
int gl_multisamplebuffers;
int gl_multisamplesamples;
int gl_retained_backing;

View File

@@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages

View File

@@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages

View File

@@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages

View File

@@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages

View File

@@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages

View File

@@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages

View File

@@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages

View File

@@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages

View File

@@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
@@ -25,7 +25,19 @@
/**
* # CategoryThread
*
* SDL thread management routines.
* SDL offers cross-platform thread management functions. These are mostly
* concerned with starting threads, setting their priority, and dealing with
* their termination.
*
* In addition, there is support for Thread Local Storage (data that is unique
* to each thread, but accessed from a single key).
*
* On platforms without thread support (such as Emscripten when built without
* pthreads), these functions still exist, but things like SDL_CreateThread()
* will report failure without doing anything.
*
* If you're going to work with threads, you almost certainly need to have a
* good understanding of [CategoryMutex](CategoryMutex) as well.
*/
#include <SDL3/SDL_stdinc.h>
@@ -116,7 +128,7 @@ typedef enum SDL_ThreadState
SDL_THREAD_UNKNOWN, /**< The thread is not valid */
SDL_THREAD_ALIVE, /**< The thread is currently running */
SDL_THREAD_DETACHED, /**< The thread is detached and can't be waited on */
SDL_THREAD_COMPLETE, /**< The thread has finished and should be cleaned up with SDL_WaitThread() */
SDL_THREAD_COMPLETE /**< The thread has finished and should be cleaned up with SDL_WaitThread() */
} SDL_ThreadState;
/**
@@ -446,7 +458,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_WaitThread(SDL_Thread *thread, int *status)
* \returns the current state of a thread, or SDL_THREAD_UNKNOWN if the thread
* isn't valid.
*
* \since This function is available since SDL 3.2.0.
* \since This function is available since SDL 3.1.8.
*
* \sa SDL_ThreadState
*/

View File

@@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
@@ -26,6 +26,14 @@ freely, subject to the following restrictions:
* # CategoryTime
*
* SDL realtime clock and date/time routines.
*
* There are two data types that are used in this category: SDL_Time, which
* represents the nanoseconds since a specific moment (an "epoch"), and
* SDL_DateTime, which breaks time down into human-understandable components:
* years, months, days, hours, etc.
*
* Much of the functionality is involved in converting those two types to
* other useful forms.
*/
#include <SDL3/SDL_error.h>

View File

@@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
@@ -25,7 +25,20 @@
/**
* # CategoryTimer
*
* SDL time management routines.
* SDL provides time management functionality. It is useful for dealing with
* (usually) small durations of time.
*
* This is not to be confused with _calendar time_ management, which is
* provided by [CategoryTime](CategoryTime).
*
* This category covers measuring time elapsed (SDL_GetTicks(),
* SDL_GetPerformanceCounter()), putting a thread to sleep for a certain
* amount of time (SDL_Delay(), SDL_DelayNS(), SDL_DelayPrecise()), and firing
* a callback function after a certain amount of time has elasped
* (SDL_AddTimer(), etc).
*
* There are also useful macros to convert between time units, like
* SDL_SECONDS_TO_NS() and such.
*/
#include <SDL3/SDL_stdinc.h>
@@ -239,6 +252,9 @@ extern SDL_DECLSPEC Uint64 SDLCALL SDL_GetPerformanceFrequency(void);
* \threadsafety It is safe to call this function from any thread.
*
* \since This function is available since SDL 3.1.3.
*
* \sa SDL_DelayNS
* \sa SDL_DelayPrecise
*/
extern SDL_DECLSPEC void SDLCALL SDL_Delay(Uint32 ms);
@@ -254,6 +270,9 @@ extern SDL_DECLSPEC void SDLCALL SDL_Delay(Uint32 ms);
* \threadsafety It is safe to call this function from any thread.
*
* \since This function is available since SDL 3.1.3.
*
* \sa SDL_Delay
* \sa SDL_DelayPrecise
*/
extern SDL_DECLSPEC void SDLCALL SDL_DelayNS(Uint64 ns);
@@ -269,6 +288,9 @@ extern SDL_DECLSPEC void SDLCALL SDL_DelayNS(Uint64 ns);
* \threadsafety It is safe to call this function from any thread.
*
* \since This function is available since SDL 3.1.6.
*
* \sa SDL_Delay
* \sa SDL_DelayNS
*/
extern SDL_DECLSPEC void SDLCALL SDL_DelayPrecise(Uint64 ns);

View File

@@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
@@ -22,7 +22,18 @@
/**
* # CategoryTouch
*
* SDL touch management.
* SDL offers touch input, on platforms that support it. It can manage
* multiple touch devices and track multiple fingers on those devices.
*
* Touches are mostly dealt with through the event system, in the
* SDL_EVENT_FINGER_DOWN, SDL_EVENT_FINGER_MOTION, and SDL_EVENT_FINGER_UP
* events, but there are also functions to query for hardware details, etc.
*
* The touch system, by default, will also send virtual mouse events; this can
* be useful for making a some desktop apps work on a phone without
* significant changes. For apps that care about mouse and touch input
* separately, they should ignore mouse events that have a `which` field of
* SDL_TOUCH_MOUSEID.
*/
#ifndef SDL_touch_h_

View File

@@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
@@ -22,7 +22,11 @@
/**
* # CategoryTray
*
* System tray menu support.
* SDL offers a way to add items to the "system tray" (more correctly called
* the "notification area" on Windows). On platforms that offer this concept,
* an SDL app can add a tray icon, submenus, checkboxes, and clickable
* entries, and register a callback that is fired when the user clicks on
* these pieces.
*/
#ifndef SDL_tray_h_
@@ -102,11 +106,13 @@ typedef void (SDLCALL *SDL_TrayCallback)(void *userdata, SDL_TrayEntry *entry);
* Using tray icons require the video subsystem.
*
* \param icon a surface to be used as icon. May be NULL.
* \param tooltip a tooltip to be displayed when the mouse hovers the icon.
* Not supported on all platforms. May be NULL.
* \param tooltip a tooltip to be displayed when the mouse hovers the icon in
* UTF-8 encoding. Not supported on all platforms. May be NULL.
* \returns The newly created system tray icon.
*
* \since This function is available since SDL 3.2.0.
* \threadsafety This function should only be called on the main thread.
*
* \since This function is available since SDL 3.1.8.
*
* \sa SDL_CreateTrayMenu
* \sa SDL_GetTrayMenu
@@ -120,7 +126,10 @@ extern SDL_DECLSPEC SDL_Tray *SDLCALL SDL_CreateTray(SDL_Surface *icon, const ch
* \param tray the tray icon to be updated.
* \param icon the new icon. May be NULL.
*
* \since This function is available since SDL 3.2.0.
* \threadsafety This function should be called on the thread that created the
* tray.
*
* \since This function is available since SDL 3.1.8.
*
* \sa SDL_CreateTray
*/
@@ -130,9 +139,12 @@ extern SDL_DECLSPEC void SDLCALL SDL_SetTrayIcon(SDL_Tray *tray, SDL_Surface *ic
* Updates the system tray icon's tooltip.
*
* \param tray the tray icon to be updated.
* \param tooltip the new tooltip. May be NULL.
* \param tooltip the new tooltip in UTF-8 encoding. May be NULL.
*
* \since This function is available since SDL 3.2.0.
* \threadsafety This function should be called on the thread that created the
* tray.
*
* \since This function is available since SDL 3.1.8.
*
* \sa SDL_CreateTray
*/
@@ -151,7 +163,10 @@ extern SDL_DECLSPEC void SDLCALL SDL_SetTrayTooltip(SDL_Tray *tray, const char *
* \param tray the tray to bind the menu to.
* \returns the newly created menu.
*
* \since This function is available since SDL 3.2.0.
* \threadsafety This function should be called on the thread that created the
* tray.
*
* \since This function is available since SDL 3.1.8.
*
* \sa SDL_CreateTray
* \sa SDL_GetTrayMenu
@@ -172,7 +187,10 @@ extern SDL_DECLSPEC SDL_TrayMenu *SDLCALL SDL_CreateTrayMenu(SDL_Tray *tray);
* \param entry the tray entry to bind the menu to.
* \returns the newly created menu.
*
* \since This function is available since SDL 3.2.0.
* \threadsafety This function should be called on the thread that created the
* tray.
*
* \since This function is available since SDL 3.1.8.
*
* \sa SDL_InsertTrayEntryAt
* \sa SDL_GetTraySubmenu
@@ -194,7 +212,10 @@ extern SDL_DECLSPEC SDL_TrayMenu *SDLCALL SDL_CreateTraySubmenu(SDL_TrayEntry *e
* \param tray the tray entry to bind the menu to.
* \returns the newly created menu.
*
* \since This function is available since SDL 3.2.0.
* \threadsafety This function should be called on the thread that created the
* tray.
*
* \since This function is available since SDL 3.1.8.
*
* \sa SDL_CreateTray
* \sa SDL_CreateTrayMenu
@@ -204,7 +225,7 @@ extern SDL_DECLSPEC SDL_TrayMenu *SDLCALL SDL_GetTrayMenu(SDL_Tray *tray);
/**
* Gets a previously created tray entry submenu.
*
* You should have called SDL_CreateTraySubenu() on the entry object. This
* You should have called SDL_CreateTraySubmenu() on the entry object. This
* function allows you to fetch it again later.
*
* This function does the same thing as SDL_GetTrayMenu(), except that it
@@ -215,7 +236,10 @@ extern SDL_DECLSPEC SDL_TrayMenu *SDLCALL SDL_GetTrayMenu(SDL_Tray *tray);
* \param entry the tray entry to bind the menu to.
* \returns the newly created menu.
*
* \since This function is available since SDL 3.2.0.
* \threadsafety This function should be called on the thread that created the
* tray.
*
* \since This function is available since SDL 3.1.8.
*
* \sa SDL_InsertTrayEntryAt
* \sa SDL_CreateTraySubmenu
@@ -228,11 +252,14 @@ extern SDL_DECLSPEC SDL_TrayMenu *SDLCALL SDL_GetTraySubmenu(SDL_TrayEntry *entr
* \param menu The menu to get entries from.
* \param size An optional pointer to obtain the number of entries in the
* menu.
* \returns the entries within the given menu. The pointer becomes invalid
* when any function that inserts or deletes entries in the menu is
* called.
* \returns a NULL-terminated list of entries within the given menu. The
* pointer becomes invalid when any function that inserts or deletes
* entries in the menu is called.
*
* \since This function is available since SDL 3.2.0.
* \threadsafety This function should be called on the thread that created the
* tray.
*
* \since This function is available since SDL 3.1.8.
*
* \sa SDL_RemoveTrayEntry
* \sa SDL_InsertTrayEntryAt
@@ -244,7 +271,10 @@ extern SDL_DECLSPEC const SDL_TrayEntry **SDLCALL SDL_GetTrayEntries(SDL_TrayMen
*
* \param entry The entry to be deleted.
*
* \since This function is available since SDL 3.2.0.
* \threadsafety This function should be called on the thread that created the
* tray.
*
* \since This function is available since SDL 3.1.8.
*
* \sa SDL_GetTrayEntries
* \sa SDL_InsertTrayEntryAt
@@ -262,12 +292,15 @@ extern SDL_DECLSPEC void SDLCALL SDL_RemoveTrayEntry(SDL_TrayEntry *entry);
* \param menu the menu to append the entry to.
* \param pos the desired position for the new entry. Entries at or following
* this place will be moved. If pos is -1, the entry is appended.
* \param label the text to be displayed on the entry, or NULL for a
* separator.
* \param label the text to be displayed on the entry, in UTF-8 encoding, or
* NULL for a separator.
* \param flags a combination of flags, some of which are mandatory.
* \returns the newly created entry, or NULL if pos is out of bounds.
*
* \since This function is available since SDL 3.2.0.
* \threadsafety This function should be called on the thread that created the
* tray.
*
* \since This function is available since SDL 3.1.8.
*
* \sa SDL_TrayEntryFlags
* \sa SDL_GetTrayEntries
@@ -285,9 +318,12 @@ extern SDL_DECLSPEC SDL_TrayEntry *SDLCALL SDL_InsertTrayEntryAt(SDL_TrayMenu *m
* label. The function will silently fail if that happens.
*
* \param entry the entry to be updated.
* \param label the new label for the entry.
* \param label the new label for the entry in UTF-8 encoding.
*
* \since This function is available since SDL 3.2.0.
* \threadsafety This function should be called on the thread that created the
* tray.
*
* \since This function is available since SDL 3.1.8.
*
* \sa SDL_GetTrayEntries
* \sa SDL_InsertTrayEntryAt
@@ -301,9 +337,12 @@ extern SDL_DECLSPEC void SDLCALL SDL_SetTrayEntryLabel(SDL_TrayEntry *entry, con
* If the returned value is NULL, the entry is a separator.
*
* \param entry the entry to be read.
* \returns the label of the entry.
* \returns the label of the entry in UTF-8 encoding.
*
* \since This function is available since SDL 3.2.0.
* \threadsafety This function should be called on the thread that created the
* tray.
*
* \since This function is available since SDL 3.1.8.
*
* \sa SDL_GetTrayEntries
* \sa SDL_InsertTrayEntryAt
@@ -317,10 +356,12 @@ extern SDL_DECLSPEC const char *SDLCALL SDL_GetTrayEntryLabel(SDL_TrayEntry *ent
* The entry must have been created with the SDL_TRAYENTRY_CHECKBOX flag.
*
* \param entry the entry to be updated.
* \param checked SDL_TRUE if the entry should be checked; SDL_FALSE
* otherwise.
* \param checked true if the entry should be checked; false otherwise.
*
* \since This function is available since SDL 3.2.0.
* \threadsafety This function should be called on the thread that created the
* tray.
*
* \since This function is available since SDL 3.1.8.
*
* \sa SDL_GetTrayEntries
* \sa SDL_InsertTrayEntryAt
@@ -334,9 +375,12 @@ extern SDL_DECLSPEC void SDLCALL SDL_SetTrayEntryChecked(SDL_TrayEntry *entry, b
* The entry must have been created with the SDL_TRAYENTRY_CHECKBOX flag.
*
* \param entry the entry to be read.
* \returns SDL_TRUE if the entry is checked; SDL_FALSE otherwise.
* \returns true if the entry is checked; false otherwise.
*
* \since This function is available since SDL 3.2.0.
* \threadsafety This function should be called on the thread that created the
* tray.
*
* \since This function is available since SDL 3.1.8.
*
* \sa SDL_GetTrayEntries
* \sa SDL_InsertTrayEntryAt
@@ -348,10 +392,12 @@ extern SDL_DECLSPEC bool SDLCALL SDL_GetTrayEntryChecked(SDL_TrayEntry *entry);
* Sets whether or not an entry is enabled.
*
* \param entry the entry to be updated.
* \param enabled SDL_TRUE if the entry should be enabled; SDL_FALSE
* otherwise.
* \param enabled true if the entry should be enabled; false otherwise.
*
* \since This function is available since SDL 3.2.0.
* \threadsafety This function should be called on the thread that created the
* tray.
*
* \since This function is available since SDL 3.1.8.
*
* \sa SDL_GetTrayEntries
* \sa SDL_InsertTrayEntryAt
@@ -363,9 +409,12 @@ extern SDL_DECLSPEC void SDLCALL SDL_SetTrayEntryEnabled(SDL_TrayEntry *entry, b
* Gets whether or not an entry is enabled.
*
* \param entry the entry to be read.
* \returns SDL_TRUE if the entry is enabled; SDL_FALSE otherwise.
* \returns true if the entry is enabled; false otherwise.
*
* \since This function is available since SDL 3.2.0.
* \threadsafety This function should be called on the thread that created the
* tray.
*
* \since This function is available since SDL 3.1.8.
*
* \sa SDL_GetTrayEntries
* \sa SDL_InsertTrayEntryAt
@@ -381,13 +430,28 @@ extern SDL_DECLSPEC bool SDLCALL SDL_GetTrayEntryEnabled(SDL_TrayEntry *entry);
* \param userdata an optional pointer to pass extra data to the callback when
* it will be invoked.
*
* \since This function is available since SDL 3.2.0.
* \threadsafety This function should be called on the thread that created the
* tray.
*
* \since This function is available since SDL 3.1.8.
*
* \sa SDL_GetTrayEntries
* \sa SDL_InsertTrayEntryAt
*/
extern SDL_DECLSPEC void SDLCALL SDL_SetTrayEntryCallback(SDL_TrayEntry *entry, SDL_TrayCallback callback, void *userdata);
/**
* Simulate a click on a tray entry.
*
* \param entry The entry to activate.
*
* \threadsafety This function should be called on the thread that created the
* tray.
*
* \since This function is available since SDL 3.1.10.
*/
extern SDL_DECLSPEC void SDLCALL SDL_ClickTrayEntry(SDL_TrayEntry *entry);
/**
* Destroys a tray object.
*
@@ -395,19 +459,25 @@ extern SDL_DECLSPEC void SDLCALL SDL_SetTrayEntryCallback(SDL_TrayEntry *entry,
*
* \param tray the tray icon to be destroyed.
*
* \since This function is available since SDL 3.2.0.
* \threadsafety This function should be called on the thread that created the
* tray.
*
* \since This function is available since SDL 3.1.8.
*
* \sa SDL_CreateTray
*/
extern SDL_DECLSPEC void SDLCALL SDL_DestroyTray(SDL_Tray *tray);
/**
* Gets the menu contianing a certain tray entry.
* Gets the menu containing a certain tray entry.
*
* \param entry the entry for which to get the parent menu.
* \returns the parent menu.
*
* \since This function is available since SDL 3.2.0.
* \threadsafety This function should be called on the thread that created the
* tray.
*
* \since This function is available since SDL 3.1.8.
*
* \sa SDL_InsertTrayEntryAt
*/
@@ -423,7 +493,10 @@ extern SDL_DECLSPEC SDL_TrayMenu *SDLCALL SDL_GetTrayEntryParent(SDL_TrayEntry *
* \param menu the menu for which to get the parent entry.
* \returns the parent entry, or NULL if this menu is not a submenu.
*
* \since This function is available since SDL 3.2.0.
* \threadsafety This function should be called on the thread that created the
* tray.
*
* \since This function is available since SDL 3.1.8.
*
* \sa SDL_CreateTraySubmenu
* \sa SDL_GetTrayMenuParentTray
@@ -440,13 +513,28 @@ extern SDL_DECLSPEC SDL_TrayEntry *SDLCALL SDL_GetTrayMenuParentEntry(SDL_TrayMe
* \param menu the menu for which to get the parent enttrayry.
* \returns the parent tray, or NULL if this menu is a submenu.
*
* \since This function is available since SDL 3.2.0.
* \threadsafety This function should be called on the thread that created the
* tray.
*
* \since This function is available since SDL 3.1.8.
*
* \sa SDL_CreateTrayMenu
* \sa SDL_GetTrayMenuParentEntry
*/
extern SDL_DECLSPEC SDL_Tray *SDLCALL SDL_GetTrayMenuParentTray(SDL_TrayMenu *menu);
/**
* Update the trays.
*
* This is called automatically by the event loop and is only needed if you're
* using trays but aren't handling SDL events.
*
* \threadsafety This function should only be called on the main thread.
*
* \since This function is available since SDL 3.2.0.
*/
extern SDL_DECLSPEC void SDLCALL SDL_UpdateTrays(void);
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
}

View File

@@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
@@ -62,7 +62,7 @@ extern "C" {
*
* \since This macro is available since SDL 3.1.3.
*/
#define SDL_MICRO_VERSION 7
#define SDL_MICRO_VERSION 11
/**
* This macro turns the version numbers into a numeric value.

View File

@@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
@@ -648,7 +648,8 @@ extern SDL_DECLSPEC const char * SDLCALL SDL_GetDisplayName(SDL_DisplayID displa
/**
* Get the desktop area represented by a display.
*
* The primary display is always located at (0,0).
* The primary display is often located at (0,0), but may be placed at a
* different location depending on monitor layout.
*
* \param displayID the instance ID of the display to query.
* \param rect the SDL_Rect structure filled in with the display bounds.
@@ -1228,10 +1229,12 @@ extern SDL_DECLSPEC SDL_Window * SDLCALL SDL_CreatePopupWindow(SDL_Window *paren
* - `SDL_PROP_WINDOW_CREATE_WIDTH_NUMBER`: the width of the window
* - `SDL_PROP_WINDOW_CREATE_X_NUMBER`: the x position of the window, or
* `SDL_WINDOWPOS_CENTERED`, defaults to `SDL_WINDOWPOS_UNDEFINED`. This is
* relative to the parent for windows with the "parent" property set.
* relative to the parent for windows with the "tooltip" or "menu" property
* set.
* - `SDL_PROP_WINDOW_CREATE_Y_NUMBER`: the y position of the window, or
* `SDL_WINDOWPOS_CENTERED`, defaults to `SDL_WINDOWPOS_UNDEFINED`. This is
* relative to the parent for windows with the "parent" property set.
* relative to the parent for windows with the "tooltip" or "menu" property
* set.
*
* These are additional supported properties on macOS:
*
@@ -2786,6 +2789,10 @@ extern SDL_DECLSPEC bool SDLCALL SDL_FlashWindow(SDL_Window *window, SDL_FlashOp
* Any child windows owned by the window will be recursively destroyed as
* well.
*
* Note that on some platforms, the visible window may not actually be removed
* from the screen until the SDL event loop is pumped again, even though the
* SDL_Window is no longer valid after this call.
*
* \param window the window to destroy.
*
* \threadsafety This function should only be called on the main thread.

View File

@@ -87,6 +87,13 @@ struct VkAllocationCallbacks;
* creating any Vulkan windows. If no Vulkan loader library is loaded, the
* default library will be loaded upon creation of the first Vulkan window.
*
* SDL keeps a counter of how many times this function has been successfully
* called, so it is safe to call this function multiple times, so long as it
* is eventually paired with an equivalent number of calls to
* SDL_Vulkan_UnloadLibrary. The `path` argument is ignored unless there is no
* library currently loaded, and and the library isn't actually unloaded until
* there have been an equivalent number of calls to SDL_Vulkan_UnloadLibrary.
*
* It is fairly common for Vulkan applications to link with libvulkan instead
* of explicitly loading it at run time. This will work with SDL provided the
* application links to a dynamic library and both it and SDL use the same
@@ -116,6 +123,8 @@ struct VkAllocationCallbacks;
* \returns true on success or false on failure; call SDL_GetError() for more
* information.
*
* \threadsafety This function is not thread safe.
*
* \since This function is available since SDL 3.1.3.
*
* \sa SDL_Vulkan_GetVkGetInstanceProcAddr
@@ -147,6 +156,19 @@ extern SDL_DECLSPEC SDL_FunctionPointer SDLCALL SDL_Vulkan_GetVkGetInstanceProcA
/**
* Unload the Vulkan library previously loaded by SDL_Vulkan_LoadLibrary().
*
* SDL keeps a counter of how many times this function has been called, so it
* is safe to call this function multiple times, so long as it is paired with
* an equivalent number of calls to SDL_Vulkan_LoadLibrary. The library isn't
* actually unloaded until there have been an equivalent number of calls to
* SDL_Vulkan_UnloadLibrary.
*
* Once the library has actually been unloaded, if any Vulkan instances
* remain, they will likely crash the program. Clean up any existing Vulkan
* resources, and destroy appropriate windows, renderers and GPU devices
* before calling this function.
*
* \threadsafety This function is not thread safe.
*
* \since This function is available since SDL 3.1.3.
*
* \sa SDL_Vulkan_LoadLibrary

View File

@@ -88,8 +88,8 @@ namespace Flax.Deps.Dependencies
Path.Combine(root, "include", "SDL3"),
};
CloneGitRepoFastSince(root, "https://github.com/libsdl-org/SDL.git", new DateTime(2024, 12, 26));
GitResetToCommit(root, "578509c326f6bcc25fba7b71ebb439a165808bc5");
CloneGitRepoFastSince(root, "https://github.com/libsdl-org/SDL", new DateTime(2025, 01, 19));
GitResetToCommit(root, "819628c6bf8e6c3e5357d7ee4bd2d3d43ddfe052");
foreach (var platform in options.Platforms)
{
@@ -135,7 +135,7 @@ namespace Flax.Deps.Dependencies
directoriesToCopy.Add(Path.Combine(buildDir, "include", "SDL3"));
int concurrency = Math.Min(Math.Max(1, (int)(Environment.ProcessorCount * Configuration.ConcurrencyProcessorScale)), Configuration.MaxConcurrency);
RunCmake(root, platform, architecture, $"-B\"{buildDir}\" -DCMAKE_INSTALL_PREFIX=\"{buildDir}\" -DSDL_SHARED={(!buildStatic ? "ON" : "OFF")} -DSDL_STATIC={(buildStatic ? "ON" : "OFF")} -DCMAKE_POSITION_INDEPENDENT_CODE=ON " + string.Join(" ", configs));
RunCmake(root, platform, architecture, $"-B\"{buildDir}\" -DCMAKE_BUILD_TYPE={configuration} -DCMAKE_INSTALL_PREFIX=\"{buildDir}\" -DSDL_SHARED={(!buildStatic ? "ON" : "OFF")} -DSDL_STATIC={(buildStatic ? "ON" : "OFF")} -DCMAKE_POSITION_INDEPENDENT_CODE=ON " + string.Join(" ", configs));
BuildCmake(buildDir, configuration, new Dictionary<string, string>() { {"CMAKE_BUILD_PARALLEL_LEVEL", concurrency.ToString()} });
Utilities.Run("cmake", $"--build . --target install --config {configuration}", null, buildDir, Utilities.RunOptions.DefaultTool);