fix breaking cpp2beef changes

This commit is contained in:
Rune
2026-03-15 16:48:20 +01:00
parent f41a145b67
commit 3e8ce40cc3
33 changed files with 605 additions and 167 deletions

View File

@@ -350,7 +350,7 @@ class Program
"-DSDL_oldnames_h_", "-DSDL_platform_defines_h_", "-DSDL_endian_h_", "-DSDL_oldnames_h_", "-DSDL_platform_defines_h_", "-DSDL_endian_h_",
"-DCrcUint32=Uint32", "-DCrcUint8=Uint8", "-DCrcUint32=Uint32", "-DCrcUint8=Uint8",
"-DSDL_SLOW_MEMCPY", "-DSDL_SLOW_MEMMOVE", "-DSDL_SLOW_MEMSET", "-DSDL_DISABLE_ALLOCA", "-DSDL_DISABLE_ANALYZE_MACROS")); "-DSDL_SLOW_MEMCPY", "-DSDL_SLOW_MEMMOVE", "-DSDL_SLOW_MEMSET", "-DSDL_DISABLE_ALLOCA", "-DSDL_DISABLE_ANALYZE_MACROS"));
generator.Generate("SDL3_all.h", null); generator.Generate("SDL3_all.h");
return 0; return 0;
} }

View File

@@ -170,7 +170,7 @@ public const let ASSERT_LEVEL = 1;
/** /**
* A macro that reports the current function being compiled. * A constant that contains the current function being compiled.
* *
* If SDL can't figure how the compiler reports this, it will use "???". * If SDL can't figure how the compiler reports this, it will use "???".
* *
@@ -178,6 +178,7 @@ public const let ASSERT_LEVEL = 1;
*/ */
/* C99 supports __func__ as a standard. */ /* C99 supports __func__ as a standard. */
@@ -188,6 +189,7 @@ public const let ASSERT_LEVEL = 1;
/** /**
* A macro that reports the current file being compiled. * A macro that reports the current file being compiled.
* *

View File

@@ -223,6 +223,8 @@ extension SDL
* \returns a pointer to the SDL_AsyncIO structure that is created or NULL on * \returns a pointer to the SDL_AsyncIO structure that is created or NULL on
* failure; call SDL_GetError() for more information. * 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.2.0. * \since This function is available since SDL 3.2.0.
* *
* \sa SDL_CloseAsyncIO * \sa SDL_CloseAsyncIO
@@ -541,6 +543,8 @@ extension SDL
* \returns true on success or false on failure; call SDL_GetError() for more * \returns true on success or false on failure; call SDL_GetError() for more
* information. * information.
* *
* \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.2.0.
* *
* \sa SDL_LoadFile_IO * \sa SDL_LoadFile_IO

View File

@@ -496,7 +496,7 @@ public typealias CameraID = Uint32;
/** /**
* Release a frame of video acquired from a camera. * Release a frame of video acquired from a camera.
* *
* Let the back-end re-use the internal buffer for camera. * Let the back-end reuse the internal buffer for camera.
* *
* This function _must_ be called only on surface objects returned by * This function _must_ be called only on surface objects returned by
* SDL_AcquireCameraFrame(). This function should be called as quickly as * SDL_AcquireCameraFrame(). This function should be called as quickly as

View File

@@ -216,7 +216,7 @@ namespace SDL3;
/* By default, assume that floats words follow the memory system mode. */ /* By default, assume that floats words follow the memory system mode. */
/* __FLOAT_WORD_ORDER__ */ /* SDL_WIKI_DOCUMENTATION_SECTION */
/* !SDL_FLOATWORDORDER */ /* !SDL_FLOATWORDORDER */

View File

@@ -251,9 +251,8 @@ extension SDL
/** /**
* Types of filesystem entries. * Types of filesystem entries.
* *
* Note that there may be other sorts of items on a filesystem: devices, * Note that there may be other sorts of items on a filesystem: devices, named
* symlinks, named pipes, etc. They are currently reported as * pipes, etc. They are currently reported as SDL_PATHTYPE_OTHER.
* SDL_PATHTYPE_OTHER.
* *
* \since This enum is available since SDL 3.2.0. * \since This enum is available since SDL 3.2.0.
* *
@@ -272,6 +271,7 @@ extension SDL
* *
* \since This datatype is available since SDL 3.2.0. * \since This datatype is available since SDL 3.2.0.
* *
* \sa SDL_PathType
* \sa SDL_GetPathInfo * \sa SDL_GetPathInfo
* \sa SDL_GetStoragePathInfo * \sa SDL_GetStoragePathInfo
*/ */
@@ -485,6 +485,10 @@ public function EnumerationResult EnumerateDirectoryCallback(void* userdata, c_c
/** /**
* Get information about a filesystem path. * Get information about a filesystem path.
* *
* Symlinks, on filesystems that support them, are always followed, so you
* will always get information on what the symlink eventually points to, and
* not the symlink itself.
*
* \param path the path to query. * \param path the path to query.
* \param info a pointer filled in with information about the path, or NULL to * \param info a pointer filled in with information about the path, or NULL to
* check for the existence of a file. * check for the existence of a file.

View File

@@ -2315,6 +2315,21 @@ public enum GPUColorComponentFlags : Uint8
* useful for targeting Intel Haswell and Broadwell GPUs; other hardware * useful for targeting Intel Haswell and Broadwell GPUs; other hardware
* either supports Tier 2 Resource Binding or does not support D3D12 in any * either supports Tier 2 Resource Binding or does not support D3D12 in any
* capacity. Defaults to false. * capacity. Defaults to false.
* - `SDL_PROP_GPU_DEVICE_CREATE_D3D12_AGILITY_SDK_VERSION_NUMBER`: Certain
* feature checks are only possible on Windows 11 by default. By setting
* this alongside `SDL_PROP_GPU_DEVICE_CREATE_D3D12_AGILITY_SDK_PATH_STRING`
* and vendoring D3D12Core.dll from the D3D12 Agility SDK, you can make
* those feature checks possible on older platforms. The version you provide
* must match the one given in the DLL.
* - `SDL_PROP_GPU_DEVICE_CREATE_D3D12_AGILITY_SDK_PATH_STRING`: Certain
* feature checks are only possible on Windows 11 by default. By setting
* this alongside
* `SDL_PROP_GPU_DEVICE_CREATE_D3D12_AGILITY_SDK_VERSION_NUMBER` and
* vendoring D3D12Core.dll from the D3D12 Agility SDK, you can make those
* feature checks possible on older platforms. The path you provide must be
* relative to the executable path of your app. Be sure not to put the DLL
* in the same directory as the exe; Microsoft strongly advises against
* this!
* *
* With the Vulkan backend: * With the Vulkan backend:
* *
@@ -2368,6 +2383,8 @@ public const let PROP_GPU_DEVICE_CREATE_SHADERS_MSL_BOOLEAN
public const let PROP_GPU_DEVICE_CREATE_SHADERS_METALLIB_BOOLEAN = "SDL.gpu.device.create.shaders.metallib"; public const let PROP_GPU_DEVICE_CREATE_SHADERS_METALLIB_BOOLEAN = "SDL.gpu.device.create.shaders.metallib";
public const let PROP_GPU_DEVICE_CREATE_D3D12_ALLOW_FEWER_RESOURCE_SLOTS_BOOLEAN = "SDL.gpu.device.create.d3d12.allowtier1resourcebinding"; public const let PROP_GPU_DEVICE_CREATE_D3D12_ALLOW_FEWER_RESOURCE_SLOTS_BOOLEAN = "SDL.gpu.device.create.d3d12.allowtier1resourcebinding";
public const let PROP_GPU_DEVICE_CREATE_D3D12_SEMANTIC_NAME_STRING = "SDL.gpu.device.create.d3d12.semantic"; public const let PROP_GPU_DEVICE_CREATE_D3D12_SEMANTIC_NAME_STRING = "SDL.gpu.device.create.d3d12.semantic";
public const let PROP_GPU_DEVICE_CREATE_D3D12_AGILITY_SDK_VERSION_NUMBER = "SDL.gpu.device.create.d3d12.agility_sdk_version";
public const let PROP_GPU_DEVICE_CREATE_D3D12_AGILITY_SDK_PATH_STRING = "SDL.gpu.device.create.d3d12.agility_sdk_path";
public const let PROP_GPU_DEVICE_CREATE_VULKAN_REQUIRE_HARDWARE_ACCELERATION_BOOLEAN = "SDL.gpu.device.create.vulkan.requirehardwareacceleration"; public const let PROP_GPU_DEVICE_CREATE_VULKAN_REQUIRE_HARDWARE_ACCELERATION_BOOLEAN = "SDL.gpu.device.create.vulkan.requirehardwareacceleration";
public const let PROP_GPU_DEVICE_CREATE_VULKAN_OPTIONS_POINTER = "SDL.gpu.device.create.vulkan.options"; public const let PROP_GPU_DEVICE_CREATE_VULKAN_OPTIONS_POINTER = "SDL.gpu.device.create.vulkan.options";
public const let PROP_GPU_DEVICE_CREATE_METAL_ALLOW_MACFAMILY1_BOOLEAN = "SDL.gpu.device.create.metal.allowmacfamily1"; public const let PROP_GPU_DEVICE_CREATE_METAL_ALLOW_MACFAMILY1_BOOLEAN = "SDL.gpu.device.create.metal.allowmacfamily1";

View File

@@ -1402,7 +1402,7 @@ public typealias HapticID = Uint32;
* \since This function is available since SDL 3.2.0. * \since This function is available since SDL 3.2.0.
* *
* \sa SDL_RunHapticEffect * \sa SDL_RunHapticEffect
* \sa SDL_StopHapticEffects * \sa SDL_StopHapticEffect
*/ */
[LinkName("SDL_StopHapticEffects")] public static extern bool StopHapticEffects(Haptic* haptic); [LinkName("SDL_StopHapticEffects")] public static extern bool StopHapticEffects(Haptic* haptic);

View File

@@ -1903,6 +1903,23 @@ public const let HINT_JOYSTICK_HIDAPI_ZUIKI = "SDL_JOYSTICK_HIDAPI_ZUIKI";
*/ */
public const let HINT_JOYSTICK_HIDAPI_FLYDIGI = "SDL_JOYSTICK_HIDAPI_FLYDIGI"; public const let HINT_JOYSTICK_HIDAPI_FLYDIGI = "SDL_JOYSTICK_HIDAPI_FLYDIGI";
/**
* A variable controlling whether the HIDAPI driver for GameSir controllers
* should be used.
*
* The variable can be set to the following values:
*
* - "0": HIDAPI driver is not used.
* - "1": HIDAPI driver is used.
*
* The default is the value of SDL_HINT_JOYSTICK_HIDAPI.
*
* This hint should be set before initializing joysticks and gamepads.
*
* \since This hint is available since SDL 3.5.0.
*/
public const let HINT_JOYSTICK_HIDAPI_GAMESIR = "SDL_JOYSTICK_HIDAPI_GAMESIR";
/** /**
* A variable controlling whether the HIDAPI driver for Nintendo Switch * A variable controlling whether the HIDAPI driver for Nintendo Switch
* controllers should be used. * controllers should be used.
@@ -3007,11 +3024,13 @@ public const let HINT_EGL_LIBRARY = "SDL_EGL_LIBRARY";
* whether SDL follows this default behaviour or will always load an OpenGL ES * whether SDL follows this default behaviour or will always load an OpenGL ES
* library. * library.
* *
* Circumstances where this is useful include - Testing an app with a * Circumstances where this is useful include:
* particular OpenGL ES implementation, e.g ANGLE, or emulator, e.g. those *
* from ARM, Imagination or Qualcomm. - Resolving OpenGL ES function addresses * - Testing an app with a particular OpenGL ES implementation, e.g ANGLE, or
* at link time by linking with the OpenGL ES library instead of querying them * emulator, e.g. those from ARM, Imagination or Qualcomm.
* at run time with SDL_GL_GetProcAddress(). * - Resolving OpenGL ES function addresses at link time by linking with the
* OpenGL ES library instead of querying them at run time with
* SDL_GL_GetProcAddress().
* *
* Caution: for an application to work with the default behaviour across * Caution: for an application to work with the default behaviour across
* different OpenGL drivers it must query the OpenGL ES function addresses at * different OpenGL drivers it must query the OpenGL ES function addresses at
@@ -3031,6 +3050,46 @@ public const let HINT_EGL_LIBRARY = "SDL_EGL_LIBRARY";
*/ */
public const let HINT_OPENGL_ES_DRIVER = "SDL_OPENGL_ES_DRIVER"; public const let HINT_OPENGL_ES_DRIVER = "SDL_OPENGL_ES_DRIVER";
/**
* A variable controlling whether to force an sRGB-capable OpenGL context.
*
* At OpenGL context creation time, some platforms can request an sRGB-capable
* context. However, sometimes any form of the request can cause surprising
* results on some drivers, platforms, and hardware. Usually the surprise is
* in the form of rendering that is either a little darker or a little
* brighter than intended.
*
* This hint allows the user to override the app's sRGB requests and either
* force a specific value, or avoid requesting anything at all, depending on
* what makes things work correctly for their system.
*
* This is meant as a fail-safe; apps should probably not explicitly set this,
* and most users should not, either.
*
* Note that some platforms cannot make this request at all, and on all
* platforms this request can be denied by the operating system.
*
* In addition to attempting to obtain the type of sRGB-capable OpenGL context
* requested by this hint, SDL will try to force the state of
* GL_FRAMEBUFFER_SRGB on the new context, if appropriate.
*
* The variable can be set to the following values:
*
* - "0": Force a request for an OpenGL context that is _not_ sRGB-capable.
* - "1": Force a request for an OpenGL context that _is_ sRGB-capable.
* - "skip": Don't make any request for an sRGB-capable context (don't specify
* the attribute at all during context creation time).
* - any other string is undefined behavior.
*
* If unset, or set to an empty string, SDL will make a request using the
* value the app specified with the SDL_GL_FRAMEBUFFER_SRGB_CAPABLE attribute.
*
* This hint should be set before an OpenGL context is created.
*
* \since This hint is available since SDL 3.4.2.
*/
public const let HINT_OPENGL_FORCE_SRGB_FRAMEBUFFER = "SDL_OPENGL_FORCE_SRGB_FRAMEBUFFER";
/** /**
* Mechanism to specify openvr_api library location * Mechanism to specify openvr_api library location
* *

View File

@@ -235,6 +235,8 @@ public function void AppQuit_func(void* appstate, AppResult result);
* \returns true on success or false on failure; call SDL_GetError() for more * \returns true on success or false on failure; call SDL_GetError() for more
* information. * information.
* *
* \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.2.0.
* *
* \sa SDL_SetAppMetadata * \sa SDL_SetAppMetadata
@@ -255,6 +257,8 @@ public function void AppQuit_func(void* appstate, AppResult result);
* \returns true on success or false on failure; call SDL_GetError() for more * \returns true on success or false on failure; call SDL_GetError() for more
* information. * information.
* *
* \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.2.0.
* *
* \sa SDL_Init * \sa SDL_Init
@@ -271,6 +275,8 @@ public function void AppQuit_func(void* appstate, AppResult result);
* *
* \param flags any of the flags used by SDL_Init(); see SDL_Init for details. * \param flags any of the flags used by SDL_Init(); see SDL_Init for details.
* *
* \threadsafety This function is not thread safe.
*
* \since This function is available since SDL 3.2.0. * \since This function is available since SDL 3.2.0.
* *
* \sa SDL_InitSubSystem * \sa SDL_InitSubSystem
@@ -285,6 +291,8 @@ public function void AppQuit_func(void* appstate, AppResult result);
* \returns a mask of all initialized subsystems if `flags` is 0, otherwise it * \returns a mask of all initialized subsystems if `flags` is 0, otherwise it
* returns the initialization status of the specified subsystems. * returns the initialization status of the specified subsystems.
* *
* \threadsafety This function is not thread safe.
*
* \since This function is available since SDL 3.2.0. * \since This function is available since SDL 3.2.0.
* *
* \sa SDL_Init * \sa SDL_Init
@@ -303,6 +311,8 @@ public function void AppQuit_func(void* appstate, AppResult result);
* application is shutdown, but it is not wise to do this from a library or * application is shutdown, but it is not wise to do this from a library or
* other dynamically loaded code. * other dynamically loaded code.
* *
* \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.2.0.
* *
* \sa SDL_Init * \sa SDL_Init

View File

@@ -56,8 +56,8 @@ extension SDL
* and load appropriate drivers. * and load appropriate drivers.
* *
* If you would like to receive joystick updates while the application is in * If you would like to receive joystick updates while the application is in
* the background, you should set the following hint before calling * the background, you should set the
* SDL_Init(): SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS * SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS hint.
* *
* SDL can provide virtual joysticks as well: the app defines an imaginary * SDL can provide virtual joysticks as well: the app defines an imaginary
* controller with SDL_AttachVirtualJoystick(), and then can provide inputs * controller with SDL_AttachVirtualJoystick(), and then can provide inputs
@@ -1142,7 +1142,7 @@ public const let PROP_JOYSTICK_CAP_TRIGGER_RUMBLE_BOOLEAN = "SDL.joystick.cap
* Update the current state of the open joysticks. * Update the current state of the open joysticks.
* *
* This is called automatically by the event loop if any joystick events are * This is called automatically by the event loop if any joystick events are
* enabled. * enabled and SDL_HINT_AUTO_UPDATE_JOYSTICKS hasn't been set to "0".
* *
* \threadsafety It is safe to call this function from any thread. * \threadsafety It is safe to call this function from any thread.
* *

View File

@@ -112,6 +112,8 @@ extension SDL
* allocation that should be freed with SDL_free() when it is no * allocation that should be freed with SDL_free() when it is no
* longer needed. * longer needed.
* *
* \threadsafety This function is not thread safe.
*
* \since This function is available since SDL 3.2.0. * \since This function is available since SDL 3.2.0.
*/ */
[LinkName("SDL_GetPreferredLocales")] public static extern Locale** GetPreferredLocales(out c_int count); [LinkName("SDL_GetPreferredLocales")] public static extern Locale** GetPreferredLocales(out c_int count);

View File

@@ -493,7 +493,8 @@ public function void LogOutputFunction(void* userdata, c_int category, LogPriori
/** /**
* Get the default log output function. * Get the default log output function.
* *
* \returns the default log output callback. * \returns the default log output callback. It should be called with NULL for
* the userdata argument.
* *
* \threadsafety It is safe to call this function from any thread. * \threadsafety It is safe to call this function from any thread.
* *

View File

@@ -267,7 +267,7 @@ extension SDL
/* usually this is empty */ /* usually this is empty */
/* SDL_MAIN_EXPORTED */ /* SDL_WIKI_DOCUMENTATION_SECTION */
@@ -343,6 +343,9 @@ extension SDL
* \returns SDL_APP_FAILURE to terminate with an error, SDL_APP_SUCCESS to * \returns SDL_APP_FAILURE to terminate with an error, SDL_APP_SUCCESS to
* terminate with success, SDL_APP_CONTINUE to continue. * terminate with success, SDL_APP_CONTINUE to continue.
* *
* \threadsafety This function is called once by SDL, at startup, on a single
* thread.
*
* \since This function is available since SDL 3.2.0. * \since This function is available since SDL 3.2.0.
* *
* \sa SDL_AppIterate * \sa SDL_AppIterate
@@ -547,6 +550,8 @@ public function c_int main_func(c_int argc, c_char**);
* will not be changed it is necessary to define SDL_MAIN_HANDLED before * will not be changed it is necessary to define SDL_MAIN_HANDLED before
* including SDL.h. * including SDL.h.
* *
* \threadsafety This function is not thread safe.
*
* \since This function is available since SDL 3.2.0. * \since This function is available since SDL 3.2.0.
* *
* \sa SDL_Init * \sa SDL_Init
@@ -639,6 +644,8 @@ public function c_int main_func(c_int argc, c_char**);
* \returns true on success or false on failure; call SDL_GetError() for more * \returns true on success or false on failure; call SDL_GetError() for more
* information. * information.
* *
* \threadsafety This function is not thread safe.
*
* \since This function is available since SDL 3.2.0. * \since This function is available since SDL 3.2.0.
*/ */
@@ -656,6 +663,8 @@ public function c_int main_func(c_int argc, c_char**);
* deregistered when the registration counter in SDL_RegisterApp decrements to * deregistered when the registration counter in SDL_RegisterApp decrements to
* zero through calls to this function. * zero through calls to this function.
* *
* \threadsafety This function is not thread safe.
*
* \since This function is available since SDL 3.2.0. * \since This function is available since SDL 3.2.0.
*/ */
@@ -665,10 +674,26 @@ public function c_int main_func(c_int argc, c_char**);
/** /**
* Callback from the application to let the suspend continue. * Callback from the application to let the suspend continue.
* *
* This should be called from an event watch in response to an
* `SDL_EVENT_DID_ENTER_BACKGROUND` event.
*
* When using SDL_Render, your event watch should be added _after_ creating
* the `SDL_Renderer`; this allows the timing of the D3D12 command queue
* suspension to execute in the correct order.
*
* When using SDL_GPU, this should be called after calling SDL_GDKSuspendGPU.
*
* If you're writing your own D3D12 renderer, this should be called after
* calling `ID3D12CommandQueue::SuspendX`.
*
* This function is only needed for Xbox GDK support; all other platforms will * This function is only needed for Xbox GDK support; all other platforms will
* do nothing and set an "unsupported" error message. * do nothing and set an "unsupported" error message.
* *
* \threadsafety This function is not thread safe.
*
* \since This function is available since SDL 3.2.0. * \since This function is available since SDL 3.2.0.
*
* \sa SDL_AddEventWatch
*/ */
[LinkName("SDL_GDKSuspendComplete")] public static extern void GDKSuspendComplete(); [LinkName("SDL_GDKSuspendComplete")] public static extern void GDKSuspendComplete();
} }

View File

@@ -180,6 +180,8 @@ public const let MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT = 0x00000002u;/**< Marks th
* \returns true on success or false on failure; call SDL_GetError() for more * \returns true on success or false on failure; call SDL_GetError() for more
* information. * information.
* *
* \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.2.0.
* *
* \sa SDL_ShowSimpleMessageBox * \sa SDL_ShowSimpleMessageBox
@@ -222,6 +224,8 @@ public const let MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT = 0x00000002u;/**< Marks th
* \returns true on success or false on failure; call SDL_GetError() for more * \returns true on success or false on failure; call SDL_GetError() for more
* information. * information.
* *
* \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.2.0.
* *
* \sa SDL_ShowMessageBox * \sa SDL_ShowMessageBox

View File

@@ -75,6 +75,8 @@ public typealias MetalView = void*;
* \param window the window. * \param window the window.
* \returns handle NSView or UIView. * \returns handle NSView or UIView.
* *
* \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.2.0.
* *
* \sa SDL_Metal_DestroyView * \sa SDL_Metal_DestroyView
@@ -90,6 +92,8 @@ public typealias MetalView = void*;
* *
* \param view the SDL_MetalView object. * \param view the SDL_MetalView object.
* *
* \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.2.0.
* *
* \sa SDL_Metal_CreateView * \sa SDL_Metal_CreateView
@@ -102,6 +106,8 @@ public typealias MetalView = void*;
* \param view the SDL_MetalView object. * \param view the SDL_MetalView object.
* \returns a pointer. * \returns a pointer.
* *
* \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.2.0.
*/ */
[LinkName("SDL_Metal_GetLayer")] public static extern void* Metal_GetLayer(MetalView view); [LinkName("SDL_Metal_GetLayer")] public static extern void* Metal_GetLayer(MetalView view);

View File

@@ -75,6 +75,8 @@ extension SDL
* \returns true on success or false on failure; call SDL_GetError() for more * \returns true on success or false on failure; call SDL_GetError() for more
* information. * information.
* *
* \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.2.0.
*/ */
[LinkName("SDL_OpenURL")] public static extern bool OpenURL(c_char* url); [LinkName("SDL_OpenURL")] public static extern bool OpenURL(c_char* url);

View File

@@ -318,6 +318,8 @@ extension SDL
* \returns the initialized and unlocked mutex or NULL on failure; call * \returns the initialized and unlocked mutex or NULL on failure; call
* SDL_GetError() for more information. * SDL_GetError() for more information.
* *
* \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.2.0.
* *
* \sa SDL_DestroyMutex * \sa SDL_DestroyMutex
@@ -344,6 +346,8 @@ extension SDL
* *
* \param mutex the mutex to lock. * \param mutex the mutex to lock.
* *
* \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.2.0.
* *
* \sa SDL_TryLockMutex * \sa SDL_TryLockMutex
@@ -365,6 +369,8 @@ extension SDL
* \param mutex the mutex to try to lock. * \param mutex the mutex to try to lock.
* \returns true on success, false if the mutex would block. * \returns true on success, false if the mutex would block.
* *
* \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.2.0.
* *
* \sa SDL_LockMutex * \sa SDL_LockMutex
@@ -384,6 +390,9 @@ extension SDL
* *
* \param mutex the mutex to unlock. * \param mutex the mutex to unlock.
* *
* \threadsafety This call must be paired with a previous locking call on the
* same thread.
*
* \since This function is available since SDL 3.2.0. * \since This function is available since SDL 3.2.0.
* *
* \sa SDL_LockMutex * \sa SDL_LockMutex
@@ -402,6 +411,8 @@ extension SDL
* *
* \param mutex the mutex to destroy. * \param mutex the mutex to destroy.
* *
* \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.2.0.
* *
* \sa SDL_CreateMutex * \sa SDL_CreateMutex
@@ -467,6 +478,8 @@ extension SDL
* \returns the initialized and unlocked read/write lock or NULL on failure; * \returns the initialized and unlocked read/write lock or NULL on failure;
* call SDL_GetError() for more information. * 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.2.0. * \since This function is available since SDL 3.2.0.
* *
* \sa SDL_DestroyRWLock * \sa SDL_DestroyRWLock
@@ -507,6 +520,8 @@ extension SDL
* *
* \param rwlock the read/write lock to lock. * \param rwlock the read/write lock to lock.
* *
* \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.2.0.
* *
* \sa SDL_LockRWLockForWriting * \sa SDL_LockRWLockForWriting
@@ -538,6 +553,8 @@ extension SDL
* *
* \param rwlock the read/write lock to lock. * \param rwlock the read/write lock to lock.
* *
* \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.2.0.
* *
* \sa SDL_LockRWLockForReading * \sa SDL_LockRWLockForReading
@@ -563,6 +580,8 @@ extension SDL
* \param rwlock the rwlock to try to lock. * \param rwlock the rwlock to try to lock.
* \returns true on success, false if the lock would block. * \returns true on success, false if the lock would block.
* *
* \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.2.0.
* *
* \sa SDL_LockRWLockForReading * \sa SDL_LockRWLockForReading
@@ -593,6 +612,8 @@ extension SDL
* \param rwlock the rwlock to try to lock. * \param rwlock the rwlock to try to lock.
* \returns true on success, false if the lock would block. * \returns true on success, false if the lock would block.
* *
* \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.2.0.
* *
* \sa SDL_LockRWLockForWriting * \sa SDL_LockRWLockForWriting
@@ -617,6 +638,9 @@ extension SDL
* *
* \param rwlock the rwlock to unlock. * \param rwlock the rwlock to unlock.
* *
* \threadsafety This call must be paired with a previous locking call on the
* same thread.
*
* \since This function is available since SDL 3.2.0. * \since This function is available since SDL 3.2.0.
* *
* \sa SDL_LockRWLockForReading * \sa SDL_LockRWLockForReading
@@ -637,6 +661,8 @@ extension SDL
* *
* \param rwlock the rwlock to destroy. * \param rwlock the rwlock to destroy.
* *
* \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.2.0.
* *
* \sa SDL_CreateRWLock * \sa SDL_CreateRWLock
@@ -680,6 +706,8 @@ extension SDL
* \returns a new semaphore or NULL on failure; call SDL_GetError() for more * \returns a new semaphore or NULL on failure; call SDL_GetError() for more
* information. * information.
* *
* \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.2.0.
* *
* \sa SDL_DestroySemaphore * \sa SDL_DestroySemaphore
@@ -699,6 +727,8 @@ extension SDL
* *
* \param sem the semaphore to destroy. * \param sem the semaphore to destroy.
* *
* \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.2.0.
* *
* \sa SDL_CreateSemaphore * \sa SDL_CreateSemaphore
@@ -717,6 +747,8 @@ extension SDL
* *
* \param sem the semaphore wait on. * \param sem the semaphore wait on.
* *
* \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.2.0.
* *
* \sa SDL_SignalSemaphore * \sa SDL_SignalSemaphore
@@ -736,6 +768,8 @@ extension SDL
* \param sem the semaphore to wait on. * \param sem the semaphore to wait on.
* \returns true if the wait succeeds, false if the wait would block. * \returns true if the wait succeeds, false if the wait would block.
* *
* \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.2.0.
* *
* \sa SDL_SignalSemaphore * \sa SDL_SignalSemaphore
@@ -756,6 +790,8 @@ extension SDL
* indefinitely. * indefinitely.
* \returns true if the wait succeeds or false if the wait times out. * \returns true if the wait succeeds or false if the wait times out.
* *
* \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.2.0.
* *
* \sa SDL_SignalSemaphore * \sa SDL_SignalSemaphore
@@ -769,6 +805,8 @@ extension SDL
* *
* \param sem the semaphore to increment. * \param sem the semaphore to increment.
* *
* \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.2.0.
* *
* \sa SDL_TryWaitSemaphore * \sa SDL_TryWaitSemaphore
@@ -783,6 +821,8 @@ extension SDL
* \param sem the semaphore to query. * \param sem the semaphore to query.
* \returns the current value of the semaphore. * \returns the current value of the semaphore.
* *
* \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.2.0.
*/ */
[LinkName("SDL_GetSemaphoreValue")] public static extern Uint32 GetSemaphoreValue(Semaphore* sem); [LinkName("SDL_GetSemaphoreValue")] public static extern Uint32 GetSemaphoreValue(Semaphore* sem);
@@ -816,6 +856,8 @@ extension SDL
* \returns a new condition variable or NULL on failure; call SDL_GetError() * \returns a new condition variable or NULL on failure; call SDL_GetError()
* for more information. * for more information.
* *
* \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.2.0.
* *
* \sa SDL_BroadcastCondition * \sa SDL_BroadcastCondition
@@ -831,6 +873,8 @@ extension SDL
* *
* \param cond the condition variable to destroy. * \param cond the condition variable to destroy.
* *
* \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.2.0.
* *
* \sa SDL_CreateCondition * \sa SDL_CreateCondition

View File

@@ -821,6 +821,7 @@ namespace SDL3;
/* ##SDL_gamecontroller.h */ /* ##SDL_gamecontroller.h */
@@ -922,6 +923,7 @@ namespace SDL3;
/* ##SDL_guid.h */ /* ##SDL_guid.h */
@@ -966,6 +968,9 @@ namespace SDL3;
/* ##SDL_joystick.h */ /* ##SDL_joystick.h */
@@ -1006,6 +1011,7 @@ namespace SDL3;
/* ##SDL_keyboard.h */ /* ##SDL_keyboard.h */
@@ -1190,6 +1196,8 @@ namespace SDL3;
@@ -1304,6 +1312,7 @@ namespace SDL3;
/* ##SDL_timer.h */ /* ##SDL_timer.h */
@@ -1329,6 +1338,9 @@ namespace SDL3;
/* SDL_ENABLE_OLD_NAMES */ /* SDL_ENABLE_OLD_NAMES */

View File

@@ -63,12 +63,12 @@ extension SDL
* doesn't seem to, it might actually be the operating system's fault. For * doesn't seem to, it might actually be the operating system's fault. For
* example, some platforms can manage multiple devices at the same time, but * example, some platforms can manage multiple devices at the same time, but
* others will make any connected pens look like a single logical device, much * others will make any connected pens look like a single logical device, much
* how all USB mice connected to a computer will move the same system cursor. * like how all USB mice connected to a computer will move the same system
* Other platforms might not support pen buttons, or the distance axis, etc. * cursor. Other platforms might not support pen buttons, or the distance
* Very few platforms can even report _what_ functionality the pen supports in * axis, etc. Very few platforms can even report _what_ functionality the pen
* the first place, so best practices is to either build UI to let the user * supports in the first place, so best practices is to either build UI to let
* configure their pens, or be prepared to handle new functionality for a pen * the user configure their pens, or be prepared to handle new functionality
* the first time an event is reported. * for a pen the first time an event is reported.
*/ */

View File

@@ -61,6 +61,8 @@ extension SDL
* \returns the name of the platform. If the correct platform name is not * \returns the name of the platform. If the correct platform name is not
* available, returns a string beginning with the text "Unknown". * available, returns a string beginning with the text "Unknown".
* *
* \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.2.0.
*/ */
[LinkName("SDL_GetPlatform")] public static extern c_char* GetPlatform(); [LinkName("SDL_GetPlatform")] public static extern c_char* GetPlatform();

View File

@@ -103,6 +103,8 @@ extension SDL
* \returns the current battery state or `SDL_POWERSTATE_ERROR` on failure; * \returns the current battery state or `SDL_POWERSTATE_ERROR` on failure;
* call SDL_GetError() for more information. * call SDL_GetError() for more information.
* *
* \threadsafety This function is not thread safe.
*
* \since This function is available since SDL 3.2.0. * \since This function is available since SDL 3.2.0.
*/ */
[LinkName("SDL_GetPowerInfo")] public static extern PowerState GetPowerInfo(out c_int seconds, out c_int percent); [LinkName("SDL_GetPowerInfo")] public static extern PowerState GetPowerInfo(out c_int seconds, out c_int percent);

View File

@@ -121,6 +121,8 @@ public const let PROP_NAME_STRING = "SDL.name";
* \returns a valid property ID on success or 0 on failure; call * \returns a valid property ID on success or 0 on failure; call
* SDL_GetError() for more information. * SDL_GetError() for more information.
* *
* \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.2.0.
*/ */
[LinkName("SDL_GetGlobalProperties")] public static extern PropertiesID GetGlobalProperties(); [LinkName("SDL_GetGlobalProperties")] public static extern PropertiesID GetGlobalProperties();

View File

@@ -247,6 +247,8 @@ extension SDL
* rectangles `A` and `B`. * rectangles `A` and `B`.
* \returns true if there is an intersection, false otherwise. * \returns true if there is an intersection, false otherwise.
* *
* \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.2.0.
* *
* \sa SDL_HasRectIntersection * \sa SDL_HasRectIntersection
@@ -263,6 +265,8 @@ extension SDL
* \returns true on success or false on failure; call SDL_GetError() for more * \returns true on success or false on failure; call SDL_GetError() for more
* information. * information.
* *
* \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.2.0.
*/ */
[LinkName("SDL_GetRectUnion")] public static extern bool GetRectUnion(Rect* A, Rect* B, Rect* result); [LinkName("SDL_GetRectUnion")] public static extern bool GetRectUnion(Rect* A, Rect* B, Rect* result);
@@ -282,6 +286,8 @@ extension SDL
* \returns true if any points were enclosed or false if all the points were * \returns true if any points were enclosed or false if all the points were
* outside of the clipping rectangle. * outside of the clipping rectangle.
* *
* \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.2.0.
*/ */
[LinkName("SDL_GetRectEnclosingPoints")] public static extern bool GetRectEnclosingPoints(Point* points, c_int count, Rect* clip, Rect* result); [LinkName("SDL_GetRectEnclosingPoints")] public static extern bool GetRectEnclosingPoints(Point* points, c_int count, Rect* clip, Rect* result);
@@ -302,6 +308,8 @@ extension SDL
* \param Y2 a pointer to the ending Y-coordinate of the line. * \param Y2 a pointer to the ending Y-coordinate of the line.
* \returns true if there is an intersection, false otherwise. * \returns true if there is an intersection, false otherwise.
* *
* \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.2.0.
*/ */
[LinkName("SDL_GetRectAndLineIntersection")] public static extern bool GetRectAndLineIntersection(Rect* rect, c_int* X1, c_int* Y1, c_int* X2, c_int* Y2); [LinkName("SDL_GetRectAndLineIntersection")] public static extern bool GetRectAndLineIntersection(Rect* rect, c_int* X1, c_int* Y1, c_int* X2, c_int* Y2);
@@ -433,6 +441,8 @@ extension SDL
* \param B an SDL_FRect structure representing the second rectangle. * \param B an SDL_FRect structure representing the second rectangle.
* \returns true if there is an intersection, false otherwise. * \returns true if there is an intersection, false otherwise.
* *
* \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.2.0.
* *
* \sa SDL_GetRectIntersectionFloat * \sa SDL_GetRectIntersectionFloat
@@ -450,6 +460,8 @@ extension SDL
* rectangles `A` and `B`. * rectangles `A` and `B`.
* \returns true if there is an intersection, false otherwise. * \returns true if there is an intersection, false otherwise.
* *
* \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.2.0.
* *
* \sa SDL_HasRectIntersectionFloat * \sa SDL_HasRectIntersectionFloat
@@ -466,6 +478,8 @@ extension SDL
* \returns true on success or false on failure; call SDL_GetError() for more * \returns true on success or false on failure; call SDL_GetError() for more
* information. * information.
* *
* \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.2.0.
*/ */
[LinkName("SDL_GetRectUnionFloat")] public static extern bool GetRectUnionFloat(FRect* A, FRect* B, FRect* result); [LinkName("SDL_GetRectUnionFloat")] public static extern bool GetRectUnionFloat(FRect* A, FRect* B, FRect* result);
@@ -486,6 +500,8 @@ extension SDL
* \returns true if any points were enclosed or false if all the points were * \returns true if any points were enclosed or false if all the points were
* outside of the clipping rectangle. * outside of the clipping rectangle.
* *
* \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.2.0.
*/ */
[LinkName("SDL_GetRectEnclosingPointsFloat")] public static extern bool GetRectEnclosingPointsFloat(FPoint* points, c_int count, FRect* clip, FRect* result); [LinkName("SDL_GetRectEnclosingPointsFloat")] public static extern bool GetRectEnclosingPointsFloat(FPoint* points, c_int count, FRect* clip, FRect* result);
@@ -507,6 +523,8 @@ extension SDL
* \param Y2 a pointer to the ending Y-coordinate of the line. * \param Y2 a pointer to the ending Y-coordinate of the line.
* \returns true if there is an intersection, false otherwise. * \returns true if there is an intersection, false otherwise.
* *
* \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.2.0.
*/ */
[LinkName("SDL_GetRectAndLineIntersectionFloat")] public static extern bool GetRectAndLineIntersectionFloat(FRect* rect, float* X1, float* Y1, float* X2, float* Y2); [LinkName("SDL_GetRectAndLineIntersectionFloat")] public static extern bool GetRectAndLineIntersectionFloat(FRect* rect, float* X1, float* Y1, float* X2, float* Y2);

View File

@@ -764,8 +764,6 @@ public const let PROP_RENDERER_GPU_DEVICE_POINTER = "SDL.
* *
* - `SDL_PROP_TEXTURE_CREATE_OPENGLES2_TEXTURE_NUMBER`: the GLuint texture * - `SDL_PROP_TEXTURE_CREATE_OPENGLES2_TEXTURE_NUMBER`: the GLuint texture
* associated with the texture, if you want to wrap an existing texture. * associated with the texture, if you want to wrap an existing texture.
* - `SDL_PROP_TEXTURE_CREATE_OPENGLES2_TEXTURE_NUMBER`: the GLuint texture
* associated with the texture, if you want to wrap an existing texture.
* - `SDL_PROP_TEXTURE_CREATE_OPENGLES2_TEXTURE_UV_NUMBER`: the GLuint texture * - `SDL_PROP_TEXTURE_CREATE_OPENGLES2_TEXTURE_UV_NUMBER`: the GLuint texture
* associated with the UV plane of an NV12 texture, if you want to wrap an * associated with the UV plane of an NV12 texture, if you want to wrap an
* existing texture. * existing texture.
@@ -2496,6 +2494,8 @@ public const let PROP_TEXTURE_GPU_TEXTURE_V_POINTER = "SDL.texture.
* \returns true on success or false on failure; call SDL_GetError() for more * \returns true on success or false on failure; call SDL_GetError() for more
* information. * information.
* *
* \threadsafety This function should only be called on the main thread.
*
* \since This function is available since SDL 3.4.0. * \since This function is available since SDL 3.4.0.
* *
* \sa SDL_RenderGeometry * \sa SDL_RenderGeometry
@@ -2517,6 +2517,8 @@ public const let PROP_TEXTURE_GPU_TEXTURE_V_POINTER = "SDL.texture.
* \returns true on success or false on failure; call SDL_GetError() for more * \returns true on success or false on failure; call SDL_GetError() for more
* information. * information.
* *
* \threadsafety This function should only be called on the main thread.
*
* \since This function is available since SDL 3.4.0. * \since This function is available since SDL 3.4.0.
* *
* \sa SDL_SetRenderTextureAddressMode * \sa SDL_SetRenderTextureAddressMode
@@ -2952,6 +2954,64 @@ public const let DEBUG_TEXT_FONT_CHARACTER_SIZE = 8;
*/ */
[LinkName("SDL_CreateGPURenderState")] public static extern GPURenderState* CreateGPURenderState(Renderer* renderer, GPURenderStateCreateInfo* createinfo); [LinkName("SDL_CreateGPURenderState")] public static extern GPURenderState* CreateGPURenderState(Renderer* renderer, GPURenderStateCreateInfo* createinfo);
/**
* Set sampler bindings variables in a custom GPU render state.
*
* The data is copied and will be binded using SDL_BindGPUFragmentSamplers()
* during draw call execution.
*
* \param state the state to modify.
* \param num_sampler_bindings The number of additional fragment samplers to
* bind.
* \param sampler_bindings Additional fragment samplers to bind.
* \returns true on success or false on failure; call SDL_GetError() for more
* information.
*
* \threadsafety This function should be called on the thread that created the
* renderer.
*
* \since This function is available since SDL 3.6.0.
*/
[LinkName("SDL_SetGPURenderStateSamplerBindings")] public static extern bool SetGPURenderStateSamplerBindings(GPURenderState* state, c_int num_sampler_bindings, GPUTextureSamplerBinding* sampler_bindings);
/**
* Set storage textures variables in a custom GPU render state.
*
* The data is copied and will be binded using
* SDL_BindGPUFragmentStorageTextures() during draw call execution.
*
* \param state the state to modify.
* \param num_storage_textures The number of storage textures to bind.
* \param storage_textures Storage textures to bind.
* \returns true on success or false on failure; call SDL_GetError() for more
* information.
*
* \threadsafety This function should be called on the thread that created the
* renderer.
*
* \since This function is available since SDL 3.6.0.
*/
[LinkName("SDL_SetGPURenderStateStorageTextures")] public static extern bool SetGPURenderStateStorageTextures(GPURenderState* state, c_int num_storage_textures, GPUTexture** storage_textures);
/**
* Set storage buffers variables in a custom GPU render state.
*
* The data is copied and will be binded using
* SDL_BindGPUFragmentStorageBuffers() during draw call execution.
*
* \param state the state to modify.
* \param num_storage_buffers The number of storage buffers to bind.
* \param storage_buffers Storage buffers to bind.
* \returns true on success or false on failure; call SDL_GetError() for more
* information.
*
* \threadsafety This function should be called on the thread that created the
* renderer.
*
* \since This function is available since SDL 3.6.0.
*/
[LinkName("SDL_SetGPURenderStateStorageBuffers")] public static extern bool SetGPURenderStateStorageBuffers(GPURenderState* state, c_int num_storage_buffers, GPUBuffer** storage_buffers);
/** /**
* Set fragment shader uniform variables in a custom GPU render state. * Set fragment shader uniform variables in a custom GPU render state.
* *

View File

@@ -8,36 +8,36 @@ namespace SDL3;
extension SDL extension SDL
{ {
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2026 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2026 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
arising from the use of this software. arising from the use of this software.
Permission is granted to anyone to use this software for any purpose, Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions: freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not 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 claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be in a product, an acknowledgment in the product documentation would be
appreciated but is not required. appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be 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. 3. This notice may not be removed or altered from any source distribution.
*/ */
/** /**
* # CategoryScancode * # CategoryScancode
* *
* Defines keyboard scancodes. * Defines keyboard scancodes.
* *
* Please refer to the Best Keyboard Practices document for details on what * Please refer to the Best Keyboard Practices document for details on what
* this information means and how best to use it. * this information means and how best to use it.
* *
* https://wiki.libsdl.org/SDL3/BestKeyboardPractices * https://wiki.libsdl.org/SDL3/BestKeyboardPractices
*/ */
@@ -45,28 +45,28 @@ extension SDL
/** /**
* The SDL keyboard scancode representation. * The SDL keyboard scancode representation.
* *
* An SDL scancode is the physical representation of a key on the keyboard, * An SDL scancode is the physical representation of a key on the keyboard,
* independent of language and keyboard mapping. * independent of language and keyboard mapping.
* *
* Values of this type are used to represent keyboard keys, among other places * Values of this type are used to represent keyboard keys, among other places
* in the `scancode` field of the SDL_KeyboardEvent structure. * in the `scancode` field of the SDL_KeyboardEvent structure.
* *
* The values in this enumeration are based on the USB usage page standard: * The values in this enumeration are based on the USB usage page standard:
* https://usb.org/sites/default/files/hut1_5.pdf * https://usb.org/sites/default/files/hut1_5.pdf
* *
* \since This enum is available since SDL 3.2.0. * \since This enum is available since SDL 3.2.0.
*/ */
[AllowDuplicates] public enum Scancode : c_int [AllowDuplicates] public enum Scancode : c_int
{ {
Unknown = 0, Unknown = 0,
/** /**
* \name Usage page 0x07 * \name Usage page 0x07
* *
* These values are from usage page 0x07 (USB keyboard page). * These values are from usage page 0x07 (USB keyboard page).
*/ */
/* @{ */ /* @{ */
@@ -118,50 +118,50 @@ extension SDL
Equals = 46, Equals = 46,
Leftbracket = 47, Leftbracket = 47,
Rightbracket = 48, Rightbracket = 48,
Backslash = 49, /**< Located at the lower left of the return Backslash = 49, /**< Located at the lower left of the return
* key on ISO keyboards and at the right end * key on ISO keyboards and at the right end
* of the QWERTY row on ANSI keyboards. * of the QWERTY row on ANSI keyboards.
* Produces REVERSE SOLIDUS (backslash) and * Produces REVERSE SOLIDUS (backslash) and
* VERTICAL LINE in a US layout, REVERSE * VERTICAL LINE in a US layout, REVERSE
* SOLIDUS and VERTICAL LINE in a UK Mac * SOLIDUS and VERTICAL LINE in a UK Mac
* layout, NUMBER SIGN and TILDE in a UK * layout, NUMBER SIGN and TILDE in a UK
* Windows layout, DOLLAR SIGN and POUND SIGN * Windows layout, DOLLAR SIGN and POUND SIGN
* in a Swiss German layout, NUMBER SIGN and * in a Swiss German layout, NUMBER SIGN and
* APOSTROPHE in a German layout, GRAVE * APOSTROPHE in a German layout, GRAVE
* ACCENT and POUND SIGN in a French Mac * ACCENT and POUND SIGN in a French Mac
* layout, and ASTERISK and MICRO SIGN in a * layout, and ASTERISK and MICRO SIGN in a
* French Windows layout. * French Windows layout.
*/ */
Nonushash = 50, /**< ISO USB keyboards actually use this code Nonushash = 50, /**< ISO USB keyboards actually use this code
* instead of 49 for the same key, but all * instead of 49 for the same key, but all
* OSes I've seen treat the two codes * OSes I've seen treat the two codes
* identically. So, as an implementor, unless * identically. So, as an implementer, unless
* your keyboard generates both of those * your keyboard generates both of those
* codes and your OS treats them differently, * codes and your OS treats them differently,
* you should generate SDL_SCANCODE_BACKSLASH * you should generate SDL_SCANCODE_BACKSLASH
* instead of this code. As a user, you * instead of this code. As a user, you
* should not rely on this code because SDL * should not rely on this code because SDL
* will never generate it with most (all?) * will never generate it with most (all?)
* keyboards. * keyboards.
*/ */
Semicolon = 51, Semicolon = 51,
Apostrophe = 52, Apostrophe = 52,
Grave = 53, /**< Located in the top left corner (on both ANSI Grave = 53, /**< Located in the top left corner (on both ANSI
* and ISO keyboards). Produces GRAVE ACCENT and * and ISO keyboards). Produces GRAVE ACCENT and
* TILDE in a US Windows layout and in US and UK * TILDE in a US Windows layout and in US and UK
* Mac layouts on ANSI keyboards, GRAVE ACCENT * Mac layouts on ANSI keyboards, GRAVE ACCENT
* and NOT SIGN in a UK Windows layout, SECTION * and NOT SIGN in a UK Windows layout, SECTION
* SIGN and PLUS-MINUS SIGN in US and UK Mac * SIGN and PLUS-MINUS SIGN in US and UK Mac
* layouts on ISO keyboards, SECTION SIGN and * layouts on ISO keyboards, SECTION SIGN and
* DEGREE SIGN in a Swiss German layout (Mac: * DEGREE SIGN in a Swiss German layout (Mac:
* only on ISO keyboards), CIRCUMFLEX ACCENT and * only on ISO keyboards), CIRCUMFLEX ACCENT and
* DEGREE SIGN in a German layout (Mac: only on * DEGREE SIGN in a German layout (Mac: only on
* ISO keyboards), SUPERSCRIPT TWO and TILDE in a * ISO keyboards), SUPERSCRIPT TWO and TILDE in a
* French Windows layout, COMMERCIAL AT and * French Windows layout, COMMERCIAL AT and
* NUMBER SIGN in a French Mac layout on ISO * NUMBER SIGN in a French Mac layout on ISO
* keyboards, and LESS-THAN SIGN and GREATER-THAN * keyboards, and LESS-THAN SIGN and GREATER-THAN
* SIGN in a Swiss German, German, or French Mac * SIGN in a Swiss German, German, or French Mac
* layout on ANSI keyboards. * layout on ANSI keyboards.
*/ */
Comma = 54, Comma = 54,
Period = 55, Period = 55,
@@ -185,7 +185,7 @@ extension SDL
Printscreen = 70, Printscreen = 70,
Scrolllock = 71, Scrolllock = 71,
Pause = 72, Pause = 72,
Insert = 73, /**< insert on PC, help on some Mac keyboards (but Insert = 73, /**< insert on PC, help on some Mac keyboards (but
does send code 73, not 117) */ does send code 73, not 117) */
Home = 74, Home = 74,
Pageup = 75, Pageup = 75,
@@ -197,7 +197,7 @@ extension SDL
Down = 81, Down = 81,
Up = 82, Up = 82,
Numlockclear = 83, /**< num lock on PC, clear on Mac keyboards Numlockclear = 83, /**< num lock on PC, clear on Mac keyboards
*/ */
KpDivide = 84, KpDivide = 84,
KpMultiply = 85, KpMultiply = 85,
@@ -216,19 +216,19 @@ extension SDL
Kp0 = 98, Kp0 = 98,
KpPeriod = 99, KpPeriod = 99,
Nonusbackslash = 100, /**< This is the additional key that ISO Nonusbackslash = 100, /**< This is the additional key that ISO
* keyboards have over ANSI ones, * keyboards have over ANSI ones,
* located between left shift and Z. * located between left shift and Z.
* Produces GRAVE ACCENT and TILDE in a * Produces GRAVE ACCENT and TILDE in a
* US or UK Mac layout, REVERSE SOLIDUS * US or UK Mac layout, REVERSE SOLIDUS
* (backslash) and VERTICAL LINE in a * (backslash) and VERTICAL LINE in a
* US or UK Windows layout, and * US or UK Windows layout, and
* LESS-THAN SIGN and GREATER-THAN SIGN * LESS-THAN SIGN and GREATER-THAN SIGN
* in a Swiss German, German, or French * in a Swiss German, German, or French
* layout. */ * layout. */
Application = 101, /**< windows contextual menu, compose */ Application = 101, /**< windows contextual menu, compose */
Power = 102, /**< The USB document says this is a status flag, Power = 102, /**< The USB document says this is a status flag,
* not a physical key - but some Mac keyboards * not a physical key - but some Mac keyboards
* do have a power key. */ * do have a power key. */
KpEquals = 103, KpEquals = 103,
F13 = 104, F13 = 104,
@@ -264,7 +264,7 @@ extension SDL
KpComma = 133, KpComma = 133,
KpEqualsas400 = 134, KpEqualsas400 = 134,
International1 = 135, /**< used on Asian keyboards, see International1 = 135, /**< used on Asian keyboards, see
footnotes in USB doc */ footnotes in USB doc */
International2 = 136, International2 = 136,
International3 = 137, /**< Yen */ International3 = 137, /**< Yen */
@@ -353,21 +353,21 @@ extension SDL
Ralt = 230, /**< alt gr, option */ Ralt = 230, /**< alt gr, option */
Rgui = 231, /**< windows, command (apple), meta */ Rgui = 231, /**< windows, command (apple), meta */
Mode = 257, /**< I'm not sure if this is really not covered Mode = 257, /**< I'm not sure if this is really not covered
* by any of the above, but since there's a * by any of the above, but since there's a
* special SDL_KMOD_MODE for it I'm adding it here * special SDL_KMOD_MODE for it I'm adding it here
*/ */
/* @} */ /* Usage page 0x07 */ /* @} */ /* Usage page 0x07 */
/** /**
* \name Usage page 0x0C * \name Usage page 0x0C
* *
* These values are mapped from usage page 0x0C (USB consumer page). * These values are mapped from usage page 0x0C (USB consumer page).
* *
* There are way more keys in the spec than we can represent in the * There are way more keys in the spec than we can represent in the
* current scancode range, so pick the ones that commonly come up in * current scancode range, so pick the ones that commonly come up in
* real world usage. * real world usage.
*/ */
/* @{ */ /* @{ */
@@ -408,20 +408,20 @@ extension SDL
/* @} */ /* Usage page 0x0C */ /* @} */ /* Usage page 0x0C */
/** /**
* \name Mobile keys * \name Mobile keys
* *
* These are values that are often used on mobile phones. * These are values that are often used on mobile phones.
*/ */
/* @{ */ /* @{ */
Softleft = 287, /**< Usually situated below the display on phones and Softleft = 287, /**< Usually situated below the display on phones and
used as a multi-function feature key for selecting used as a multi-function feature key for selecting
a software defined function shown on the bottom left a software defined function shown on the bottom left
of the display. */ of the display. */
Softright = 288, /**< Usually situated below the display on phones and Softright = 288, /**< Usually situated below the display on phones and
used as a multi-function feature key for selecting used as a multi-function feature key for selecting
a software defined function shown on the bottom right a software defined function shown on the bottom right
of the display. */ of the display. */
Call = 289, /**< Used for accepting phone calls. */ Call = 289, /**< Used for accepting phone calls. */
Endcall = 290, /**< Used for rejecting phone calls. */ Endcall = 290, /**< Used for rejecting phone calls. */
@@ -432,11 +432,10 @@ extension SDL
Reserved = 400, /**< 400-500 reserved for dynamic keycodes */ Reserved = 400, /**< 400-500 reserved for dynamic keycodes */
Count = 512, Count = 512, /**< not a key, just marks the number of scancodes for array bounds */
}
/**< not a key, just marks the number of scancodes for array bounds */
} }
/* SDL_scancode_h_ */ /* SDL_scancode_h_ */
}

View File

@@ -264,12 +264,6 @@ extension SDL
/** /**
* Macro useful for building other macros with strings in them. * Macro useful for building other macros with strings in them.
* *
* For example:
*
* ```c
* #define LOG_ERROR(X) OutputDebugString(SDL_STRINGIFY_ARG(__FUNCTION__) ": " X "\n")`
* ```
*
* \param arg the text to turn into a string literal. * \param arg the text to turn into a string literal.
* *
* \since This macro is available since SDL 3.2.0. * \since This macro is available since SDL 3.2.0.
@@ -1803,6 +1797,8 @@ public function void free_func(void* mem);
/** /**
* Get the value of a variable in the environment. * Get the value of a variable in the environment.
* *
* The name of the variable is case sensitive on all platforms.
*
* This function uses SDL's cached copy of the environment and is thread-safe. * This function uses SDL's cached copy of the environment and is thread-safe.
* *
* \param name the name of the variable to get. * \param name the name of the variable to get.
@@ -1821,6 +1817,11 @@ public function void free_func(void* mem);
* This function bypasses SDL's cached copy of the environment and is not * This function bypasses SDL's cached copy of the environment and is not
* thread-safe. * thread-safe.
* *
* On some platforms, this may make case-insensitive matches, while other
* platforms are case-sensitive. It is best to be precise with strings used
* for queries through this interface. SDL_getenv is always case-sensitive,
* however.
*
* \param name the name of the variable to get. * \param name the name of the variable to get.
* \returns a pointer to the value of the variable or NULL if it can't be * \returns a pointer to the value of the variable or NULL if it can't be
* found. * found.
@@ -4360,7 +4361,7 @@ public const let INVALID_UNICODE_CODEPOINT = 0xFFFD;
/** /**
* Generate 32 pseudo-random bits. * Generate 32 pseudo-random bits.
* *
* You likely want to use SDL_rand() to get a psuedo-random number instead. * You likely want to use SDL_rand() to get a pseudo-random number instead.
* *
* There are no guarantees as to the quality of the random sequence produced, * There are no guarantees as to the quality of the random sequence produced,
* and this should not be used for security (cryptography, passwords) or where * and this should not be used for security (cryptography, passwords) or where
@@ -4445,7 +4446,7 @@ public const let INVALID_UNICODE_CODEPOINT = 0xFFFD;
/** /**
* Generate 32 pseudo-random bits. * Generate 32 pseudo-random bits.
* *
* You likely want to use SDL_rand_r() to get a psuedo-random number instead. * You likely want to use SDL_rand_r() to get a pseudo-random number instead.
* *
* There are no guarantees as to the quality of the random sequence produced, * There are no guarantees as to the quality of the random sequence produced,
* and this should not be used for security (cryptography, passwords) or where * and this should not be used for security (cryptography, passwords) or where
@@ -4684,7 +4685,7 @@ public const let PI_F = 3.141592653589793238462643383279502884F;/**< pi (float
* *
* Domain: `-INF <= x <= INF`, `-INF <= y <= INF` * Domain: `-INF <= x <= INF`, `-INF <= y <= INF`
* *
* Range: `-Pi <= y <= Pi` * Range: `-Pi <= z <= Pi`
* *
* This function operates on double-precision floating point values, use * This function operates on double-precision floating point values, use
* SDL_atan2f for single-precision floats. * SDL_atan2f for single-precision floats.
@@ -4698,8 +4699,8 @@ public const let PI_F = 3.141592653589793238462643383279502884F;/**< pi (float
* *
* \param y floating point value of the numerator (y coordinate). * \param y floating point value of the numerator (y coordinate).
* \param x floating point value of the denominator (x coordinate). * \param x floating point value of the denominator (x coordinate).
* \returns arc tangent of of `y / x` in radians, or, if `x = 0`, either * \returns arc tangent of `y / x` in radians, or, if `x = 0`, either `-Pi/2`,
* `-Pi/2`, `0`, or `Pi/2`, depending on the value of `y`. * `0`, or `Pi/2`, depending on the value of `y`.
* *
* \threadsafety It is safe to call this function from any thread. * \threadsafety It is safe to call this function from any thread.
* *
@@ -5822,6 +5823,8 @@ public const let PI_F = 3.141592653589793238462643383279502884F;/**< pi (float
* \returns a handle that must be freed with SDL_iconv_close, or * \returns a handle that must be freed with SDL_iconv_close, or
* SDL_ICONV_ERROR on failure. * SDL_ICONV_ERROR on failure.
* *
* \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.2.0.
* *
* \sa SDL_iconv * \sa SDL_iconv
@@ -5836,6 +5839,8 @@ public const let PI_F = 3.141592653589793238462643383279502884F;/**< pi (float
* \param cd The character set conversion handle. * \param cd The character set conversion handle.
* \returns 0 on success, or -1 on failure. * \returns 0 on success, or -1 on failure.
* *
* \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.2.0.
* *
* \sa SDL_iconv * \sa SDL_iconv
@@ -5874,6 +5879,8 @@ public const let PI_F = 3.141592653589793238462643383279502884F;/**< pi (float
* \param outbytesleft The number of bytes in the output buffer. * \param outbytesleft The number of bytes in the output buffer.
* \returns the number of conversions on success, or a negative error code. * \returns the number of conversions on success, or a negative error code.
* *
* \threadsafety Do not use the same SDL_iconv_t from two threads at once.
*
* \since This function is available since SDL 3.2.0. * \since This function is available since SDL 3.2.0.
* *
* \sa SDL_iconv_open * \sa SDL_iconv_open
@@ -5907,6 +5914,8 @@ public const let ICONV_EINVAL = (c_size)-4;/**< Incomplete input sequence was
* \param inbytesleft the size of the input string _in bytes_. * \param inbytesleft the size of the input string _in bytes_.
* \returns a new string, converted to the new encoding, or NULL on error. * \returns a new string, converted to the new encoding, or NULL on error.
* *
* \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.2.0.
* *
* \sa SDL_iconv_open * \sa SDL_iconv_open
@@ -5927,6 +5936,8 @@ public const let ICONV_EINVAL = (c_size)-4;/**< Incomplete input sequence was
* \param S the string to convert. * \param S the string to convert.
* \returns a new string, converted to the new encoding, or NULL on error. * \returns a new string, converted to the new encoding, or NULL on error.
* *
* \threadsafety It is safe to call this macro from any thread.
*
* \since This macro is available since SDL 3.2.0. * \since This macro is available since SDL 3.2.0.
*/ */
@@ -5941,6 +5952,8 @@ public const let ICONV_EINVAL = (c_size)-4;/**< Incomplete input sequence was
* \param S the string to convert. * \param S the string to convert.
* \returns a new string, converted to the new encoding, or NULL on error. * \returns a new string, converted to the new encoding, or NULL on error.
* *
* \threadsafety It is safe to call this macro from any thread.
*
* \since This macro is available since SDL 3.2.0. * \since This macro is available since SDL 3.2.0.
*/ */
@@ -5955,6 +5968,8 @@ public const let ICONV_EINVAL = (c_size)-4;/**< Incomplete input sequence was
* \param S the string to convert. * \param S the string to convert.
* \returns a new string, converted to the new encoding, or NULL on error. * \returns a new string, converted to the new encoding, or NULL on error.
* *
* \threadsafety It is safe to call this macro from any thread.
*
* \since This macro is available since SDL 3.2.0. * \since This macro is available since SDL 3.2.0.
*/ */
@@ -5969,6 +5984,8 @@ public const let ICONV_EINVAL = (c_size)-4;/**< Incomplete input sequence was
* \param S the string to convert. * \param S the string to convert.
* \returns a new string, converted to the new encoding, or NULL on error. * \returns a new string, converted to the new encoding, or NULL on error.
* *
* \threadsafety It is safe to call this macro from any thread.
*
* \since This macro is available since SDL 3.2.0. * \since This macro is available since SDL 3.2.0.
*/ */

View File

@@ -96,6 +96,8 @@ extension SDL
* \param callback the SDL_WindowsMessageHook function to call. * \param callback the SDL_WindowsMessageHook function to call.
* \param userdata a pointer to pass to every iteration of `callback`. * \param userdata a pointer to pass to every iteration of `callback`.
* *
* \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.2.0.
* *
* \sa SDL_WindowsMessageHook * \sa SDL_WindowsMessageHook
@@ -179,6 +181,8 @@ public function bool X11EventHook(void* userdata, XEvent* xevent);
* \param callback the SDL_X11EventHook function to call. * \param callback the SDL_X11EventHook function to call.
* \param userdata a pointer to pass to every iteration of `callback`. * \param userdata a pointer to pass to every iteration of `callback`.
* *
* \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.2.0.
*/ */
[LinkName("SDL_SetX11EventHook")] public static extern void SetX11EventHook(X11EventHook callback, void* userdata); [LinkName("SDL_SetX11EventHook")] public static extern void SetX11EventHook(X11EventHook callback, void* userdata);
@@ -196,6 +200,8 @@ public function bool X11EventHook(void* userdata, XEvent* xevent);
* \returns true on success or false on failure; call SDL_GetError() for more * \returns true on success or false on failure; call SDL_GetError() for more
* information. * information.
* *
* \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.2.0.
*/ */
@@ -212,6 +218,8 @@ public function bool X11EventHook(void* userdata, XEvent* xevent);
* \returns true on success or false on failure; call SDL_GetError() for more * \returns true on success or false on failure; call SDL_GetError() for more
* information. * information.
* *
* \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.2.0.
*/ */
@@ -274,6 +282,8 @@ public function bool X11EventHook(void* userdata, XEvent* xevent);
* \returns true on success or false on failure; call SDL_GetError() for more * \returns true on success or false on failure; call SDL_GetError() for more
* information. * information.
* *
* \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.2.0.
* *
* \sa SDL_SetiOSEventPump * \sa SDL_SetiOSEventPump
@@ -287,6 +297,8 @@ public function bool X11EventHook(void* userdata, XEvent* xevent);
* *
* \param enabled true to enable the event pump, false to disable it. * \param enabled true to enable the event pump, false to disable it.
* *
* \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.2.0.
* *
* \sa SDL_SetiOSAnimationCallback * \sa SDL_SetiOSAnimationCallback
@@ -380,6 +392,8 @@ public function bool X11EventHook(void* userdata, XEvent* xevent);
* *
* \returns the Android API level. * \returns the Android API level.
* *
* \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.2.0.
*/ */
@@ -389,6 +403,8 @@ public function bool X11EventHook(void* userdata, XEvent* xevent);
* *
* \returns true if this is a Chromebook, false otherwise. * \returns true if this is a Chromebook, false otherwise.
* *
* \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.2.0.
*/ */
@@ -398,6 +414,8 @@ public function bool X11EventHook(void* userdata, XEvent* xevent);
* *
* \returns true if this is a DeX docking station, false otherwise. * \returns true if this is a DeX docking station, false otherwise.
* *
* \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.2.0.
*/ */
@@ -540,10 +558,10 @@ public function bool X11EventHook(void* userdata, XEvent* xevent);
* specific entitlement, the callback will still fire, probably on the current * specific entitlement, the callback will still fire, probably on the current
* thread and before this function returns. * thread and before this function returns.
* *
* If the request submission fails, this function returns -1 and the callback * If the request submission fails, this function returns false and the
* will NOT be called, but this should only happen in catastrophic conditions, * callback will NOT be called, but this should only happen in catastrophic
* like memory running out. Normally there will be a yes or no to the request * conditions, like memory running out. Normally there will be a yes or no to
* through the callback. * the request through the callback.
* *
* For the `permission` parameter, choose a value from here: * For the `permission` parameter, choose a value from here:
* *
@@ -615,6 +633,8 @@ public function bool X11EventHook(void* userdata, XEvent* xevent);
* *
* \returns true if the device is a tablet, false otherwise. * \returns true if the device is a tablet, false otherwise.
* *
* \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.2.0.
*/ */
[LinkName("SDL_IsTablet")] public static extern bool IsTablet(); [LinkName("SDL_IsTablet")] public static extern bool IsTablet();
@@ -626,6 +646,8 @@ public function bool X11EventHook(void* userdata, XEvent* xevent);
* *
* \returns true if the device is a TV, false otherwise. * \returns true if the device is a TV, false otherwise.
* *
* \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.2.0.
*/ */
[LinkName("SDL_IsTV")] public static extern bool IsTV(); [LinkName("SDL_IsTV")] public static extern bool IsTV();

View File

@@ -218,6 +218,8 @@ public function c_int ThreadFunction(void* data);
* new thread could not be created; call SDL_GetError() for more * new thread could not be created; call SDL_GetError() for more
* information. * information.
* *
* \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.2.0.
* *
* \sa SDL_CreateThreadWithProperties * \sa SDL_CreateThreadWithProperties
@@ -284,6 +286,8 @@ public function c_int ThreadFunction(void* data);
* new thread could not be created; call SDL_GetError() for more * new thread could not be created; call SDL_GetError() for more
* information. * information.
* *
* \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.2.0.
* *
* \sa SDL_CreateThread * \sa SDL_CreateThread
@@ -339,6 +343,8 @@ public const let EndThreadFunction = null;
* new thread could not be created; call SDL_GetError() for more * new thread could not be created; call SDL_GetError() for more
* information. * information.
* *
* \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.2.0.
*/ */
[LinkName("SDL_CreateThreadRuntime")] public static extern Thread* CreateThreadRuntime(ThreadFunction fn, c_char* name, void* data, FunctionPointer pfnBeginThread, FunctionPointer pfnEndThread); [LinkName("SDL_CreateThreadRuntime")] public static extern Thread* CreateThreadRuntime(ThreadFunction fn, c_char* name, void* data, FunctionPointer pfnBeginThread, FunctionPointer pfnEndThread);
@@ -353,6 +359,8 @@ public const let EndThreadFunction = null;
* new thread could not be created; call SDL_GetError() for more * new thread could not be created; call SDL_GetError() for more
* information. * information.
* *
* \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.2.0.
*/ */
[LinkName("SDL_CreateThreadWithPropertiesRuntime")] public static extern Thread* CreateThreadWithPropertiesRuntime(PropertiesID props, FunctionPointer pfnBeginThread, FunctionPointer pfnEndThread); [LinkName("SDL_CreateThreadWithPropertiesRuntime")] public static extern Thread* CreateThreadWithPropertiesRuntime(PropertiesID props, FunctionPointer pfnBeginThread, FunctionPointer pfnEndThread);
@@ -373,6 +381,8 @@ public const let PROP_THREAD_CREATE_STACKSIZE_NUMBER = "S
* \returns a pointer to a UTF-8 string that names the specified thread, or * \returns a pointer to a UTF-8 string that names the specified thread, or
* NULL if it doesn't have a name. * NULL if it doesn't have a name.
* *
* \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.2.0.
*/ */
[LinkName("SDL_GetThreadName")] public static extern c_char* GetThreadName(Thread* thread); [LinkName("SDL_GetThreadName")] public static extern c_char* GetThreadName(Thread* thread);
@@ -389,6 +399,8 @@ public const let PROP_THREAD_CREATE_STACKSIZE_NUMBER = "S
* *
* \returns the ID of the current thread. * \returns the ID of the current thread.
* *
* \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.2.0.
* *
* \sa SDL_GetThreadID * \sa SDL_GetThreadID
@@ -406,6 +418,8 @@ public const let PROP_THREAD_CREATE_STACKSIZE_NUMBER = "S
* \returns the ID of the specified thread, or the ID of the current thread if * \returns the ID of the specified thread, or the ID of the current thread if
* `thread` is NULL. * `thread` is NULL.
* *
* \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.2.0.
* *
* \sa SDL_GetCurrentThreadID * \sa SDL_GetCurrentThreadID
@@ -423,6 +437,8 @@ public const let PROP_THREAD_CREATE_STACKSIZE_NUMBER = "S
* \returns true on success or false on failure; call SDL_GetError() for more * \returns true on success or false on failure; call SDL_GetError() for more
* information. * information.
* *
* \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.2.0.
*/ */
[LinkName("SDL_SetCurrentThreadPriority")] public static extern bool SetCurrentThreadPriority(ThreadPriority priority); [LinkName("SDL_SetCurrentThreadPriority")] public static extern bool SetCurrentThreadPriority(ThreadPriority priority);
@@ -455,6 +471,9 @@ public const let PROP_THREAD_CREATE_STACKSIZE_NUMBER = "S
* function by its 'return', or -1 if the thread has been * function by its 'return', or -1 if the thread has been
* detached or isn't valid, may be NULL. * detached or isn't valid, may be NULL.
* *
* \threadsafety It is safe to call this function from any thread, but only a
* single thread can wait any specific thread to finish.
*
* \since This function is available since SDL 3.2.0. * \since This function is available since SDL 3.2.0.
* *
* \sa SDL_CreateThread * \sa SDL_CreateThread
@@ -469,6 +488,8 @@ public const let PROP_THREAD_CREATE_STACKSIZE_NUMBER = "S
* \returns the current state of a thread, or SDL_THREAD_UNKNOWN if the thread * \returns the current state of a thread, or SDL_THREAD_UNKNOWN if the thread
* isn't valid. * isn't valid.
* *
* \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.2.0.
* *
* \sa SDL_ThreadState * \sa SDL_ThreadState
@@ -504,6 +525,8 @@ public const let PROP_THREAD_CREATE_STACKSIZE_NUMBER = "S
* \param thread the SDL_Thread pointer that was returned from the * \param thread the SDL_Thread pointer that was returned from the
* SDL_CreateThread() call that started this thread. * SDL_CreateThread() call that started this thread.
* *
* \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.2.0.
* *
* \sa SDL_CreateThread * \sa SDL_CreateThread

View File

@@ -116,6 +116,8 @@ freely, subject to the following restrictions:
* \returns true on success or false on failure; call SDL_GetError() for more * \returns true on success or false on failure; call SDL_GetError() for more
* information. * information.
* *
* \threadsafety This function is not thread safe.
*
* \since This function is available since SDL 3.2.0. * \since This function is available since SDL 3.2.0.
*/ */
[LinkName("SDL_GetDateTimeLocalePreferences")] public static extern bool GetDateTimeLocalePreferences(DateFormat* dateFormat, TimeFormat* timeFormat); [LinkName("SDL_GetDateTimeLocalePreferences")] public static extern bool GetDateTimeLocalePreferences(DateFormat* dateFormat, TimeFormat* timeFormat);
@@ -128,6 +130,8 @@ freely, subject to the following restrictions:
* \returns true on success or false on failure; call SDL_GetError() for more * \returns true on success or false on failure; call SDL_GetError() for more
* information. * information.
* *
* \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.2.0.
*/ */
[LinkName("SDL_GetCurrentTime")] public static extern bool GetCurrentTime(Time* ticks); [LinkName("SDL_GetCurrentTime")] public static extern bool GetCurrentTime(Time* ticks);
@@ -144,6 +148,8 @@ freely, subject to the following restrictions:
* \returns true on success or false on failure; call SDL_GetError() for more * \returns true on success or false on failure; call SDL_GetError() for more
* information. * information.
* *
* \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.2.0.
*/ */
[LinkName("SDL_TimeToDateTime")] public static extern bool TimeToDateTime(Time ticks, DateTime* dt, bool localTime); [LinkName("SDL_TimeToDateTime")] public static extern bool TimeToDateTime(Time ticks, DateTime* dt, bool localTime);
@@ -159,6 +165,8 @@ freely, subject to the following restrictions:
* \returns true on success or false on failure; call SDL_GetError() for more * \returns true on success or false on failure; call SDL_GetError() for more
* information. * information.
* *
* \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.2.0.
*/ */
[LinkName("SDL_DateTimeToTime")] public static extern bool DateTimeToTime(DateTime* dt, Time* ticks); [LinkName("SDL_DateTimeToTime")] public static extern bool DateTimeToTime(DateTime* dt, Time* ticks);
@@ -175,6 +183,8 @@ freely, subject to the following restrictions:
* \param dwHighDateTime a pointer filled in with the high portion of the * \param dwHighDateTime a pointer filled in with the high portion of the
* Windows FILETIME value. * Windows FILETIME value.
* *
* \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.2.0.
*/ */
[LinkName("SDL_TimeToWindows")] public static extern void TimeToWindows(Time ticks, out Uint32 dwLowDateTime, out Uint32 dwHighDateTime); [LinkName("SDL_TimeToWindows")] public static extern void TimeToWindows(Time ticks, out Uint32 dwLowDateTime, out Uint32 dwHighDateTime);
@@ -190,6 +200,8 @@ freely, subject to the following restrictions:
* \param dwHighDateTime the high portion of the Windows FILETIME value. * \param dwHighDateTime the high portion of the Windows FILETIME value.
* \returns the converted SDL time. * \returns the converted SDL time.
* *
* \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.2.0.
*/ */
[LinkName("SDL_TimeFromWindows")] public static extern Time TimeFromWindows(Uint32 dwLowDateTime, Uint32 dwHighDateTime); [LinkName("SDL_TimeFromWindows")] public static extern Time TimeFromWindows(Uint32 dwLowDateTime, Uint32 dwHighDateTime);
@@ -202,6 +214,8 @@ freely, subject to the following restrictions:
* \returns the number of days in the requested month or -1 on failure; call * \returns the number of days in the requested month or -1 on failure; call
* SDL_GetError() for more information. * SDL_GetError() for more information.
* *
* \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.2.0.
*/ */
[LinkName("SDL_GetDaysInMonth")] public static extern c_int GetDaysInMonth(c_int year, c_int month); [LinkName("SDL_GetDaysInMonth")] public static extern c_int GetDaysInMonth(c_int year, c_int month);
@@ -215,6 +229,8 @@ freely, subject to the following restrictions:
* \returns the day of year [0-365] if the date is valid or -1 on failure; * \returns the day of year [0-365] if the date is valid or -1 on failure;
* call SDL_GetError() for more information. * 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.2.0. * \since This function is available since SDL 3.2.0.
*/ */
[LinkName("SDL_GetDayOfYear")] public static extern c_int GetDayOfYear(c_int year, c_int month, c_int day); [LinkName("SDL_GetDayOfYear")] public static extern c_int GetDayOfYear(c_int year, c_int month, c_int day);
@@ -228,6 +244,8 @@ freely, subject to the following restrictions:
* \returns a value between 0 and 6 (0 being Sunday) if the date is valid or * \returns a value between 0 and 6 (0 being Sunday) if the date is valid or
* -1 on failure; call SDL_GetError() for more information. * -1 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.2.0. * \since This function is available since SDL 3.2.0.
*/ */
[LinkName("SDL_GetDayOfWeek")] public static extern c_int GetDayOfWeek(c_int year, c_int month, c_int day); [LinkName("SDL_GetDayOfWeek")] public static extern c_int GetDayOfWeek(c_int year, c_int month, c_int day);

View File

@@ -48,6 +48,7 @@ extension SDL
/* Set up for C function definitions, even when using C++ */ /* Set up for C function definitions, even when using C++ */
@@ -107,6 +108,22 @@ public enum TrayEntryFlags : Uint32
*/ */
public function void TrayCallback(void* userdata, TrayEntry* entry); public function void TrayCallback(void* userdata, TrayEntry* entry);
/**
* A callback that is invoked when the tray icon is clicked.
*
* \param userdata an optional pointer to pass extra data to the callback when
* it will be invoked. May be NULL.
* \param tray the tray that was clicked.
* \returns true to show the tray menu after the callback returns, false to
* skip showing the menu. This return value is only used for left and
* right click callbacks; other mouse events ignore the return value.
*
* \since This datatype is available since SDL 3.6.0.
*
* \sa SDL_CreateTrayWithProperties
*/
public function bool TrayClickCallback(void* userdata, Tray* tray);
/** /**
* Create an icon to be placed in the operating system's tray, or equivalent. * Create an icon to be placed in the operating system's tray, or equivalent.
* *
@@ -125,12 +142,64 @@ public function void TrayCallback(void* userdata, TrayEntry* entry);
* *
* \since This function is available since SDL 3.2.0. * \since This function is available since SDL 3.2.0.
* *
* \sa SDL_CreateTrayWithProperties
* \sa SDL_CreateTrayMenu * \sa SDL_CreateTrayMenu
* \sa SDL_GetTrayMenu * \sa SDL_GetTrayMenu
* \sa SDL_DestroyTray * \sa SDL_DestroyTray
*/ */
[LinkName("SDL_CreateTray")] public static extern Tray* CreateTray(Surface* icon, c_char* tooltip); [LinkName("SDL_CreateTray")] public static extern Tray* CreateTray(Surface* icon, c_char* tooltip);
/**
* Create an icon to be placed in the operating system's tray, or equivalent.
*
* Many platforms advise not using a system tray unless persistence is a
* necessary feature. Avoid needlessly creating a tray icon, as the user may
* feel like it clutters their interface.
*
* Using tray icons require the video subsystem.
*
* These are the supported properties:
*
* - `SDL_PROP_TRAY_CREATE_ICON_POINTER`: an SDL_Surface to be used as the
* tray icon. May be NULL.
* - `SDL_PROP_TRAY_CREATE_TOOLTIP_STRING`: a tooltip to be displayed when the
* mouse hovers the icon in UTF-8 encoding. Not supported on all platforms.
* May be NULL.
* - `SDL_PROP_TRAY_CREATE_USERDATA_POINTER`: an optional pointer to associate
* with the tray, which will be passed to click callbacks. May be NULL.
* - `SDL_PROP_TRAY_CREATE_LEFTCLICK_CALLBACK_POINTER`: an
* SDL_TrayClickCallback to be invoked when the tray icon is left-clicked.
* Not supported on all platforms. The callback should return true to show
* the default menu, or false to skip showing it. May be NULL.
* - `SDL_PROP_TRAY_CREATE_RIGHTCLICK_CALLBACK_POINTER`: an
* SDL_TrayClickCallback to be invoked when the tray icon is right-clicked.
* Not supported on all platforms. The callback should return true to show
* the default menu, or false to skip showing it. May be NULL.
* - `SDL_PROP_TRAY_CREATE_MIDDLECLICK_CALLBACK_POINTER`: an
* SDL_TrayClickCallback to be invoked when the tray icon is middle-clicked.
* Not supported on all platforms. May be NULL.
*
* \param props the properties to use.
* \returns The newly created system tray icon.
*
* \threadsafety This function should only be called on the main thread.
*
* \since This function is available since SDL 3.6.0.
*
* \sa SDL_CreateTray
* \sa SDL_CreateTrayMenu
* \sa SDL_GetTrayMenu
* \sa SDL_DestroyTray
*/
[LinkName("SDL_CreateTrayWithProperties")] public static extern Tray* CreateTrayWithProperties(PropertiesID props);
public const let PROP_TRAY_CREATE_ICON_POINTER = "SDL.tray.create.icon";
public const let PROP_TRAY_CREATE_TOOLTIP_STRING = "SDL.tray.create.tooltip";
public const let PROP_TRAY_CREATE_USERDATA_POINTER = "SDL.tray.create.userdata";
public const let PROP_TRAY_CREATE_LEFTCLICK_CALLBACK_POINTER = "SDL.tray.create.leftclick_callback";
public const let PROP_TRAY_CREATE_RIGHTCLICK_CALLBACK_POINTER = "SDL.tray.create.rightclick_callback";
public const let PROP_TRAY_CREATE_MIDDLECLICK_CALLBACK_POINTER = "SDL.tray.create.middleclick_callback";
/** /**
* Updates the system tray icon's icon. * Updates the system tray icon's icon.
* *

View File

@@ -95,6 +95,8 @@ public static c_int VERSIONNUM(c_int major, c_int minor, c_int patch) => ((major
* *
* \param version the version number. * \param version the version number.
* *
* \threadsafety It is safe to call this macro from any thread.
*
* \since This macro is available since SDL 3.2.0. * \since This macro is available since SDL 3.2.0.
*/ */
public static c_int VERSIONNUM_MAJOR(c_int version) => ((version)/1000000); public static c_int VERSIONNUM_MAJOR(c_int version) => ((version)/1000000);
@@ -106,6 +108,8 @@ public static c_int VERSIONNUM_MAJOR(c_int version) => ((version)/1000000);
* *
* \param version the version number. * \param version the version number.
* *
* \threadsafety It is safe to call this macro from any thread.
*
* \since This macro is available since SDL 3.2.0. * \since This macro is available since SDL 3.2.0.
*/ */
public static c_int VERSIONNUM_MINOR(c_int version) => (((version)/1000)%1000); public static c_int VERSIONNUM_MINOR(c_int version) => (((version)/1000)%1000);
@@ -117,6 +121,8 @@ public static c_int VERSIONNUM_MINOR(c_int version) => (((version)/1000)%1000);
* *
* \param version the version number. * \param version the version number.
* *
* \threadsafety It is safe to call this macro from any thread.
*
* \since This macro is available since SDL 3.2.0. * \since This macro is available since SDL 3.2.0.
*/ */
public static c_int VERSIONNUM_MICRO(c_int version) => ((version)%1000); public static c_int VERSIONNUM_MICRO(c_int version) => ((version)%1000);
@@ -124,6 +130,8 @@ public static c_int VERSIONNUM_MICRO(c_int version) => ((version)%1000);
/** /**
* This is the version number macro for the current SDL version. * This is the version number macro for the current SDL version.
* *
* \threadsafety It is safe to call this macro from any thread.
*
* \since This macro is available since SDL 3.2.0. * \since This macro is available since SDL 3.2.0.
* *
* \sa SDL_GetVersion * \sa SDL_GetVersion
@@ -135,6 +143,8 @@ public const let VERSION
/** /**
* This macro will evaluate to true if compiled with SDL at least X.Y.Z. * This macro will evaluate to true if compiled with SDL at least X.Y.Z.
* *
* \threadsafety It is safe to call this macro from any thread.
*
* \since This macro is available since SDL 3.2.0. * \since This macro is available since SDL 3.2.0.
*/ */
public static bool VERSION_ATLEAST(c_int X, c_int Y, c_int Z) => (VERSION>=VERSIONNUM(X,Y,Z)); public static bool VERSION_ATLEAST(c_int X, c_int Y, c_int Z) => (VERSION>=VERSIONNUM(X,Y,Z));
@@ -152,6 +162,8 @@ public static bool VERSION_ATLEAST(c_int X, c_int Y, c_int Z) => (VERSION>=VERSI
* *
* \returns the version of the linked library. * \returns the version of the linked library.
* *
* \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.2.0.
* *
* \sa SDL_GetRevision * \sa SDL_GetRevision
@@ -179,6 +191,8 @@ public static bool VERSION_ATLEAST(c_int X, c_int Y, c_int Z) => (VERSION>=VERSI
* \returns an arbitrary string, uniquely identifying the exact revision of * \returns an arbitrary string, uniquely identifying the exact revision of
* the SDL library in use. * the SDL library in use.
* *
* \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.2.0.
* *
* \sa SDL_GetVersion * \sa SDL_GetVersion

View File

@@ -414,7 +414,7 @@ public function EGLint* EGLIntArrayCallback(void* userdata, EGLDisplay display,
ContextFlags, /**< some combination of 0 or more of elements of the SDL_GLContextFlag enumeration; defaults to 0. */ ContextFlags, /**< some combination of 0 or more of elements of the SDL_GLContextFlag enumeration; defaults to 0. */
ContextProfileMask, /**< type of GL context (Core, Compatibility, ES). See SDL_GLProfile; default value depends on platform. */ ContextProfileMask, /**< type of GL context (Core, Compatibility, ES). See SDL_GLProfile; default value depends on platform. */
ShareWithCurrentContext, /**< OpenGL context sharing; defaults to 0. */ ShareWithCurrentContext, /**< OpenGL context sharing; defaults to 0. */
FramebufferSrgbCapable, /**< requests sRGB-capable visual if 1. Defaults to -1 ("don't care"). This is a request; GL drivers might not comply! */ FramebufferSrgbCapable, /**< requests sRGB capable visual; defaults to 0. */
ContextReleaseBehavior, /**< sets context the release behavior. See SDL_GLContextReleaseFlag; defaults to FLUSH. */ ContextReleaseBehavior, /**< sets context the release behavior. See SDL_GLContextReleaseFlag; defaults to FLUSH. */
ContextResetNotification, /**< set context reset notification. See SDL_GLContextResetNotification; defaults to NO_NOTIFICATION. */ ContextResetNotification, /**< set context reset notification. See SDL_GLContextResetNotification; defaults to NO_NOTIFICATION. */
ContextNoError, ContextNoError,