From f1b7b2caf6d879ad5cf84bb2e63a4c5d56043b23 Mon Sep 17 00:00:00 2001 From: Susko3 Date: Mon, 15 Apr 2024 18:27:54 +0200 Subject: [PATCH 1/4] Update bindings to SDL commit 0429f5d6a36fc35b551bcc2acd4a40c2db6dab82 --- SDL3-CS/SDL3/ClangSharp/SDL_gamepad.g.cs | 10 ++++----- SDL3-CS/SDL3/ClangSharp/SDL_joystick.g.cs | 6 ------ SDL3-CS/SDL3/ClangSharp/SDL_quit.g.cs | 0 SDL3-CS/SDL3/ClangSharp/SDL_rect.g.cs | 4 ++-- SDL3-CS/SDL3/ClangSharp/SDL_system.WinRT.g.cs | 10 ++------- SDL3-CS/SDL3/ClangSharp/SDL_system.iOS.g.cs | 4 ++-- SDL3-CS/SDL3/ClangSharp/SDL_time.g.cs | 4 ++-- SDL3-CS/SDL3/SDL_quit.cs | 15 ------------- SDL3-CS/SDL3/SDL_system.iOS.cs | 21 ------------------- SDL3-CS/generate_bindings.py | 1 - 10 files changed, 13 insertions(+), 62 deletions(-) delete mode 100644 SDL3-CS/SDL3/ClangSharp/SDL_quit.g.cs delete mode 100644 SDL3-CS/SDL3/SDL_quit.cs delete mode 100644 SDL3-CS/SDL3/SDL_system.iOS.cs diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_gamepad.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_gamepad.g.cs index bbc7bf8..23f256a 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_gamepad.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_gamepad.g.cs @@ -117,12 +117,12 @@ namespace SDL { public SDL_GamepadBindingType input_type; - [NativeTypeName("__AnonymousRecord_SDL_gamepad_L184_C5")] + [NativeTypeName("__AnonymousRecord_SDL_gamepad_L196_C5")] public _input_e__Union input; public SDL_GamepadBindingType output_type; - [NativeTypeName("__AnonymousRecord_SDL_gamepad_L204_C5")] + [NativeTypeName("__AnonymousRecord_SDL_gamepad_L216_C5")] public _output_e__Union output; [StructLayout(LayoutKind.Explicit)] @@ -132,11 +132,11 @@ namespace SDL public int button; [FieldOffset(0)] - [NativeTypeName("__AnonymousRecord_SDL_gamepad_L188_C9")] + [NativeTypeName("__AnonymousRecord_SDL_gamepad_L200_C9")] public _axis_e__Struct axis; [FieldOffset(0)] - [NativeTypeName("__AnonymousRecord_SDL_gamepad_L195_C9")] + [NativeTypeName("__AnonymousRecord_SDL_gamepad_L207_C9")] public _hat_e__Struct hat; public partial struct _axis_e__Struct @@ -163,7 +163,7 @@ namespace SDL public SDL_GamepadButton button; [FieldOffset(0)] - [NativeTypeName("__AnonymousRecord_SDL_gamepad_L208_C9")] + [NativeTypeName("__AnonymousRecord_SDL_gamepad_L220_C9")] public _axis_e__Struct axis; public partial struct _axis_e__Struct diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_joystick.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_joystick.g.cs index 3dc1a27..a543936 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_joystick.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_joystick.g.cs @@ -56,9 +56,6 @@ namespace SDL public unsafe partial struct SDL_VirtualJoystickDesc { - [NativeTypeName("Uint16")] - public ushort version; - [NativeTypeName("Uint16")] public ushort type; @@ -314,9 +311,6 @@ namespace SDL [NativeTypeName("#define SDL_IPHONE_MAX_GFORCE 5.0")] public const double SDL_IPHONE_MAX_GFORCE = 5.0; - [NativeTypeName("#define SDL_VIRTUAL_JOYSTICK_DESC_VERSION 1")] - public const int SDL_VIRTUAL_JOYSTICK_DESC_VERSION = 1; - [NativeTypeName("#define SDL_PROP_JOYSTICK_CAP_MONO_LED_BOOLEAN \"SDL.joystick.cap.mono_led\"")] public static ReadOnlySpan SDL_PROP_JOYSTICK_CAP_MONO_LED_BOOLEAN => "SDL.joystick.cap.mono_led"u8; diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_quit.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_quit.g.cs deleted file mode 100644 index e69de29..0000000 diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_rect.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_rect.g.cs index 4fb3d30..e8dbee0 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_rect.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_rect.g.cs @@ -67,7 +67,7 @@ namespace SDL { public static SDL_bool SDL_PointInRect([NativeTypeName("const SDL_Point *")] SDL_Point* p, [NativeTypeName("const SDL_Rect *")] SDL_Rect* r) { - return ((p->x >= r->x) && (p->x < (r->x + r->w)) && (p->y >= r->y) && (p->y < (r->y + r->h))) ? (SDL_bool)(1) : (SDL_bool)(0); + return ((p) != null && (r) != null && (p->x >= r->x) && (p->x < (r->x + r->w)) && (p->y >= r->y) && (p->y < (r->y + r->h))) ? (SDL_bool)(1) : (SDL_bool)(0); } public static SDL_bool SDL_RectEmpty([NativeTypeName("const SDL_Rect *")] SDL_Rect* r) @@ -97,7 +97,7 @@ namespace SDL public static SDL_bool SDL_PointInRectFloat([NativeTypeName("const SDL_FPoint *")] SDL_FPoint* p, [NativeTypeName("const SDL_FRect *")] SDL_FRect* r) { - return ((p->x >= r->x) && (p->x < (r->x + r->w)) && (p->y >= r->y) && (p->y < (r->y + r->h))) ? (SDL_bool)(1) : (SDL_bool)(0); + return ((p) != null && (r) != null && (p->x >= r->x) && (p->x < (r->x + r->w)) && (p->y >= r->y) && (p->y < (r->y + r->h))) ? (SDL_bool)(1) : (SDL_bool)(0); } public static SDL_bool SDL_RectEmptyFloat([NativeTypeName("const SDL_FRect *")] SDL_FRect* r) diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_system.WinRT.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_system.WinRT.g.cs index 3ceaa67..b275523 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_system.WinRT.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_system.WinRT.g.cs @@ -23,7 +23,6 @@ 3. This notice may not be removed or altered from any source distribution. */ -using System; using System.Runtime.InteropServices; using System.Runtime.Versioning; @@ -47,15 +46,10 @@ namespace SDL public static unsafe partial class SDL3 { - [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("const wchar_t *")] - [SupportedOSPlatform("Windows")] - public static extern IntPtr SDL_WinRTGetFSPathUNICODE(SDL_WinRT_Path pathType); - - [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_WinRTGetFSPathUTF8", ExactSpelling = true)] + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_WinRTGetFSPath", ExactSpelling = true)] [return: NativeTypeName("const char *")] [SupportedOSPlatform("Windows")] - public static extern byte* Unsafe_SDL_WinRTGetFSPathUTF8(SDL_WinRT_Path pathType); + public static extern byte* Unsafe_SDL_WinRTGetFSPath(SDL_WinRT_Path pathType); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [SupportedOSPlatform("Windows")] diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_system.iOS.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_system.iOS.g.cs index 441566c..c39bdac 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_system.iOS.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_system.iOS.g.cs @@ -33,11 +33,11 @@ namespace SDL { [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [SupportedOSPlatform("iOS")] - public static extern int SDL_iPhoneSetAnimationCallback(SDL_Window* window, int interval, [NativeTypeName("void (*)(void *)")] delegate* unmanaged[Cdecl] callback, [NativeTypeName("void*")] IntPtr callbackParam); + public static extern int SDL_iOSSetAnimationCallback(SDL_Window* window, int interval, [NativeTypeName("void (*)(void *)")] delegate* unmanaged[Cdecl] callback, [NativeTypeName("void*")] IntPtr callbackParam); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [SupportedOSPlatform("iOS")] - public static extern void SDL_iPhoneSetEventPump(SDL_bool enabled); + public static extern void SDL_iOSSetEventPump(SDL_bool enabled); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [SupportedOSPlatform("iOS")] diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_time.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_time.g.cs index 187c058..aaddc6e 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_time.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_time.g.cs @@ -49,14 +49,14 @@ namespace SDL public int utc_offset; } - public enum SDL_DATE_FORMAT + public enum SDL_DateFormat { SDL_DATE_FORMAT_YYYYMMDD = 0, SDL_DATE_FORMAT_DDMMYYYY = 1, SDL_DATE_FORMAT_MMDDYYYY = 2, } - public enum SDL_TIME_FORMAT + public enum SDL_TimeFormat { SDL_TIME_FORMAT_24HR = 0, SDL_TIME_FORMAT_12HR = 1, diff --git a/SDL3-CS/SDL3/SDL_quit.cs b/SDL3-CS/SDL3/SDL_quit.cs deleted file mode 100644 index 4f3d7d4..0000000 --- a/SDL3-CS/SDL3/SDL_quit.cs +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. -// See the LICENCE file in the repository root for full licence text. - -namespace SDL -{ - public partial class SDL3 - { - [Macro] - public static unsafe bool SDL_QuitRequested() - { - SDL_PumpEvents(); - return SDL_PeepEvents(null, 0, SDL_eventaction.SDL_PEEKEVENT, SDL_EventType.SDL_EVENT_QUIT, SDL_EventType.SDL_EVENT_QUIT) > 0; - } - } -} diff --git a/SDL3-CS/SDL3/SDL_system.iOS.cs b/SDL3-CS/SDL3/SDL_system.iOS.cs deleted file mode 100644 index c40537b..0000000 --- a/SDL3-CS/SDL3/SDL_system.iOS.cs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. -// See the LICENCE file in the repository root for full licence text. - -using System; -using System.Runtime.Versioning; - -namespace SDL -{ - public static partial class SDL3 - { - [SupportedOSPlatform("iOS")] - [Macro] - public static unsafe int SDL_iOSSetAnimationCallback(SDL_Window* window, int interval, delegate* unmanaged[Cdecl] callback, IntPtr callbackParam) - => SDL_iPhoneSetAnimationCallback(window, interval, callback, callbackParam); - - [SupportedOSPlatform("iOS")] - [Macro] - public static void SDL_iOSSetEventPump(SDL_bool enabled) - => SDL_iPhoneSetEventPump(enabled); - } -} diff --git a/SDL3-CS/generate_bindings.py b/SDL3-CS/generate_bindings.py index b5a9835..b405427 100644 --- a/SDL3-CS/generate_bindings.py +++ b/SDL3-CS/generate_bindings.py @@ -112,7 +112,6 @@ headers = [ add("SDL3/SDL_platform.h"), add("SDL3/SDL_power.h"), add("SDL3/SDL_properties.h"), - add("SDL3/SDL_quit.h"), add("SDL3/SDL_rect.h"), add("SDL3/SDL_render.h"), add("SDL3/SDL_revision.h"), From 3d9a45b53cb11589e1a14eff7423968543646e18 Mon Sep 17 00:00:00 2001 From: Susko3 Date: Mon, 15 Apr 2024 18:48:55 +0200 Subject: [PATCH 2/4] Regenerate patch to resolve conflicts and include `base-commit` Path formatted with ```sh git format-patch --base HEAD^ HEAD^ ``` --- SDL3-CS/SDL-use-proper-types.patch | 120 ++++++++++++++++------------- SDL3-CS/generate_bindings.py | 2 +- 2 files changed, 66 insertions(+), 56 deletions(-) diff --git a/SDL3-CS/SDL-use-proper-types.patch b/SDL3-CS/SDL-use-proper-types.patch index 631fdba..74aeaf0 100644 --- a/SDL3-CS/SDL-use-proper-types.patch +++ b/SDL3-CS/SDL-use-proper-types.patch @@ -1,8 +1,8 @@ diff --git a/include/SDL3/SDL.h b/include/SDL3/SDL.h -index b178d2ade..5c54b9ab5 100644 +index 6cda579f7..bc2952a4e 100644 --- a/include/SDL3/SDL.h +++ b/include/SDL3/SDL.h -@@ -29,6 +29,8 @@ +@@ -28,6 +28,8 @@ #ifndef SDL_h_ #define SDL_h_ @@ -12,10 +12,10 @@ index b178d2ade..5c54b9ab5 100644 #include #include diff --git a/include/SDL3/SDL_events.h b/include/SDL3/SDL_events.h -index 0fddf1f24..36b98b569 100644 +index 9e26dd64e..1950b1037 100644 --- a/include/SDL3/SDL_events.h +++ b/include/SDL3/SDL_events.h -@@ -244,7 +244,7 @@ typedef enum +@@ -247,7 +247,7 @@ typedef enum SDL_EventType */ typedef struct SDL_CommonEvent { @@ -24,7 +24,7 @@ index 0fddf1f24..36b98b569 100644 Uint32 reserved; Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */ } SDL_CommonEvent; -@@ -726,7 +726,7 @@ typedef struct SDL_QuitEvent +@@ -804,7 +804,7 @@ typedef struct SDL_QuitEvent */ typedef struct SDL_UserEvent { @@ -33,7 +33,7 @@ index 0fddf1f24..36b98b569 100644 Uint32 reserved; Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */ SDL_WindowID windowID; /**< The associated window if any */ -@@ -741,7 +741,7 @@ typedef struct SDL_UserEvent +@@ -821,7 +821,7 @@ typedef struct SDL_UserEvent */ typedef union SDL_Event { @@ -42,16 +42,16 @@ index 0fddf1f24..36b98b569 100644 SDL_CommonEvent common; /**< Common event data */ SDL_DisplayEvent display; /**< Display event data */ SDL_WindowEvent window; /**< Window event data */ -@@ -868,7 +868,7 @@ typedef enum +@@ -948,7 +948,7 @@ typedef enum SDL_eventaction * \sa SDL_PumpEvents * \sa SDL_PushEvent */ --extern DECLSPEC int SDLCALL SDL_PeepEvents(SDL_Event *events, int numevents, SDL_eventaction action, Uint32 minType, Uint32 maxType); -+extern DECLSPEC int SDLCALL SDL_PeepEvents(SDL_Event *events, int numevents, SDL_eventaction action, SDL_EventType minType, SDL_EventType maxType); +-extern DECLSPEC int SDLCALL SDL_PeepEvents(SDL_Event *events, int numevents, SDL_EventAction action, Uint32 minType, Uint32 maxType); ++extern DECLSPEC int SDLCALL SDL_PeepEvents(SDL_Event *events, int numevents, SDL_EventAction action, SDL_EventType minType, SDL_EventType maxType); /* @} */ /** -@@ -885,7 +885,7 @@ extern DECLSPEC int SDLCALL SDL_PeepEvents(SDL_Event *events, int numevents, SDL +@@ -965,7 +965,7 @@ extern DECLSPEC int SDLCALL SDL_PeepEvents(SDL_Event *events, int numevents, SDL * * \sa SDL_HasEvents */ @@ -60,7 +60,7 @@ index 0fddf1f24..36b98b569 100644 /** -@@ -904,7 +904,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_HasEvent(Uint32 type); +@@ -984,7 +984,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_HasEvent(Uint32 type); * * \sa SDL_HasEvents */ @@ -69,7 +69,7 @@ index 0fddf1f24..36b98b569 100644 /** * Clear events of a specific type from the event queue. -@@ -930,7 +930,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_HasEvents(Uint32 minType, Uint32 maxType); +@@ -1010,7 +1010,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_HasEvents(Uint32 minType, Uint32 maxType); * * \sa SDL_FlushEvents */ @@ -78,7 +78,7 @@ index 0fddf1f24..36b98b569 100644 /** * Clear events of a range of types from the event queue. -@@ -955,7 +955,7 @@ extern DECLSPEC void SDLCALL SDL_FlushEvent(Uint32 type); +@@ -1035,7 +1035,7 @@ extern DECLSPEC void SDLCALL SDL_FlushEvent(Uint32 type); * * \sa SDL_FlushEvent */ @@ -87,16 +87,16 @@ index 0fddf1f24..36b98b569 100644 /** * Poll for currently pending events. -@@ -1234,7 +1234,7 @@ extern DECLSPEC void SDLCALL SDL_FilterEvents(SDL_EventFilter filter, void *user +@@ -1324,7 +1324,7 @@ extern DECLSPEC void SDLCALL SDL_FilterEvents(SDL_EventFilter filter, void *user * - * \sa SDL_IsEventEnabled + * \sa SDL_EventEnabled */ -extern DECLSPEC void SDLCALL SDL_SetEventEnabled(Uint32 type, SDL_bool enabled); +extern DECLSPEC void SDLCALL SDL_SetEventEnabled(SDL_EventType type, SDL_bool enabled); /** * Query the state of processing events by type. -@@ -1246,7 +1246,7 @@ extern DECLSPEC void SDLCALL SDL_SetEventEnabled(Uint32 type, SDL_bool enabled); +@@ -1336,7 +1336,7 @@ extern DECLSPEC void SDLCALL SDL_SetEventEnabled(Uint32 type, SDL_bool enabled); * * \sa SDL_SetEventEnabled */ @@ -106,10 +106,10 @@ index 0fddf1f24..36b98b569 100644 /** * Allocate a set of user-defined events, and return the beginning event diff --git a/include/SDL3/SDL_init.h b/include/SDL3/SDL_init.h -index d1b925270..30cc4a8b7 100644 +index 00593334d..712fe0c6f 100644 --- a/include/SDL3/SDL_init.h +++ b/include/SDL3/SDL_init.h -@@ -110,7 +110,7 @@ typedef enum +@@ -112,7 +112,7 @@ typedef enum SDL_InitFlags * \sa SDL_SetMainReady * \sa SDL_WasInit */ @@ -118,7 +118,7 @@ index d1b925270..30cc4a8b7 100644 /** * Compatibility function to initialize the SDL library. -@@ -127,7 +127,7 @@ extern DECLSPEC int SDLCALL SDL_Init(Uint32 flags); +@@ -129,7 +129,7 @@ extern DECLSPEC int SDLCALL SDL_Init(Uint32 flags); * \sa SDL_Quit * \sa SDL_QuitSubSystem */ @@ -127,7 +127,7 @@ index d1b925270..30cc4a8b7 100644 /** * Shut down specific SDL subsystems. -@@ -142,7 +142,7 @@ extern DECLSPEC int SDLCALL SDL_InitSubSystem(Uint32 flags); +@@ -144,7 +144,7 @@ extern DECLSPEC int SDLCALL SDL_InitSubSystem(Uint32 flags); * \sa SDL_InitSubSystem * \sa SDL_Quit */ @@ -136,7 +136,7 @@ index d1b925270..30cc4a8b7 100644 /** * Get a mask of the specified subsystems which are currently initialized. -@@ -156,7 +156,7 @@ extern DECLSPEC void SDLCALL SDL_QuitSubSystem(Uint32 flags); +@@ -158,7 +158,7 @@ extern DECLSPEC void SDLCALL SDL_QuitSubSystem(Uint32 flags); * \sa SDL_Init * \sa SDL_InitSubSystem */ @@ -146,10 +146,10 @@ index d1b925270..30cc4a8b7 100644 /** * Clean up all initialized subsystems. diff --git a/include/SDL3/SDL_log.h b/include/SDL3/SDL_log.h -index 99d2f2c36..eef01cac7 100644 +index 3ded311ff..5b39a1c96 100644 --- a/include/SDL3/SDL_log.h +++ b/include/SDL3/SDL_log.h -@@ -135,7 +135,7 @@ extern DECLSPEC void SDLCALL SDL_LogSetAllPriority(SDL_LogPriority priority); +@@ -140,7 +140,7 @@ extern DECLSPEC void SDLCALL SDL_LogSetAllPriority(SDL_LogPriority priority); * \sa SDL_LogResetPriorities * \sa SDL_LogSetAllPriority */ @@ -158,7 +158,7 @@ index 99d2f2c36..eef01cac7 100644 SDL_LogPriority priority); /** -@@ -148,7 +148,7 @@ extern DECLSPEC void SDLCALL SDL_LogSetPriority(int category, +@@ -153,7 +153,7 @@ extern DECLSPEC void SDLCALL SDL_LogSetPriority(int category, * * \sa SDL_LogSetPriority */ @@ -167,7 +167,7 @@ index 99d2f2c36..eef01cac7 100644 /** * Reset all priorities to default. -@@ -201,7 +201,7 @@ extern DECLSPEC void SDLCALL SDL_Log(SDL_PRINTF_FORMAT_STRING const char *fmt, . +@@ -206,7 +206,7 @@ extern DECLSPEC void SDLCALL SDL_Log(SDL_PRINTF_FORMAT_STRING const char *fmt, . * \sa SDL_LogMessageV * \sa SDL_LogWarn */ @@ -176,7 +176,7 @@ index 99d2f2c36..eef01cac7 100644 /** * Log a message with SDL_LOG_PRIORITY_DEBUG. -@@ -222,7 +222,7 @@ extern DECLSPEC void SDLCALL SDL_LogVerbose(int category, SDL_PRINTF_FORMAT_STRI +@@ -227,7 +227,7 @@ extern DECLSPEC void SDLCALL SDL_LogVerbose(int category, SDL_PRINTF_FORMAT_STRI * \sa SDL_LogVerbose * \sa SDL_LogWarn */ @@ -185,7 +185,7 @@ index 99d2f2c36..eef01cac7 100644 /** * Log a message with SDL_LOG_PRIORITY_INFO. -@@ -243,7 +243,7 @@ extern DECLSPEC void SDLCALL SDL_LogDebug(int category, SDL_PRINTF_FORMAT_STRING +@@ -248,7 +248,7 @@ extern DECLSPEC void SDLCALL SDL_LogDebug(int category, SDL_PRINTF_FORMAT_STRING * \sa SDL_LogVerbose * \sa SDL_LogWarn */ @@ -194,7 +194,7 @@ index 99d2f2c36..eef01cac7 100644 /** * Log a message with SDL_LOG_PRIORITY_WARN. -@@ -264,7 +264,7 @@ extern DECLSPEC void SDLCALL SDL_LogInfo(int category, SDL_PRINTF_FORMAT_STRING +@@ -269,7 +269,7 @@ extern DECLSPEC void SDLCALL SDL_LogInfo(int category, SDL_PRINTF_FORMAT_STRING * \sa SDL_LogMessageV * \sa SDL_LogVerbose */ @@ -203,7 +203,7 @@ index 99d2f2c36..eef01cac7 100644 /** * Log a message with SDL_LOG_PRIORITY_ERROR. -@@ -285,7 +285,7 @@ extern DECLSPEC void SDLCALL SDL_LogWarn(int category, SDL_PRINTF_FORMAT_STRING +@@ -290,7 +290,7 @@ extern DECLSPEC void SDLCALL SDL_LogWarn(int category, SDL_PRINTF_FORMAT_STRING * \sa SDL_LogVerbose * \sa SDL_LogWarn */ @@ -212,7 +212,7 @@ index 99d2f2c36..eef01cac7 100644 /** * Log a message with SDL_LOG_PRIORITY_CRITICAL. -@@ -306,7 +306,7 @@ extern DECLSPEC void SDLCALL SDL_LogError(int category, SDL_PRINTF_FORMAT_STRING +@@ -311,7 +311,7 @@ extern DECLSPEC void SDLCALL SDL_LogError(int category, SDL_PRINTF_FORMAT_STRING * \sa SDL_LogVerbose * \sa SDL_LogWarn */ @@ -221,7 +221,7 @@ index 99d2f2c36..eef01cac7 100644 /** * Log a message with the specified category and priority. -@@ -328,7 +328,7 @@ extern DECLSPEC void SDLCALL SDL_LogCritical(int category, SDL_PRINTF_FORMAT_STR +@@ -333,7 +333,7 @@ extern DECLSPEC void SDLCALL SDL_LogCritical(int category, SDL_PRINTF_FORMAT_STR * \sa SDL_LogVerbose * \sa SDL_LogWarn */ @@ -230,7 +230,7 @@ index 99d2f2c36..eef01cac7 100644 SDL_LogPriority priority, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(3); -@@ -351,7 +351,7 @@ extern DECLSPEC void SDLCALL SDL_LogMessage(int category, +@@ -356,7 +356,7 @@ extern DECLSPEC void SDLCALL SDL_LogMessage(int category, * \sa SDL_LogVerbose * \sa SDL_LogWarn */ @@ -239,9 +239,9 @@ index 99d2f2c36..eef01cac7 100644 SDL_LogPriority priority, SDL_PRINTF_FORMAT_STRING const char *fmt, va_list ap) SDL_PRINTF_VARARG_FUNCV(3); -@@ -365,7 +365,7 @@ extern DECLSPEC void SDLCALL SDL_LogMessageV(int category, - * \param priority the priority of the message - * \param message the message being output +@@ -372,7 +372,7 @@ extern DECLSPEC void SDLCALL SDL_LogMessageV(int category, + * + * \since This datatype is available since SDL 3.0.0. */ -typedef void (SDLCALL *SDL_LogOutputFunction)(void *userdata, int category, SDL_LogPriority priority, const char *message); +typedef void (SDLCALL *SDL_LogOutputFunction)(void *userdata, SDL_LogCategory category, SDL_LogPriority priority, const char *message); @@ -249,28 +249,28 @@ index 99d2f2c36..eef01cac7 100644 /** * Get the current log output function. diff --git a/include/SDL3/SDL_messagebox.h b/include/SDL3/SDL_messagebox.h -index 3d6855275..2b540a3fa 100644 +index 48f63239b..d851c0df9 100644 --- a/include/SDL3/SDL_messagebox.h +++ b/include/SDL3/SDL_messagebox.h -@@ -58,7 +58,7 @@ typedef enum +@@ -66,7 +66,7 @@ typedef enum SDL_MessageBoxButtonFlags */ - typedef struct + typedef struct SDL_MessageBoxButtonData { - Uint32 flags; /**< ::SDL_MessageBoxButtonFlags */ + SDL_MessageBoxButtonFlags flags; /**< ::SDL_MessageBoxButtonFlags */ int buttonID; /**< User defined button id (value returned via SDL_ShowMessageBox) */ const char *text; /**< The UTF-8 button text */ } SDL_MessageBoxButtonData; -@@ -94,7 +94,7 @@ typedef struct +@@ -112,7 +112,7 @@ typedef struct SDL_MessageBoxColorScheme */ - typedef struct + typedef struct SDL_MessageBoxData { - Uint32 flags; /**< ::SDL_MessageBoxFlags */ + SDL_MessageBoxFlags flags; /**< ::SDL_MessageBoxFlags */ SDL_Window *window; /**< Parent window, can be NULL */ const char *title; /**< UTF-8 title */ const char *message; /**< UTF-8 message text */ -@@ -180,7 +180,7 @@ extern DECLSPEC int SDLCALL SDL_ShowMessageBox(const SDL_MessageBoxData *message +@@ -198,7 +198,7 @@ extern DECLSPEC int SDLCALL SDL_ShowMessageBox(const SDL_MessageBoxData *message * * \sa SDL_ShowMessageBox */ @@ -280,10 +280,10 @@ index 3d6855275..2b540a3fa 100644 /* Ends C function definitions when using C++ */ diff --git a/include/SDL3/SDL_render.h b/include/SDL3/SDL_render.h -index 5024931e7..f1f61be21 100644 +index f875433ce..74c631f7f 100644 --- a/include/SDL3/SDL_render.h +++ b/include/SDL3/SDL_render.h -@@ -80,7 +80,7 @@ typedef enum +@@ -86,7 +86,7 @@ typedef enum SDL_RendererFlags typedef struct SDL_RendererInfo { const char *name; /**< The name of the renderer */ @@ -292,7 +292,7 @@ index 5024931e7..f1f61be21 100644 int num_texture_formats; /**< The number of available texture formats */ SDL_PixelFormatEnum texture_formats[16]; /**< The available texture formats */ int max_texture_width; /**< The maximum texture width */ -@@ -225,7 +225,7 @@ extern DECLSPEC int SDLCALL SDL_CreateWindowAndRenderer(int width, int height, S +@@ -241,7 +241,7 @@ extern DECLSPEC int SDLCALL SDL_CreateWindowAndRenderer(int width, int height, S * \sa SDL_GetRenderDriver * \sa SDL_GetRendererInfo */ @@ -302,23 +302,30 @@ index 5024931e7..f1f61be21 100644 /** * Create a 2D rendering context for a window, with the specified properties. diff --git a/include/SDL3/SDL_stdinc.h b/include/SDL3/SDL_stdinc.h -index e6a387c31..8aafb96c8 100644 +index 00a54a139..24ae06c13 100644 --- a/include/SDL3/SDL_stdinc.h +++ b/include/SDL3/SDL_stdinc.h -@@ -132,8 +132,8 @@ char *alloca(); - /** - * A boolean type. +@@ -146,7 +146,7 @@ void *alloca(size_t); + * + * \sa SDL_bool */ -#define SDL_FALSE 0 --#define SDL_TRUE 1 +#define SDL_FALSE (SDL_bool)0 -+#define SDL_TRUE (SDL_bool)1 - typedef int SDL_bool; /** -@@ -192,8 +192,8 @@ typedef uint64_t Uint64; - * They can be converted between POSIX time_t values with SDL_NS_TO_SECONDS() and SDL_SECONDS_TO_NS(), - * and between Windows FILETIME values with SDL_TimeToWindows() and SDL_TimeFromWindows(). + * A boolean true. +@@ -155,7 +155,7 @@ void *alloca(size_t); + * + * \sa SDL_bool + */ +-#define SDL_TRUE 1 ++#define SDL_TRUE (SDL_bool)1 + + /** + * A boolean type: true or false. +@@ -249,8 +249,8 @@ typedef uint64_t Uint64; + * + * \since This macro is available since SDL 3.0.0. */ -#define SDL_MAX_TIME SDL_MAX_SINT64 -#define SDL_MIN_TIME SDL_MIN_SINT64 @@ -327,4 +334,7 @@ index e6a387c31..8aafb96c8 100644 typedef Sint64 SDL_Time; /* @} *//* Basic data types */ - \ No newline at end of file + +base-commit: 0429f5d6a36fc35b551bcc2acd4a40c2db6dab82 +-- +2.40.0.windows.1 diff --git a/SDL3-CS/generate_bindings.py b/SDL3-CS/generate_bindings.py index b405427..4186ddb 100644 --- a/SDL3-CS/generate_bindings.py +++ b/SDL3-CS/generate_bindings.py @@ -7,7 +7,7 @@ Generates C# bindings for SDL3 using ClangSharp. Prerequisites: - run `dotnet tool restore` (to install ClangSharpPInvokeGenerator) - https://github.com/libsdl-org/SDL checked out alongside this repository -- git apply `SDL-use-proper-types.patch` to SDL repo +- git apply --3way `SDL-use-proper-types.patch` to SDL repo This script should be run manually. """ From b6a70cf1628f2f314b4c2f04276f3701da974b6c Mon Sep 17 00:00:00 2001 From: Susko3 Date: Mon, 15 Apr 2024 19:40:55 +0200 Subject: [PATCH 3/4] Migrate custom patch to friendly overloads Some changes are still required. --- SDL3-CS.Tests/MyWindow.cs | 10 +- SDL3-CS/SDL-use-proper-types.patch | 292 +------------------- SDL3-CS/SDL3/ClangSharp/SDL_events.g.cs | 23 +- SDL3-CS/SDL3/ClangSharp/SDL_init.g.cs | 9 +- SDL3-CS/SDL3/ClangSharp/SDL_log.g.cs | 20 +- SDL3-CS/SDL3/ClangSharp/SDL_messagebox.g.cs | 8 +- SDL3-CS/SDL3/ClangSharp/SDL_render.g.cs | 5 +- SDL3-CS/SDL3/ClangSharp/SDL_stdinc.g.cs | 8 +- SDL3-CS/SDL3/SDL_events.cs | 30 ++ SDL3-CS/SDL3/SDL_init.cs | 16 ++ SDL3-CS/SDL3/SDL_log.cs | 13 + SDL3-CS/SDL3/SDL_messagebox.cs | 24 ++ SDL3-CS/SDL3/SDL_render.cs | 18 ++ 13 files changed, 147 insertions(+), 329 deletions(-) create mode 100644 SDL3-CS/SDL3/SDL_init.cs create mode 100644 SDL3-CS/SDL3/SDL_log.cs create mode 100644 SDL3-CS/SDL3/SDL_messagebox.cs create mode 100644 SDL3-CS/SDL3/SDL_render.cs diff --git a/SDL3-CS.Tests/MyWindow.cs b/SDL3-CS.Tests/MyWindow.cs index b647deb..351cb24 100644 --- a/SDL3-CS.Tests/MyWindow.cs +++ b/SDL3-CS.Tests/MyWindow.cs @@ -65,7 +65,7 @@ namespace SDL3.Tests private int handleEventFromFilter(SDL_Event* e) { - switch (e->type) + switch (e->Type) { case SDL_EventType.SDL_EVENT_KEY_UP: case SDL_EventType.SDL_EVENT_KEY_DOWN: @@ -91,12 +91,12 @@ namespace SDL3.Tests public void Create() { sdlWindowHandle = SDL_CreateWindow("hello"u8, 800, 600, SDL_WindowFlags.SDL_WINDOW_RESIZABLE | SDL_WindowFlags.SDL_WINDOW_HIGH_PIXEL_DENSITY); - renderer = SDL_CreateRenderer(sdlWindowHandle, (byte*)null, SDL_RendererFlags.SDL_RENDERER_PRESENTVSYNC); + renderer = SDL_CreateRenderer(sdlWindowHandle, null, SDL_RendererFlags.SDL_RENDERER_PRESENTVSYNC); } private void handleEvent(SDL_Event e) { - switch (e.type) + switch (e.Type) { case SDL_EventType.SDL_EVENT_QUIT: run = false; @@ -196,9 +196,7 @@ namespace SDL3.Tests do { - fixed (SDL_Event* buf = events) - eventsRead = SDL_PeepEvents(buf, events_per_peep, SDL_eventaction.SDL_GETEVENT, SDL_EventType.SDL_EVENT_FIRST, SDL_EventType.SDL_EVENT_LAST); - + eventsRead = SDL_PeepEvents(events, SDL_eventaction.SDL_GETEVENT, SDL_EventType.SDL_EVENT_FIRST, SDL_EventType.SDL_EVENT_LAST); for (int i = 0; i < eventsRead; i++) handleEvent(events[i]); } while (eventsRead == events_per_peep); diff --git a/SDL3-CS/SDL-use-proper-types.patch b/SDL3-CS/SDL-use-proper-types.patch index 74aeaf0..d13fa39 100644 --- a/SDL3-CS/SDL-use-proper-types.patch +++ b/SDL3-CS/SDL-use-proper-types.patch @@ -11,234 +11,10 @@ index 6cda579f7..bc2952a4e 100644 #include #include #include -diff --git a/include/SDL3/SDL_events.h b/include/SDL3/SDL_events.h -index 9e26dd64e..1950b1037 100644 ---- a/include/SDL3/SDL_events.h -+++ b/include/SDL3/SDL_events.h -@@ -247,7 +247,7 @@ typedef enum SDL_EventType - */ - typedef struct SDL_CommonEvent - { -- Uint32 type; /**< Event type, shared with all events, Uint32 to cover user events which are not in the SDL_EventType enumeration */ -+ SDL_EventType type; /**< Event type, shared with all events, Uint32 to cover user events which are not in the SDL_EventType enumeration */ - Uint32 reserved; - Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */ - } SDL_CommonEvent; -@@ -804,7 +804,7 @@ typedef struct SDL_QuitEvent - */ - typedef struct SDL_UserEvent - { -- Uint32 type; /**< ::SDL_EVENT_USER through ::SDL_EVENT_LAST-1, Uint32 because these are not in the SDL_EventType enumeration */ -+ SDL_EventType type; /**< ::SDL_EVENT_USER through ::SDL_EVENT_LAST-1, Uint32 because these are not in the SDL_EventType enumeration */ - Uint32 reserved; - Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */ - SDL_WindowID windowID; /**< The associated window if any */ -@@ -821,7 +821,7 @@ typedef struct SDL_UserEvent - */ - typedef union SDL_Event - { -- Uint32 type; /**< Event type, shared with all events, Uint32 to cover user events which are not in the SDL_EventType enumeration */ -+ SDL_EventType type; /**< Event type, shared with all events, Uint32 to cover user events which are not in the SDL_EventType enumeration */ - SDL_CommonEvent common; /**< Common event data */ - SDL_DisplayEvent display; /**< Display event data */ - SDL_WindowEvent window; /**< Window event data */ -@@ -948,7 +948,7 @@ typedef enum SDL_eventaction - * \sa SDL_PumpEvents - * \sa SDL_PushEvent - */ --extern DECLSPEC int SDLCALL SDL_PeepEvents(SDL_Event *events, int numevents, SDL_EventAction action, Uint32 minType, Uint32 maxType); -+extern DECLSPEC int SDLCALL SDL_PeepEvents(SDL_Event *events, int numevents, SDL_EventAction action, SDL_EventType minType, SDL_EventType maxType); - /* @} */ - - /** -@@ -965,7 +965,7 @@ extern DECLSPEC int SDLCALL SDL_PeepEvents(SDL_Event *events, int numevents, SDL - * - * \sa SDL_HasEvents - */ --extern DECLSPEC SDL_bool SDLCALL SDL_HasEvent(Uint32 type); -+extern DECLSPEC SDL_bool SDLCALL SDL_HasEvent(SDL_EventType type); - - - /** -@@ -984,7 +984,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_HasEvent(Uint32 type); - * - * \sa SDL_HasEvents - */ --extern DECLSPEC SDL_bool SDLCALL SDL_HasEvents(Uint32 minType, Uint32 maxType); -+extern DECLSPEC SDL_bool SDLCALL SDL_HasEvents(SDL_EventType minType, SDL_EventType maxType); - - /** - * Clear events of a specific type from the event queue. -@@ -1010,7 +1010,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_HasEvents(Uint32 minType, Uint32 maxType); - * - * \sa SDL_FlushEvents - */ --extern DECLSPEC void SDLCALL SDL_FlushEvent(Uint32 type); -+extern DECLSPEC void SDLCALL SDL_FlushEvent(SDL_EventType type); - - /** - * Clear events of a range of types from the event queue. -@@ -1035,7 +1035,7 @@ extern DECLSPEC void SDLCALL SDL_FlushEvent(Uint32 type); - * - * \sa SDL_FlushEvent - */ --extern DECLSPEC void SDLCALL SDL_FlushEvents(Uint32 minType, Uint32 maxType); -+extern DECLSPEC void SDLCALL SDL_FlushEvents(SDL_EventType minType, SDL_EventType maxType); - - /** - * Poll for currently pending events. -@@ -1324,7 +1324,7 @@ extern DECLSPEC void SDLCALL SDL_FilterEvents(SDL_EventFilter filter, void *user - * - * \sa SDL_EventEnabled - */ --extern DECLSPEC void SDLCALL SDL_SetEventEnabled(Uint32 type, SDL_bool enabled); -+extern DECLSPEC void SDLCALL SDL_SetEventEnabled(SDL_EventType type, SDL_bool enabled); - - /** - * Query the state of processing events by type. -@@ -1336,7 +1336,7 @@ extern DECLSPEC void SDLCALL SDL_SetEventEnabled(Uint32 type, SDL_bool enabled); - * - * \sa SDL_SetEventEnabled - */ --extern DECLSPEC SDL_bool SDLCALL SDL_EventEnabled(Uint32 type); -+extern DECLSPEC SDL_bool SDLCALL SDL_EventEnabled(SDL_EventType type); - - /** - * Allocate a set of user-defined events, and return the beginning event -diff --git a/include/SDL3/SDL_init.h b/include/SDL3/SDL_init.h -index 00593334d..712fe0c6f 100644 ---- a/include/SDL3/SDL_init.h -+++ b/include/SDL3/SDL_init.h -@@ -112,7 +112,7 @@ typedef enum SDL_InitFlags - * \sa SDL_SetMainReady - * \sa SDL_WasInit - */ --extern DECLSPEC int SDLCALL SDL_Init(Uint32 flags); -+extern DECLSPEC int SDLCALL SDL_Init(SDL_InitFlags flags); - - /** - * Compatibility function to initialize the SDL library. -@@ -129,7 +129,7 @@ extern DECLSPEC int SDLCALL SDL_Init(Uint32 flags); - * \sa SDL_Quit - * \sa SDL_QuitSubSystem - */ --extern DECLSPEC int SDLCALL SDL_InitSubSystem(Uint32 flags); -+extern DECLSPEC int SDLCALL SDL_InitSubSystem(SDL_InitFlags flags); - - /** - * Shut down specific SDL subsystems. -@@ -144,7 +144,7 @@ extern DECLSPEC int SDLCALL SDL_InitSubSystem(Uint32 flags); - * \sa SDL_InitSubSystem - * \sa SDL_Quit - */ --extern DECLSPEC void SDLCALL SDL_QuitSubSystem(Uint32 flags); -+extern DECLSPEC void SDLCALL SDL_QuitSubSystem(SDL_InitFlags flags); - - /** - * Get a mask of the specified subsystems which are currently initialized. -@@ -158,7 +158,7 @@ extern DECLSPEC void SDLCALL SDL_QuitSubSystem(Uint32 flags); - * \sa SDL_Init - * \sa SDL_InitSubSystem - */ --extern DECLSPEC Uint32 SDLCALL SDL_WasInit(Uint32 flags); -+extern DECLSPEC SDL_InitFlags SDLCALL SDL_WasInit(SDL_InitFlags flags); - - /** - * Clean up all initialized subsystems. diff --git a/include/SDL3/SDL_log.h b/include/SDL3/SDL_log.h -index 3ded311ff..5b39a1c96 100644 +index 3ded311ff..42760135f 100644 --- a/include/SDL3/SDL_log.h +++ b/include/SDL3/SDL_log.h -@@ -140,7 +140,7 @@ extern DECLSPEC void SDLCALL SDL_LogSetAllPriority(SDL_LogPriority priority); - * \sa SDL_LogResetPriorities - * \sa SDL_LogSetAllPriority - */ --extern DECLSPEC void SDLCALL SDL_LogSetPriority(int category, -+extern DECLSPEC void SDLCALL SDL_LogSetPriority(SDL_LogCategory category, - SDL_LogPriority priority); - - /** -@@ -153,7 +153,7 @@ extern DECLSPEC void SDLCALL SDL_LogSetPriority(int category, - * - * \sa SDL_LogSetPriority - */ --extern DECLSPEC SDL_LogPriority SDLCALL SDL_LogGetPriority(int category); -+extern DECLSPEC SDL_LogPriority SDLCALL SDL_LogGetPriority(SDL_LogCategory category); - - /** - * Reset all priorities to default. -@@ -206,7 +206,7 @@ extern DECLSPEC void SDLCALL SDL_Log(SDL_PRINTF_FORMAT_STRING const char *fmt, . - * \sa SDL_LogMessageV - * \sa SDL_LogWarn - */ --extern DECLSPEC void SDLCALL SDL_LogVerbose(int category, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(2); -+extern DECLSPEC void SDLCALL SDL_LogVerbose(SDL_LogCategory category, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(2); - - /** - * Log a message with SDL_LOG_PRIORITY_DEBUG. -@@ -227,7 +227,7 @@ extern DECLSPEC void SDLCALL SDL_LogVerbose(int category, SDL_PRINTF_FORMAT_STRI - * \sa SDL_LogVerbose - * \sa SDL_LogWarn - */ --extern DECLSPEC void SDLCALL SDL_LogDebug(int category, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(2); -+extern DECLSPEC void SDLCALL SDL_LogDebug(SDL_LogCategory category, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(2); - - /** - * Log a message with SDL_LOG_PRIORITY_INFO. -@@ -248,7 +248,7 @@ extern DECLSPEC void SDLCALL SDL_LogDebug(int category, SDL_PRINTF_FORMAT_STRING - * \sa SDL_LogVerbose - * \sa SDL_LogWarn - */ --extern DECLSPEC void SDLCALL SDL_LogInfo(int category, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(2); -+extern DECLSPEC void SDLCALL SDL_LogInfo(SDL_LogCategory category, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(2); - - /** - * Log a message with SDL_LOG_PRIORITY_WARN. -@@ -269,7 +269,7 @@ extern DECLSPEC void SDLCALL SDL_LogInfo(int category, SDL_PRINTF_FORMAT_STRING - * \sa SDL_LogMessageV - * \sa SDL_LogVerbose - */ --extern DECLSPEC void SDLCALL SDL_LogWarn(int category, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(2); -+extern DECLSPEC void SDLCALL SDL_LogWarn(SDL_LogCategory category, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(2); - - /** - * Log a message with SDL_LOG_PRIORITY_ERROR. -@@ -290,7 +290,7 @@ extern DECLSPEC void SDLCALL SDL_LogWarn(int category, SDL_PRINTF_FORMAT_STRING - * \sa SDL_LogVerbose - * \sa SDL_LogWarn - */ --extern DECLSPEC void SDLCALL SDL_LogError(int category, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(2); -+extern DECLSPEC void SDLCALL SDL_LogError(SDL_LogCategory category, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(2); - - /** - * Log a message with SDL_LOG_PRIORITY_CRITICAL. -@@ -311,7 +311,7 @@ extern DECLSPEC void SDLCALL SDL_LogError(int category, SDL_PRINTF_FORMAT_STRING - * \sa SDL_LogVerbose - * \sa SDL_LogWarn - */ --extern DECLSPEC void SDLCALL SDL_LogCritical(int category, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(2); -+extern DECLSPEC void SDLCALL SDL_LogCritical(SDL_LogCategory category, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(2); - - /** - * Log a message with the specified category and priority. -@@ -333,7 +333,7 @@ extern DECLSPEC void SDLCALL SDL_LogCritical(int category, SDL_PRINTF_FORMAT_STR - * \sa SDL_LogVerbose - * \sa SDL_LogWarn - */ --extern DECLSPEC void SDLCALL SDL_LogMessage(int category, -+extern DECLSPEC void SDLCALL SDL_LogMessage(SDL_LogCategory category, - SDL_LogPriority priority, - SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(3); - -@@ -356,7 +356,7 @@ extern DECLSPEC void SDLCALL SDL_LogMessage(int category, - * \sa SDL_LogVerbose - * \sa SDL_LogWarn - */ --extern DECLSPEC void SDLCALL SDL_LogMessageV(int category, -+extern DECLSPEC void SDLCALL SDL_LogMessageV(SDL_LogCategory category, - SDL_LogPriority priority, - SDL_PRINTF_FORMAT_STRING const char *fmt, va_list ap) SDL_PRINTF_VARARG_FUNCV(3); - @@ -372,7 +372,7 @@ extern DECLSPEC void SDLCALL SDL_LogMessageV(int category, * * \since This datatype is available since SDL 3.0.0. @@ -248,61 +24,8 @@ index 3ded311ff..5b39a1c96 100644 /** * Get the current log output function. -diff --git a/include/SDL3/SDL_messagebox.h b/include/SDL3/SDL_messagebox.h -index 48f63239b..d851c0df9 100644 ---- a/include/SDL3/SDL_messagebox.h -+++ b/include/SDL3/SDL_messagebox.h -@@ -66,7 +66,7 @@ typedef enum SDL_MessageBoxButtonFlags - */ - typedef struct SDL_MessageBoxButtonData - { -- Uint32 flags; /**< ::SDL_MessageBoxButtonFlags */ -+ SDL_MessageBoxButtonFlags flags; /**< ::SDL_MessageBoxButtonFlags */ - int buttonID; /**< User defined button id (value returned via SDL_ShowMessageBox) */ - const char *text; /**< The UTF-8 button text */ - } SDL_MessageBoxButtonData; -@@ -112,7 +112,7 @@ typedef struct SDL_MessageBoxColorScheme - */ - typedef struct SDL_MessageBoxData - { -- Uint32 flags; /**< ::SDL_MessageBoxFlags */ -+ SDL_MessageBoxFlags flags; /**< ::SDL_MessageBoxFlags */ - SDL_Window *window; /**< Parent window, can be NULL */ - const char *title; /**< UTF-8 title */ - const char *message; /**< UTF-8 message text */ -@@ -198,7 +198,7 @@ extern DECLSPEC int SDLCALL SDL_ShowMessageBox(const SDL_MessageBoxData *message - * - * \sa SDL_ShowMessageBox - */ --extern DECLSPEC int SDLCALL SDL_ShowSimpleMessageBox(Uint32 flags, const char *title, const char *message, SDL_Window *window); -+extern DECLSPEC int SDLCALL SDL_ShowSimpleMessageBox(SDL_MessageBoxFlags flags, const char *title, const char *message, SDL_Window *window); - - - /* Ends C function definitions when using C++ */ -diff --git a/include/SDL3/SDL_render.h b/include/SDL3/SDL_render.h -index f875433ce..74c631f7f 100644 ---- a/include/SDL3/SDL_render.h -+++ b/include/SDL3/SDL_render.h -@@ -86,7 +86,7 @@ typedef enum SDL_RendererFlags - typedef struct SDL_RendererInfo - { - const char *name; /**< The name of the renderer */ -- Uint32 flags; /**< Supported ::SDL_RendererFlags */ -+ SDL_RendererFlags flags; /**< Supported ::SDL_RendererFlags */ - int num_texture_formats; /**< The number of available texture formats */ - SDL_PixelFormatEnum texture_formats[16]; /**< The available texture formats */ - int max_texture_width; /**< The maximum texture width */ -@@ -241,7 +241,7 @@ extern DECLSPEC int SDLCALL SDL_CreateWindowAndRenderer(int width, int height, S - * \sa SDL_GetRenderDriver - * \sa SDL_GetRendererInfo - */ --extern DECLSPEC SDL_Renderer * SDLCALL SDL_CreateRenderer(SDL_Window *window, const char *name, Uint32 flags); -+extern DECLSPEC SDL_Renderer * SDLCALL SDL_CreateRenderer(SDL_Window *window, const char *name, SDL_RendererFlags flags); - - /** - * Create a 2D rendering context for a window, with the specified properties. diff --git a/include/SDL3/SDL_stdinc.h b/include/SDL3/SDL_stdinc.h -index 00a54a139..24ae06c13 100644 +index 00a54a139..847b50ecb 100644 --- a/include/SDL3/SDL_stdinc.h +++ b/include/SDL3/SDL_stdinc.h @@ -146,7 +146,7 @@ void *alloca(size_t); @@ -323,17 +46,6 @@ index 00a54a139..24ae06c13 100644 /** * A boolean type: true or false. -@@ -249,8 +249,8 @@ typedef uint64_t Uint64; - * - * \since This macro is available since SDL 3.0.0. - */ --#define SDL_MAX_TIME SDL_MAX_SINT64 --#define SDL_MIN_TIME SDL_MIN_SINT64 -+#define SDL_MAX_TIME (SDL_Time)SDL_MAX_SINT64 -+#define SDL_MIN_TIME (SDL_Time)SDL_MIN_SINT64 - typedef Sint64 SDL_Time; - - /* @} *//* Basic data types */ base-commit: 0429f5d6a36fc35b551bcc2acd4a40c2db6dab82 -- diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_events.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_events.g.cs index 5cf20ff..006f7e8 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_events.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_events.g.cs @@ -142,7 +142,8 @@ namespace SDL public partial struct SDL_CommonEvent { - public SDL_EventType type; + [NativeTypeName("Uint32")] + public uint type; [NativeTypeName("Uint32")] public uint reserved; @@ -882,7 +883,8 @@ namespace SDL public partial struct SDL_UserEvent { - public SDL_EventType type; + [NativeTypeName("Uint32")] + public uint type; [NativeTypeName("Uint32")] public uint reserved; @@ -906,7 +908,8 @@ namespace SDL public partial struct SDL_Event { [FieldOffset(0)] - public SDL_EventType type; + [NativeTypeName("Uint32")] + public uint type; [FieldOffset(0)] public SDL_CommonEvent common; @@ -1031,19 +1034,19 @@ namespace SDL public static extern void SDL_PumpEvents(); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int SDL_PeepEvents(SDL_Event* events, int numevents, SDL_eventaction action, SDL_EventType minType, SDL_EventType maxType); + public static extern int SDL_PeepEvents(SDL_Event* events, int numevents, SDL_eventaction action, [NativeTypeName("Uint32")] uint minType, [NativeTypeName("Uint32")] uint maxType); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern SDL_bool SDL_HasEvent(SDL_EventType type); + public static extern SDL_bool SDL_HasEvent([NativeTypeName("Uint32")] uint type); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern SDL_bool SDL_HasEvents(SDL_EventType minType, SDL_EventType maxType); + public static extern SDL_bool SDL_HasEvents([NativeTypeName("Uint32")] uint minType, [NativeTypeName("Uint32")] uint maxType); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void SDL_FlushEvent(SDL_EventType type); + public static extern void SDL_FlushEvent([NativeTypeName("Uint32")] uint type); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void SDL_FlushEvents(SDL_EventType minType, SDL_EventType maxType); + public static extern void SDL_FlushEvents([NativeTypeName("Uint32")] uint minType, [NativeTypeName("Uint32")] uint maxType); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern SDL_bool SDL_PollEvent(SDL_Event* @event); @@ -1073,10 +1076,10 @@ namespace SDL public static extern void SDL_FilterEvents([NativeTypeName("SDL_EventFilter")] delegate* unmanaged[Cdecl] filter, [NativeTypeName("void*")] IntPtr userdata); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void SDL_SetEventEnabled(SDL_EventType type, SDL_bool enabled); + public static extern void SDL_SetEventEnabled([NativeTypeName("Uint32")] uint type, SDL_bool enabled); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern SDL_bool SDL_EventEnabled(SDL_EventType type); + public static extern SDL_bool SDL_EventEnabled([NativeTypeName("Uint32")] uint type); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("Uint32")] diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_init.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_init.g.cs index 844476a..0e83d12 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_init.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_init.g.cs @@ -45,16 +45,17 @@ namespace SDL public static partial class SDL3 { [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int SDL_Init(SDL_InitFlags flags); + public static extern int SDL_Init([NativeTypeName("Uint32")] uint flags); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int SDL_InitSubSystem(SDL_InitFlags flags); + public static extern int SDL_InitSubSystem([NativeTypeName("Uint32")] uint flags); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void SDL_QuitSubSystem(SDL_InitFlags flags); + public static extern void SDL_QuitSubSystem([NativeTypeName("Uint32")] uint flags); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern SDL_InitFlags SDL_WasInit(SDL_InitFlags flags); + [return: NativeTypeName("Uint32")] + public static extern uint SDL_WasInit([NativeTypeName("Uint32")] uint flags); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern void SDL_Quit(); diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_log.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_log.g.cs index 57a9929..c28a908 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_log.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_log.g.cs @@ -69,10 +69,10 @@ namespace SDL public static extern void SDL_LogSetAllPriority(SDL_LogPriority priority); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void SDL_LogSetPriority(SDL_LogCategory category, SDL_LogPriority priority); + public static extern void SDL_LogSetPriority(int category, SDL_LogPriority priority); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern SDL_LogPriority SDL_LogGetPriority(SDL_LogCategory category); + public static extern SDL_LogPriority SDL_LogGetPriority(int category); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern void SDL_LogResetPriorities(); @@ -81,28 +81,28 @@ namespace SDL public static extern void SDL_Log([NativeTypeName("const char *")] byte* fmt, __arglist); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void SDL_LogVerbose(SDL_LogCategory category, [NativeTypeName("const char *")] byte* fmt, __arglist); + public static extern void SDL_LogVerbose(int category, [NativeTypeName("const char *")] byte* fmt, __arglist); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void SDL_LogDebug(SDL_LogCategory category, [NativeTypeName("const char *")] byte* fmt, __arglist); + public static extern void SDL_LogDebug(int category, [NativeTypeName("const char *")] byte* fmt, __arglist); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void SDL_LogInfo(SDL_LogCategory category, [NativeTypeName("const char *")] byte* fmt, __arglist); + public static extern void SDL_LogInfo(int category, [NativeTypeName("const char *")] byte* fmt, __arglist); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void SDL_LogWarn(SDL_LogCategory category, [NativeTypeName("const char *")] byte* fmt, __arglist); + public static extern void SDL_LogWarn(int category, [NativeTypeName("const char *")] byte* fmt, __arglist); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void SDL_LogError(SDL_LogCategory category, [NativeTypeName("const char *")] byte* fmt, __arglist); + public static extern void SDL_LogError(int category, [NativeTypeName("const char *")] byte* fmt, __arglist); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void SDL_LogCritical(SDL_LogCategory category, [NativeTypeName("const char *")] byte* fmt, __arglist); + public static extern void SDL_LogCritical(int category, [NativeTypeName("const char *")] byte* fmt, __arglist); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void SDL_LogMessage(SDL_LogCategory category, SDL_LogPriority priority, [NativeTypeName("const char *")] byte* fmt, __arglist); + public static extern void SDL_LogMessage(int category, SDL_LogPriority priority, [NativeTypeName("const char *")] byte* fmt, __arglist); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void SDL_LogMessageV(SDL_LogCategory category, SDL_LogPriority priority, [NativeTypeName("const char *")] byte* fmt, [NativeTypeName("va_list")] byte* ap); + public static extern void SDL_LogMessageV(int category, SDL_LogPriority priority, [NativeTypeName("const char *")] byte* fmt, [NativeTypeName("va_list")] byte* ap); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern void SDL_GetLogOutputFunction([NativeTypeName("SDL_LogOutputFunction *")] delegate* unmanaged[Cdecl]* callback, [NativeTypeName("void **")] IntPtr* userdata); diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_messagebox.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_messagebox.g.cs index dee9332..7e5ef84 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_messagebox.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_messagebox.g.cs @@ -48,7 +48,8 @@ namespace SDL public unsafe partial struct SDL_MessageBoxButtonData { - public SDL_MessageBoxButtonFlags flags; + [NativeTypeName("Uint32")] + public uint flags; public int buttonID; @@ -92,7 +93,8 @@ namespace SDL public unsafe partial struct SDL_MessageBoxData { - public SDL_MessageBoxFlags flags; + [NativeTypeName("Uint32")] + public uint flags; public SDL_Window* window; @@ -117,6 +119,6 @@ namespace SDL public static extern int SDL_ShowMessageBox([NativeTypeName("const SDL_MessageBoxData *")] SDL_MessageBoxData* messageboxdata, int* buttonid); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int SDL_ShowSimpleMessageBox(SDL_MessageBoxFlags flags, [NativeTypeName("const char *")] byte* title, [NativeTypeName("const char *")] byte* message, SDL_Window* window); + public static extern int SDL_ShowSimpleMessageBox([NativeTypeName("Uint32")] uint flags, [NativeTypeName("const char *")] byte* title, [NativeTypeName("const char *")] byte* message, SDL_Window* window); } } diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_render.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_render.g.cs index 12c830d..409edd6 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_render.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_render.g.cs @@ -40,7 +40,8 @@ namespace SDL [NativeTypeName("const char *")] public byte* name; - public SDL_RendererFlags flags; + [NativeTypeName("Uint32")] + public uint flags; public int num_texture_formats; @@ -104,7 +105,7 @@ namespace SDL public static extern int SDL_CreateWindowAndRenderer(int width, int height, SDL_WindowFlags window_flags, SDL_Window** window, SDL_Renderer** renderer); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern SDL_Renderer* SDL_CreateRenderer(SDL_Window* window, [NativeTypeName("const char *")] byte* name, SDL_RendererFlags flags); + public static extern SDL_Renderer* SDL_CreateRenderer(SDL_Window* window, [NativeTypeName("const char *")] byte* name, [NativeTypeName("Uint32")] uint flags); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern SDL_Renderer* SDL_CreateRendererWithProperties(SDL_PropertiesID props); diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_stdinc.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_stdinc.g.cs index 2bd0ad8..0d7b1cc 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_stdinc.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_stdinc.g.cs @@ -595,11 +595,11 @@ namespace SDL [NativeTypeName("#define SDL_MIN_UINT64 ((Uint64)(0x0000000000000000ull))")] public const ulong SDL_MIN_UINT64 = ((ulong)(0x0000000000000000UL)); - [NativeTypeName("#define SDL_MAX_TIME (SDL_Time)SDL_MAX_SINT64")] - public const SDL_Time SDL_MAX_TIME = (SDL_Time)((long)(0x7FFFFFFFFFFFFFFFL)); + [NativeTypeName("#define SDL_MAX_TIME SDL_MAX_SINT64")] + public const long SDL_MAX_TIME = ((long)(0x7FFFFFFFFFFFFFFFL)); - [NativeTypeName("#define SDL_MIN_TIME (SDL_Time)SDL_MIN_SINT64")] - public const SDL_Time SDL_MIN_TIME = (SDL_Time)((long)(~0x7FFFFFFFFFFFFFFFL)); + [NativeTypeName("#define SDL_MIN_TIME SDL_MIN_SINT64")] + public const long SDL_MIN_TIME = ((long)(~0x7FFFFFFFFFFFFFFFL)); [NativeTypeName("#define SDL_FLT_EPSILON 1.1920928955078125e-07F")] public const float SDL_FLT_EPSILON = 1.1920928955078125e-07F; diff --git a/SDL3-CS/SDL3/SDL_events.cs b/SDL3-CS/SDL3/SDL_events.cs index fc8a7cd..fadb059 100644 --- a/SDL3-CS/SDL3/SDL_events.cs +++ b/SDL3-CS/SDL3/SDL_events.cs @@ -3,6 +3,21 @@ namespace SDL { + public partial struct SDL_CommonEvent + { + public SDL_EventType Type => (SDL_EventType)type; + } + + public partial struct SDL_UserEvent + { + public SDL_EventType Type => (SDL_EventType)type; + } + + public partial struct SDL_Event + { + public SDL_EventType Type => (SDL_EventType)type; + } + public unsafe partial struct SDL_TextInputEvent { public string? GetText() => SDL3.PtrToStringUTF8(text); @@ -34,4 +49,19 @@ namespace SDL { public SDL_GamepadButton Button => (SDL_GamepadButton)button; } + + public static partial class SDL3 + { + public static unsafe int SDL_PeepEvents(SDL_Event[] events, SDL_eventaction action, SDL_EventType minType, SDL_EventType maxType) + { + fixed (SDL_Event* eventsPtr = events) + return SDL_PeepEvents(eventsPtr, events.Length, action, (uint)minType, (uint)maxType); + } + + public static SDL_bool SDL_HasEvent(SDL_EventType type) => SDL_HasEvent((uint)type); + public static void SDL_FlushEvent(SDL_EventType type) => SDL_FlushEvent((uint)type); + public static void SDL_FlushEvents(SDL_EventType minType, SDL_EventType maxType) => SDL_FlushEvents((uint)minType, (uint)maxType); + public static void SDL_SetEventEnabled(SDL_EventType type, SDL_bool enabled) => SDL_SetEventEnabled((uint)type, enabled); + public static SDL_bool SDL_EventEnabled(SDL_EventType type) => SDL_EventEnabled((uint)type); + } } diff --git a/SDL3-CS/SDL3/SDL_init.cs b/SDL3-CS/SDL3/SDL_init.cs new file mode 100644 index 0000000..6ac1e32 --- /dev/null +++ b/SDL3-CS/SDL3/SDL_init.cs @@ -0,0 +1,16 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +namespace SDL +{ + public static partial class SDL3 + { + public static int SDL_Init(SDL_InitFlags flags) => SDL_Init((uint)flags); + + public static int SDL_InitSubSystem(SDL_InitFlags flags) => SDL_InitSubSystem((uint)flags); + + public static void SDL_QuitSubSystem(SDL_InitFlags flags) => SDL_QuitSubSystem((uint)flags); + + public static SDL_InitFlags SDL_WasInit(SDL_InitFlags flags) => (SDL_InitFlags)SDL_WasInit((uint)flags); + } +} diff --git a/SDL3-CS/SDL3/SDL_log.cs b/SDL3-CS/SDL3/SDL_log.cs new file mode 100644 index 0000000..dd19dc4 --- /dev/null +++ b/SDL3-CS/SDL3/SDL_log.cs @@ -0,0 +1,13 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using System.Runtime.CompilerServices; + +namespace SDL +{ + public static partial class SDL3 + { + public static void SDL_LogSetPriority(SDL_LogCategory category, SDL_LogPriority priority) => SDL_LogSetPriority((int)category, priority); + public static SDL_LogPriority SDL_LogGetPriority(SDL_LogCategory category) => SDL_LogGetPriority((int)category); + } +} diff --git a/SDL3-CS/SDL3/SDL_messagebox.cs b/SDL3-CS/SDL3/SDL_messagebox.cs new file mode 100644 index 0000000..764cbbc --- /dev/null +++ b/SDL3-CS/SDL3/SDL_messagebox.cs @@ -0,0 +1,24 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using System; + +namespace SDL +{ + public partial struct SDL_MessageBoxButtonData + { + public SDL_MessageBoxButtonFlags Flags => (SDL_MessageBoxButtonFlags)flags; + } + + public partial struct SDL_MessageBoxData + { + public SDL_MessageBoxFlags Flags => (SDL_MessageBoxFlags)flags; + } + + public static partial class SDL3 + { + // public static int SDL_ShowSimpleMessageBox([NativeTypeName("Uint32")] uint flags, [NativeTypeName("const char *")] byte* title, [NativeTypeName("const char *")] byte* message, SDL_Window* window); + public static unsafe int SDL_ShowSimpleMessageBox(SDL_MessageBoxFlags flags, ReadOnlySpan title, ReadOnlySpan message, SDL_Window* window) + => SDL_ShowSimpleMessageBox((uint)flags, title, message, window); + } +} diff --git a/SDL3-CS/SDL3/SDL_render.cs b/SDL3-CS/SDL3/SDL_render.cs new file mode 100644 index 0000000..896953b --- /dev/null +++ b/SDL3-CS/SDL3/SDL_render.cs @@ -0,0 +1,18 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using System; + +namespace SDL +{ + public partial struct SDL_RendererInfo + { + public SDL_RendererFlags Flags => (SDL_RendererFlags)flags; + } + + public static partial class SDL3 + { + public static unsafe SDL_Renderer* SDL_CreateRenderer(SDL_Window* window, ReadOnlySpan name, SDL_RendererFlags flags) + => SDL_CreateRenderer(window, name, (uint)flags); + } +} From b5ae4000e35b9ca9e1b965daf6acbb6ea1bc5697 Mon Sep 17 00:00:00 2001 From: Susko3 Date: Mon, 15 Apr 2024 19:41:25 +0200 Subject: [PATCH 4/4] Update to Rider 2024.1 DotSettings --- SDL3-CS.sln.DotSettings | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/SDL3-CS.sln.DotSettings b/SDL3-CS.sln.DotSettings index 45e9c9e..099f4aa 100644 --- a/SDL3-CS.sln.DotSettings +++ b/SDL3-CS.sln.DotSettings @@ -780,4 +780,10 @@ See the LICENCE file in the repository root for full licence text. <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /> <Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /> <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /> - <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /> \ No newline at end of file + <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /> + True + True + True + True + True + True \ No newline at end of file