From 69a12ff56bab29d33e378bd923ad441e2bc3fd98 Mon Sep 17 00:00:00 2001 From: hwsmm Date: Tue, 2 Jul 2024 21:55:34 +0900 Subject: [PATCH] Apply suggestions from Susko3 --- SDL3-CS/SDL3/ClangSharp/SDL_events.g.cs | 3 +-- SDL3-CS/SDL3/ClangSharp/SDL_mouse.g.cs | 9 +++------ SDL3-CS/SDL3/ClangSharp/SDL_pen.g.cs | 3 +-- SDL3-CS/SDL3/SDL_mouse.cs | 5 +++-- SDL3-CS/SDL3/SDL_pen.cs | 7 ++++--- SDL3-CS/SDL3/SDL_video.cs | 8 ++++++++ 6 files changed, 20 insertions(+), 15 deletions(-) diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_events.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_events.g.cs index 911e05f..ade922b 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_events.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_events.g.cs @@ -295,8 +295,7 @@ namespace SDL public SDL_MouseID which; - [NativeTypeName("SDL_MouseButtonFlags")] - public uint state; + public SDL_MouseButtonFlags state; public float x; diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_mouse.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_mouse.g.cs index 0b06a25..38ba273 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_mouse.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_mouse.g.cs @@ -78,16 +78,13 @@ namespace SDL public static extern SDL_Window* SDL_GetMouseFocus(); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("SDL_MouseButtonFlags")] - public static extern uint SDL_GetMouseState(float* x, float* y); + public static extern SDL_MouseButtonFlags SDL_GetMouseState(float* x, float* y); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("SDL_MouseButtonFlags")] - public static extern uint SDL_GetGlobalMouseState(float* x, float* y); + public static extern SDL_MouseButtonFlags SDL_GetGlobalMouseState(float* x, float* y); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("SDL_MouseButtonFlags")] - public static extern uint SDL_GetRelativeMouseState(float* x, float* y); + public static extern SDL_MouseButtonFlags SDL_GetRelativeMouseState(float* x, float* y); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern void SDL_WarpMouseInWindow(SDL_Window* window, float x, float y); diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_pen.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_pen.g.cs index 22c061f..210a25b 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_pen.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_pen.g.cs @@ -85,8 +85,7 @@ namespace SDL public static extern byte* Unsafe_SDL_GetPenName(SDL_PenID instance_id); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("SDL_PenCapabilityFlags")] - public static extern uint SDL_GetPenCapabilities(SDL_PenID instance_id, SDL_PenCapabilityInfo* capabilities); + public static extern SDL_PenCapabilityFlags SDL_GetPenCapabilities(SDL_PenID instance_id, SDL_PenCapabilityInfo* capabilities); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern SDL_PenSubtype SDL_GetPenType(SDL_PenID instance_id); diff --git a/SDL3-CS/SDL3/SDL_mouse.cs b/SDL3-CS/SDL3/SDL_mouse.cs index 88f9129..4128182 100644 --- a/SDL3-CS/SDL3/SDL_mouse.cs +++ b/SDL3-CS/SDL3/SDL_mouse.cs @@ -19,7 +19,8 @@ namespace SDL } [Flags] - public enum SDLButtonMask : uint + [Typedef] + public enum SDL_MouseButtonFlags : uint { SDL_BUTTON_LMASK = SDL3.SDL_BUTTON_LMASK, SDL_BUTTON_MMASK = SDL3.SDL_BUTTON_MMASK, @@ -31,7 +32,7 @@ namespace SDL public static partial class SDL3 { [Macro] - public static SDLButtonMask SDL_BUTTON(SDLButton button) => (SDLButtonMask)(1 << ((int)button - 1)); + public static SDL_MouseButtonFlags SDL_BUTTON(SDLButton button) => (SDL_MouseButtonFlags)(1 << ((int)button - 1)); [MustDisposeResource] public static unsafe SDLArray? SDL_GetMice() diff --git a/SDL3-CS/SDL3/SDL_pen.cs b/SDL3-CS/SDL3/SDL_pen.cs index aab107e..dddfe91 100644 --- a/SDL3-CS/SDL3/SDL_pen.cs +++ b/SDL3-CS/SDL3/SDL_pen.cs @@ -10,7 +10,8 @@ namespace SDL public enum SDL_PenID : UInt32; [Flags] - public enum SDL_PEN_CAPABILITIES : uint + [Typedef] + public enum SDL_PenCapabilityFlags : uint { SDL_PEN_DOWN_MASK = SDL3.SDL_PEN_DOWN_MASK, SDL_PEN_INK_MASK = SDL3.SDL_PEN_INK_MASK, @@ -30,10 +31,10 @@ namespace SDL public const SDL_MouseID SDL_PEN_MOUSEID = unchecked((SDL_MouseID)(-2)); [Macro] - public static SDL_PEN_CAPABILITIES SDL_PEN_CAPABILITY(int capbit) => (SDL_PEN_CAPABILITIES)(1ul << (capbit)); + public static SDL_PenCapabilityFlags SDL_PEN_CAPABILITY(int capbit) => (SDL_PenCapabilityFlags)(1ul << (capbit)); [Macro] - public static SDL_PEN_CAPABILITIES SDL_PEN_AXIS_CAPABILITY(SDL_PenAxis axis) => SDL_PEN_CAPABILITY((int)axis + SDL_PEN_FLAG_AXIS_BIT_OFFSET); + public static SDL_PenCapabilityFlags SDL_PEN_AXIS_CAPABILITY(SDL_PenAxis axis) => SDL_PEN_CAPABILITY((int)axis + SDL_PEN_FLAG_AXIS_BIT_OFFSET); [MustDisposeResource] public static unsafe SDLArray? SDL_GetPens() diff --git a/SDL3-CS/SDL3/SDL_video.cs b/SDL3-CS/SDL3/SDL_video.cs index 98bfad3..37d99d1 100644 --- a/SDL3-CS/SDL3/SDL_video.cs +++ b/SDL3-CS/SDL3/SDL_video.cs @@ -70,5 +70,13 @@ namespace SDL var array = SDL_GetFullscreenDisplayModes(displayID, &count); return SDLArray.Create(array, count); } + + [MustDisposeResource] + public static unsafe SDLPointerArray? SDL_GetWindows() + { + int count; + var array = SDL_GetWindows(&count); + return SDLArray.Create(array, count); + } } }