diff --git a/External/SDL b/External/SDL index 17c4bdd..a40b2de 160000 --- a/External/SDL +++ b/External/SDL @@ -1 +1 @@ -Subproject commit 17c4bdd754e860f166bdd2090c3d8a346a1a2bba +Subproject commit a40b2de9466c41426a5a24662c5a17374ea36f0d diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_asyncio.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_asyncio.g.cs new file mode 100644 index 0000000..d991bfd --- /dev/null +++ b/SDL3-CS/SDL3/ClangSharp/SDL_asyncio.g.cs @@ -0,0 +1,119 @@ +/* + + C# bindings for Simple DirectMedia Layer. + Original copyright notice of input files: + + Simple DirectMedia Layer + Copyright (C) 1997-2024 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +using System; +using System.Runtime.InteropServices; + +namespace SDL +{ + public partial struct SDL_AsyncIO + { + } + + public enum SDL_AsyncIOTaskType + { + SDL_ASYNCIO_TASK_READ, + SDL_ASYNCIO_TASK_WRITE, + SDL_ASYNCIO_TASK_CLOSE, + } + + public enum SDL_AsyncIOResult + { + SDL_ASYNCIO_COMPLETE, + SDL_ASYNCIO_FAILURE, + SDL_ASYNCIO_CANCELED, + } + + public unsafe partial struct SDL_AsyncIOOutcome + { + public SDL_AsyncIO* asyncio; + + public SDL_AsyncIOTaskType type; + + public SDL_AsyncIOResult result; + + [NativeTypeName("void*")] + public IntPtr buffer; + + [NativeTypeName("Uint64")] + public ulong offset; + + [NativeTypeName("Uint64")] + public ulong bytes_requested; + + [NativeTypeName("Uint64")] + public ulong bytes_transferred; + + [NativeTypeName("void*")] + public IntPtr userdata; + } + + public partial struct SDL_AsyncIOQueue + { + } + + public static unsafe partial class SDL3 + { + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_AsyncIO* SDL_AsyncIOFromFile([NativeTypeName("const char *")] byte* file, [NativeTypeName("const char *")] byte* mode); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("Sint64")] + public static extern long SDL_GetAsyncIOSize(SDL_AsyncIO* asyncio); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("bool")] + public static extern SDLBool SDL_ReadAsyncIO(SDL_AsyncIO* asyncio, [NativeTypeName("void*")] IntPtr ptr, [NativeTypeName("Uint64")] ulong offset, [NativeTypeName("Uint64")] ulong size, SDL_AsyncIOQueue* queue, [NativeTypeName("void*")] IntPtr userdata); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("bool")] + public static extern SDLBool SDL_WriteAsyncIO(SDL_AsyncIO* asyncio, [NativeTypeName("void*")] IntPtr ptr, [NativeTypeName("Uint64")] ulong offset, [NativeTypeName("Uint64")] ulong size, SDL_AsyncIOQueue* queue, [NativeTypeName("void*")] IntPtr userdata); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("bool")] + public static extern SDLBool SDL_CloseAsyncIO(SDL_AsyncIO* asyncio, [NativeTypeName("bool")] SDLBool flush, SDL_AsyncIOQueue* queue, [NativeTypeName("void*")] IntPtr userdata); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_AsyncIOQueue* SDL_CreateAsyncIOQueue(); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void SDL_DestroyAsyncIOQueue(SDL_AsyncIOQueue* queue); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("bool")] + public static extern SDLBool SDL_GetAsyncIOResult(SDL_AsyncIOQueue* queue, SDL_AsyncIOOutcome* outcome); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("bool")] + public static extern SDLBool SDL_WaitAsyncIOResult(SDL_AsyncIOQueue* queue, SDL_AsyncIOOutcome* outcome, [NativeTypeName("Sint32")] int timeoutMS); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void SDL_SignalAsyncIOQueue(SDL_AsyncIOQueue* queue); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("bool")] + public static extern SDLBool SDL_LoadFileAsync([NativeTypeName("const char *")] byte* file, SDL_AsyncIOQueue* queue, [NativeTypeName("void*")] IntPtr userdata); + } +} diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_audio.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_audio.g.cs index 95f1b92..8fa1701 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_audio.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_audio.g.cs @@ -97,15 +97,15 @@ namespace SDL [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("bool")] - public static extern SDLBool SDL_PauseAudioDevice(SDL_AudioDeviceID dev); + public static extern SDLBool SDL_PauseAudioDevice(SDL_AudioDeviceID devid); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("bool")] - public static extern SDLBool SDL_ResumeAudioDevice(SDL_AudioDeviceID dev); + public static extern SDLBool SDL_ResumeAudioDevice(SDL_AudioDeviceID devid); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("bool")] - public static extern SDLBool SDL_AudioDevicePaused(SDL_AudioDeviceID dev); + public static extern SDLBool SDL_AudioDevicePaused(SDL_AudioDeviceID devid); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern float SDL_GetAudioDeviceGain(SDL_AudioDeviceID devid); diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_camera.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_camera.g.cs index 062ecc6..49740d7 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_camera.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_camera.g.cs @@ -70,7 +70,7 @@ namespace SDL public static extern SDL_CameraID* SDL_GetCameras(int* count); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern SDL_CameraSpec** SDL_GetCameraSupportedFormats(SDL_CameraID devid, int* count); + public static extern SDL_CameraSpec** SDL_GetCameraSupportedFormats(SDL_CameraID instance_id, int* count); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_GetCameraName", ExactSpelling = true)] [return: NativeTypeName("const char *")] diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_pixels.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_pixels.g.cs index aae40df..d408245 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_pixels.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_pixels.g.cs @@ -155,6 +155,7 @@ namespace SDL SDL_PIXELFORMAT_NV21 = 0x3132564eU, SDL_PIXELFORMAT_P010 = 0x30313050U, SDL_PIXELFORMAT_EXTERNAL_OES = 0x2053454fU, + SDL_PIXELFORMAT_MJPG = 0x47504a4dU, } public enum SDL_ColorType diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_rect.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_rect.g.cs index f4db088..54836f9 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_rect.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_rect.g.cs @@ -124,7 +124,7 @@ namespace SDL } [return: NativeTypeName("bool")] - public static SDLBool SDL_RectsEqualEpsilon([NativeTypeName("const SDL_FRect *")] SDL_FRect* a, [NativeTypeName("const SDL_FRect *")] SDL_FRect* b, [NativeTypeName("const float")] float epsilon) + public static SDLBool SDL_RectsEqualEpsilon([NativeTypeName("const SDL_FRect *")] SDL_FRect* a, [NativeTypeName("const SDL_FRect *")] SDL_FRect* b, float epsilon) { return ((a) != null && (b) != null && ((a == b) || ((SDL_fabsf(a->x - b->x) <= epsilon) && (SDL_fabsf(a->y - b->y) <= epsilon) && (SDL_fabsf(a->w - b->w) <= epsilon) && (SDL_fabsf(a->h - b->h) <= epsilon)))) ? true : false; } diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_surface.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_surface.g.cs index f9dc6a8..ba78f25 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_surface.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_surface.g.cs @@ -240,6 +240,10 @@ namespace SDL [return: NativeTypeName("bool")] public static extern SDLBool SDL_BlitSurfaceUncheckedScaled(SDL_Surface* src, [NativeTypeName("const SDL_Rect *")] SDL_Rect* srcrect, SDL_Surface* dst, [NativeTypeName("const SDL_Rect *")] SDL_Rect* dstrect, SDL_ScaleMode scaleMode); + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("bool")] + public static extern SDLBool SDL_StretchSurface(SDL_Surface* src, [NativeTypeName("const SDL_Rect *")] SDL_Rect* srcrect, SDL_Surface* dst, [NativeTypeName("const SDL_Rect *")] SDL_Rect* dstrect, SDL_ScaleMode scaleMode); + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("bool")] public static extern SDLBool SDL_BlitSurfaceTiled(SDL_Surface* src, [NativeTypeName("const SDL_Rect *")] SDL_Rect* srcrect, SDL_Surface* dst, [NativeTypeName("const SDL_Rect *")] SDL_Rect* dstrect); @@ -296,5 +300,11 @@ namespace SDL [NativeTypeName("#define SDL_PROP_SURFACE_TONEMAP_OPERATOR_STRING \"SDL.surface.tonemap\"")] public static ReadOnlySpan SDL_PROP_SURFACE_TONEMAP_OPERATOR_STRING => "SDL.surface.tonemap"u8; + + [NativeTypeName("#define SDL_PROP_SURFACE_HOTSPOT_X_NUMBER \"SDL.surface.hotspot.x\"")] + public static ReadOnlySpan SDL_PROP_SURFACE_HOTSPOT_X_NUMBER => "SDL.surface.hotspot.x"u8; + + [NativeTypeName("#define SDL_PROP_SURFACE_HOTSPOT_Y_NUMBER \"SDL.surface.hotspot.y\"")] + public static ReadOnlySpan SDL_PROP_SURFACE_HOTSPOT_Y_NUMBER => "SDL.surface.hotspot.y"u8; } } diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_tray.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_tray.g.cs index 36f69cd..d6017d5 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_tray.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_tray.g.cs @@ -65,7 +65,7 @@ namespace SDL [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("const SDL_TrayEntry **")] - public static extern SDL_TrayEntry** SDL_GetTrayEntries(SDL_TrayMenu* menu, int* size); + public static extern SDL_TrayEntry** SDL_GetTrayEntries(SDL_TrayMenu* menu, int* count); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern void SDL_RemoveTrayEntry(SDL_TrayEntry* entry); diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_version.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_version.g.cs index efa5f88..5a92dba 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_version.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_version.g.cs @@ -42,7 +42,7 @@ namespace SDL [NativeTypeName("#define SDL_MINOR_VERSION 2")] public const int SDL_MINOR_VERSION = 2; - [NativeTypeName("#define SDL_MICRO_VERSION 1")] - public const int SDL_MICRO_VERSION = 1; + [NativeTypeName("#define SDL_MICRO_VERSION 5")] + public const int SDL_MICRO_VERSION = 5; } } diff --git a/SDL3-CS/generate_bindings.py b/SDL3-CS/generate_bindings.py index 086440f..d99018c 100644 --- a/SDL3-CS/generate_bindings.py +++ b/SDL3-CS/generate_bindings.py @@ -111,6 +111,7 @@ def add(s: str): headers = [ add("SDL3/SDL_atomic.h"), + add("SDL3/SDL_asyncio.h"), add("SDL3/SDL_audio.h"), add("SDL3/SDL_blendmode.h"), add("SDL3/SDL_camera.h"),