Apply suggestions from Susko3

This commit is contained in:
hwsmm 2024-07-02 21:55:34 +09:00
parent 3daf817a01
commit 69a12ff56b
6 changed files with 20 additions and 15 deletions

View File

@ -295,8 +295,7 @@ namespace SDL
public SDL_MouseID which; public SDL_MouseID which;
[NativeTypeName("SDL_MouseButtonFlags")] public SDL_MouseButtonFlags state;
public uint state;
public float x; public float x;

View File

@ -78,16 +78,13 @@ namespace SDL
public static extern SDL_Window* SDL_GetMouseFocus(); public static extern SDL_Window* SDL_GetMouseFocus();
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("SDL_MouseButtonFlags")] public static extern SDL_MouseButtonFlags SDL_GetMouseState(float* x, float* y);
public static extern uint SDL_GetMouseState(float* x, float* y);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("SDL_MouseButtonFlags")] public static extern SDL_MouseButtonFlags SDL_GetGlobalMouseState(float* x, float* y);
public static extern uint SDL_GetGlobalMouseState(float* x, float* y);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("SDL_MouseButtonFlags")] public static extern SDL_MouseButtonFlags SDL_GetRelativeMouseState(float* x, float* y);
public static extern uint SDL_GetRelativeMouseState(float* x, float* y);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void SDL_WarpMouseInWindow(SDL_Window* window, float x, float y); public static extern void SDL_WarpMouseInWindow(SDL_Window* window, float x, float y);

View File

@ -85,8 +85,7 @@ namespace SDL
public static extern byte* Unsafe_SDL_GetPenName(SDL_PenID instance_id); public static extern byte* Unsafe_SDL_GetPenName(SDL_PenID instance_id);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("SDL_PenCapabilityFlags")] public static extern SDL_PenCapabilityFlags SDL_GetPenCapabilities(SDL_PenID instance_id, SDL_PenCapabilityInfo* capabilities);
public static extern uint SDL_GetPenCapabilities(SDL_PenID instance_id, SDL_PenCapabilityInfo* capabilities);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern SDL_PenSubtype SDL_GetPenType(SDL_PenID instance_id); public static extern SDL_PenSubtype SDL_GetPenType(SDL_PenID instance_id);

View File

@ -19,7 +19,8 @@ namespace SDL
} }
[Flags] [Flags]
public enum SDLButtonMask : uint [Typedef]
public enum SDL_MouseButtonFlags : uint
{ {
SDL_BUTTON_LMASK = SDL3.SDL_BUTTON_LMASK, SDL_BUTTON_LMASK = SDL3.SDL_BUTTON_LMASK,
SDL_BUTTON_MMASK = SDL3.SDL_BUTTON_MMASK, SDL_BUTTON_MMASK = SDL3.SDL_BUTTON_MMASK,
@ -31,7 +32,7 @@ namespace SDL
public static partial class SDL3 public static partial class SDL3
{ {
[Macro] [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] [MustDisposeResource]
public static unsafe SDLArray<SDL_MouseID>? SDL_GetMice() public static unsafe SDLArray<SDL_MouseID>? SDL_GetMice()

View File

@ -10,7 +10,8 @@ namespace SDL
public enum SDL_PenID : UInt32; public enum SDL_PenID : UInt32;
[Flags] [Flags]
public enum SDL_PEN_CAPABILITIES : uint [Typedef]
public enum SDL_PenCapabilityFlags : uint
{ {
SDL_PEN_DOWN_MASK = SDL3.SDL_PEN_DOWN_MASK, SDL_PEN_DOWN_MASK = SDL3.SDL_PEN_DOWN_MASK,
SDL_PEN_INK_MASK = SDL3.SDL_PEN_INK_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)); public const SDL_MouseID SDL_PEN_MOUSEID = unchecked((SDL_MouseID)(-2));
[Macro] [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] [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] [MustDisposeResource]
public static unsafe SDLArray<SDL_PenID>? SDL_GetPens() public static unsafe SDLArray<SDL_PenID>? SDL_GetPens()

View File

@ -70,5 +70,13 @@ namespace SDL
var array = SDL_GetFullscreenDisplayModes(displayID, &count); var array = SDL_GetFullscreenDisplayModes(displayID, &count);
return SDLArray.Create(array, count); return SDLArray.Create(array, count);
} }
[MustDisposeResource]
public static unsafe SDLPointerArray<SDL_Window>? SDL_GetWindows()
{
int count;
var array = SDL_GetWindows(&count);
return SDLArray.Create(array, count);
}
} }
} }