Update bindings to e1aa99573270eac053b428cc899eebf499b44eca

This commit is contained in:
hwsmm 2024-07-20 15:13:58 +09:00
parent 12d09eaeae
commit 8fc87afcec
40 changed files with 350 additions and 296 deletions

View File

@ -28,6 +28,19 @@ using System.Runtime.InteropServices;
namespace SDL
{
[NativeTypeName("int")]
public enum SDL_AudioFormat : uint
{
SDL_AUDIO_U8 = 0x0008U,
SDL_AUDIO_S8 = 0x8008U,
SDL_AUDIO_S16LE = 0x8010U,
SDL_AUDIO_S16BE = 0x9010U,
SDL_AUDIO_S32LE = 0x8020U,
SDL_AUDIO_S32BE = 0x9020U,
SDL_AUDIO_F32LE = 0x8120U,
SDL_AUDIO_F32BE = 0x9120U,
}
public partial struct SDL_AudioSpec
{
public SDL_AudioFormat format;
@ -55,9 +68,11 @@ namespace SDL
public static extern byte* Unsafe_SDL_GetCurrentAudioDriver();
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("const SDL_AudioDeviceID *")]
public static extern SDL_AudioDeviceID* SDL_GetAudioPlaybackDevices(int* count);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("const SDL_AudioDeviceID *")]
public static extern SDL_AudioDeviceID* SDL_GetAudioRecordingDevices(int* count);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_GetAudioDeviceName", ExactSpelling = true)]
@ -205,30 +220,6 @@ namespace SDL
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern int SDL_GetSilenceValueForFormat(SDL_AudioFormat format);
[NativeTypeName("#define SDL_AUDIO_U8 0x0008u")]
public const uint SDL_AUDIO_U8 = 0x0008U;
[NativeTypeName("#define SDL_AUDIO_S8 0x8008u")]
public const uint SDL_AUDIO_S8 = 0x8008U;
[NativeTypeName("#define SDL_AUDIO_S16LE 0x8010u")]
public const uint SDL_AUDIO_S16LE = 0x8010U;
[NativeTypeName("#define SDL_AUDIO_S16BE 0x9010u")]
public const uint SDL_AUDIO_S16BE = 0x9010U;
[NativeTypeName("#define SDL_AUDIO_S32LE 0x8020u")]
public const uint SDL_AUDIO_S32LE = 0x8020U;
[NativeTypeName("#define SDL_AUDIO_S32BE 0x9020u")]
public const uint SDL_AUDIO_S32BE = 0x9020U;
[NativeTypeName("#define SDL_AUDIO_F32LE 0x8120u")]
public const uint SDL_AUDIO_F32LE = 0x8120U;
[NativeTypeName("#define SDL_AUDIO_F32BE 0x9120u")]
public const uint SDL_AUDIO_F32BE = 0x9120U;
[NativeTypeName("#define SDL_AUDIO_MASK_BITSIZE (0xFFu)")]
public const uint SDL_AUDIO_MASK_BITSIZE = (0xFFU);

View File

@ -61,9 +61,15 @@ namespace SDL
[NativeTypeName("#define SDL_BLENDMODE_BLEND 0x00000001u")]
public const uint SDL_BLENDMODE_BLEND = 0x00000001U;
[NativeTypeName("#define SDL_BLENDMODE_BLEND_PREMULTIPLIED 0x00000010u")]
public const uint SDL_BLENDMODE_BLEND_PREMULTIPLIED = 0x00000010U;
[NativeTypeName("#define SDL_BLENDMODE_ADD 0x00000002u")]
public const uint SDL_BLENDMODE_ADD = 0x00000002U;
[NativeTypeName("#define SDL_BLENDMODE_ADD_PREMULTIPLIED 0x00000020u")]
public const uint SDL_BLENDMODE_ADD_PREMULTIPLIED = 0x00000020U;
[NativeTypeName("#define SDL_BLENDMODE_MOD 0x00000004u")]
public const uint SDL_BLENDMODE_MOD = 0x00000004U;

View File

@ -67,26 +67,28 @@ namespace SDL
public static extern byte* Unsafe_SDL_GetCurrentCameraDriver();
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern SDL_CameraDeviceID* SDL_GetCameraDevices(int* count);
[return: NativeTypeName("const SDL_CameraID *")]
public static extern SDL_CameraID* SDL_GetCameras(int* count);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern SDL_CameraSpec* SDL_GetCameraDeviceSupportedFormats(SDL_CameraDeviceID devid, int* count);
[return: NativeTypeName("const SDL_CameraSpec *const *")]
public static extern SDL_CameraSpec** SDL_GetCameraSupportedFormats(SDL_CameraID devid, int* count);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_GetCameraDeviceName", ExactSpelling = true)]
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_GetCameraName", ExactSpelling = true)]
[return: NativeTypeName("const char *")]
public static extern byte* Unsafe_SDL_GetCameraDeviceName(SDL_CameraDeviceID instance_id);
public static extern byte* Unsafe_SDL_GetCameraName(SDL_CameraID instance_id);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern SDL_CameraPosition SDL_GetCameraDevicePosition(SDL_CameraDeviceID instance_id);
public static extern SDL_CameraPosition SDL_GetCameraPosition(SDL_CameraID instance_id);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern SDL_Camera* SDL_OpenCameraDevice(SDL_CameraDeviceID instance_id, [NativeTypeName("const SDL_CameraSpec *")] SDL_CameraSpec* spec);
public static extern SDL_Camera* SDL_OpenCamera(SDL_CameraID instance_id, [NativeTypeName("const SDL_CameraSpec *")] SDL_CameraSpec* spec);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern int SDL_GetCameraPermissionState(SDL_Camera* camera);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern SDL_CameraDeviceID SDL_GetCameraInstanceID(SDL_Camera* camera);
public static extern SDL_CameraID SDL_GetCameraID(SDL_Camera* camera);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern SDL_PropertiesID SDL_GetCameraProperties(SDL_Camera* camera);

View File

@ -34,7 +34,7 @@ namespace SDL
public static extern int SDL_SetClipboardText([NativeTypeName("const char *")] byte* text);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_GetClipboardText", ExactSpelling = true)]
[return: NativeTypeName("char *")]
[return: NativeTypeName("const char *")]
public static extern byte* Unsafe_SDL_GetClipboardText();
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
@ -44,7 +44,7 @@ namespace SDL
public static extern int SDL_SetPrimarySelectionText([NativeTypeName("const char *")] byte* text);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_GetPrimarySelectionText", ExactSpelling = true)]
[return: NativeTypeName("char *")]
[return: NativeTypeName("const char *")]
public static extern byte* Unsafe_SDL_GetPrimarySelectionText();
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
@ -57,7 +57,7 @@ namespace SDL
public static extern int SDL_ClearClipboardData();
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("void*")]
[return: NativeTypeName("const void *")]
public static extern IntPtr SDL_GetClipboardData([NativeTypeName("const char *")] byte* mime_type, [NativeTypeName("size_t *")] nuint* size);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]

View File

@ -45,6 +45,8 @@ namespace SDL
SDL_EVENT_DISPLAY_ADDED,
SDL_EVENT_DISPLAY_REMOVED,
SDL_EVENT_DISPLAY_MOVED,
SDL_EVENT_DISPLAY_DESKTOP_MODE_CHANGED,
SDL_EVENT_DISPLAY_CURRENT_MODE_CHANGED,
SDL_EVENT_DISPLAY_CONTENT_SCALE_CHANGED,
SDL_EVENT_DISPLAY_FIRST = SDL_EVENT_DISPLAY_ORIENTATION,
SDL_EVENT_DISPLAY_LAST = SDL_EVENT_DISPLAY_CONTENT_SCALE_CHANGED,
@ -74,7 +76,7 @@ namespace SDL
SDL_EVENT_WINDOW_PEN_LEAVE,
SDL_EVENT_WINDOW_HDR_STATE_CHANGED,
SDL_EVENT_WINDOW_FIRST = SDL_EVENT_WINDOW_SHOWN,
SDL_EVENT_WINDOW_LAST = SDL_EVENT_WINDOW_PEN_LEAVE,
SDL_EVENT_WINDOW_LAST = SDL_EVENT_WINDOW_HDR_STATE_CHANGED,
SDL_EVENT_KEY_DOWN = 0x300,
SDL_EVENT_KEY_UP,
SDL_EVENT_TEXT_EDITING,
@ -166,6 +168,9 @@ namespace SDL
[NativeTypeName("Sint32")]
public int data1;
[NativeTypeName("Sint32")]
public int data2;
}
public partial struct SDL_WindowEvent
@ -685,7 +690,7 @@ namespace SDL
[NativeTypeName("Uint64")]
public ulong timestamp;
public SDL_CameraDeviceID which;
public SDL_CameraID which;
}
public partial struct SDL_TouchFingerEvent
@ -1105,7 +1110,14 @@ namespace SDL
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("void*")]
public static extern IntPtr SDL_AllocateEventMemory([NativeTypeName("size_t")] nuint size);
public static extern IntPtr SDL_AllocateTemporaryMemory([NativeTypeName("size_t")] nuint size);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("void*")]
public static extern IntPtr SDL_ClaimTemporaryMemory([NativeTypeName("const void *")] IntPtr mem);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void SDL_FreeTemporaryMemory([NativeTypeName("const void *")] IntPtr mem);
[NativeTypeName("#define SDL_RELEASED 0")]
public const int SDL_RELEASED = 0;

View File

@ -41,6 +41,7 @@ namespace SDL
SDL_FOLDER_SCREENSHOTS,
SDL_FOLDER_TEMPLATES,
SDL_FOLDER_VIDEOS,
SDL_FOLDER_TOTAL,
}
public enum SDL_PathType
@ -68,15 +69,15 @@ namespace SDL
public static unsafe partial class SDL3
{
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_GetBasePath", ExactSpelling = true)]
[return: NativeTypeName("char *")]
[return: NativeTypeName("const char *")]
public static extern byte* Unsafe_SDL_GetBasePath();
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_GetPrefPath", ExactSpelling = true)]
[return: NativeTypeName("char *")]
[return: NativeTypeName("const char *")]
public static extern byte* Unsafe_SDL_GetPrefPath([NativeTypeName("const char *")] byte* org, [NativeTypeName("const char *")] byte* app);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_GetUserFolder", ExactSpelling = true)]
[return: NativeTypeName("char *")]
[return: NativeTypeName("const char *")]
public static extern byte* Unsafe_SDL_GetUserFolder(SDL_Folder folder);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
@ -95,7 +96,7 @@ namespace SDL
public static extern int SDL_GetPathInfo([NativeTypeName("const char *")] byte* path, SDL_PathInfo* info);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("char **")]
[return: NativeTypeName("const char *const *")]
public static extern byte** SDL_GlobDirectory([NativeTypeName("const char *")] byte* path, [NativeTypeName("const char *")] byte* pattern, SDL_GlobFlags flags, int* count);
[NativeTypeName("#define SDL_GLOB_CASEINSENSITIVE (1u << 0)")]

View File

@ -192,15 +192,15 @@ namespace SDL
public static extern int SDL_ReloadGamepadMappings();
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("char **")]
[return: NativeTypeName("const char *const *")]
public static extern byte** SDL_GetGamepadMappings(int* count);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_GetGamepadMappingForGUID", ExactSpelling = true)]
[return: NativeTypeName("char *")]
public static extern byte* Unsafe_SDL_GetGamepadMappingForGUID([NativeTypeName("SDL_JoystickGUID")] SDL_GUID guid);
[return: NativeTypeName("const char *")]
public static extern byte* Unsafe_SDL_GetGamepadMappingForGUID(SDL_GUID guid);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_GetGamepadMapping", ExactSpelling = true)]
[return: NativeTypeName("char *")]
[return: NativeTypeName("const char *")]
public static extern byte* Unsafe_SDL_GetGamepadMapping(SDL_Gamepad* gamepad);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
@ -210,53 +210,53 @@ namespace SDL
public static extern SDL_bool SDL_HasGamepad();
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("const SDL_JoystickID *")]
public static extern SDL_JoystickID* SDL_GetGamepads(int* count);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern SDL_bool SDL_IsGamepad(SDL_JoystickID instance_id);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_GetGamepadInstanceName", ExactSpelling = true)]
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_GetGamepadNameForID", ExactSpelling = true)]
[return: NativeTypeName("const char *")]
public static extern byte* Unsafe_SDL_GetGamepadInstanceName(SDL_JoystickID instance_id);
public static extern byte* Unsafe_SDL_GetGamepadNameForID(SDL_JoystickID instance_id);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_GetGamepadInstancePath", ExactSpelling = true)]
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_GetGamepadPathForID", ExactSpelling = true)]
[return: NativeTypeName("const char *")]
public static extern byte* Unsafe_SDL_GetGamepadInstancePath(SDL_JoystickID instance_id);
public static extern byte* Unsafe_SDL_GetGamepadPathForID(SDL_JoystickID instance_id);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern int SDL_GetGamepadInstancePlayerIndex(SDL_JoystickID instance_id);
public static extern int SDL_GetGamepadPlayerIndexForID(SDL_JoystickID instance_id);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("SDL_JoystickGUID")]
public static extern SDL_GUID SDL_GetGamepadInstanceGUID(SDL_JoystickID instance_id);
public static extern SDL_GUID SDL_GetGamepadGUIDForID(SDL_JoystickID instance_id);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("Uint16")]
public static extern ushort SDL_GetGamepadInstanceVendor(SDL_JoystickID instance_id);
public static extern ushort SDL_GetGamepadVendorForID(SDL_JoystickID instance_id);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("Uint16")]
public static extern ushort SDL_GetGamepadInstanceProduct(SDL_JoystickID instance_id);
public static extern ushort SDL_GetGamepadProductForID(SDL_JoystickID instance_id);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("Uint16")]
public static extern ushort SDL_GetGamepadInstanceProductVersion(SDL_JoystickID instance_id);
public static extern ushort SDL_GetGamepadProductVersionForID(SDL_JoystickID instance_id);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern SDL_GamepadType SDL_GetGamepadInstanceType(SDL_JoystickID instance_id);
public static extern SDL_GamepadType SDL_GetGamepadTypeForID(SDL_JoystickID instance_id);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern SDL_GamepadType SDL_GetRealGamepadInstanceType(SDL_JoystickID instance_id);
public static extern SDL_GamepadType SDL_GetRealGamepadTypeForID(SDL_JoystickID instance_id);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_GetGamepadInstanceMapping", ExactSpelling = true)]
[return: NativeTypeName("char *")]
public static extern byte* Unsafe_SDL_GetGamepadInstanceMapping(SDL_JoystickID instance_id);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_GetGamepadMappingForID", ExactSpelling = true)]
[return: NativeTypeName("const char *")]
public static extern byte* Unsafe_SDL_GetGamepadMappingForID(SDL_JoystickID instance_id);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern SDL_Gamepad* SDL_OpenGamepad(SDL_JoystickID instance_id);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern SDL_Gamepad* SDL_GetGamepadFromInstanceID(SDL_JoystickID instance_id);
public static extern SDL_Gamepad* SDL_GetGamepadFromID(SDL_JoystickID instance_id);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern SDL_Gamepad* SDL_GetGamepadFromPlayerIndex(int player_index);
@ -265,7 +265,7 @@ namespace SDL
public static extern SDL_PropertiesID SDL_GetGamepadProperties(SDL_Gamepad* gamepad);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern SDL_JoystickID SDL_GetGamepadInstanceID(SDL_Gamepad* gamepad);
public static extern SDL_JoystickID SDL_GetGamepadID(SDL_Gamepad* gamepad);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_GetGamepadName", ExactSpelling = true)]
[return: NativeTypeName("const char *")]
@ -330,6 +330,7 @@ namespace SDL
public static extern SDL_bool SDL_GamepadEventsEnabled();
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("const SDL_GamepadBinding *const *")]
public static extern SDL_GamepadBinding** SDL_GetGamepadBindings(SDL_Gamepad* gamepad, int* count);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]

View File

@ -42,8 +42,9 @@ namespace SDL
public static unsafe partial class SDL3
{
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern int SDL_GUIDToString(SDL_GUID guid, [NativeTypeName("char *")] byte* pszGUID, int cbGUID);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_GUIDToString", ExactSpelling = true)]
[return: NativeTypeName("const char *")]
public static extern byte* Unsafe_SDL_GUIDToString(SDL_GUID guid);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern SDL_GUID SDL_GUIDFromString([NativeTypeName("const char *")] byte* pchGUID);

View File

@ -326,20 +326,21 @@ namespace SDL
public static unsafe partial class SDL3
{
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("const SDL_HapticID *")]
public static extern SDL_HapticID* SDL_GetHaptics(int* count);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_GetHapticInstanceName", ExactSpelling = true)]
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_GetHapticNameForID", ExactSpelling = true)]
[return: NativeTypeName("const char *")]
public static extern byte* Unsafe_SDL_GetHapticInstanceName(SDL_HapticID instance_id);
public static extern byte* Unsafe_SDL_GetHapticNameForID(SDL_HapticID instance_id);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern SDL_Haptic* SDL_OpenHaptic(SDL_HapticID instance_id);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern SDL_Haptic* SDL_GetHapticFromInstanceID(SDL_HapticID instance_id);
public static extern SDL_Haptic* SDL_GetHapticFromID(SDL_HapticID instance_id);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern SDL_HapticID SDL_GetHapticInstanceID(SDL_Haptic* haptic);
public static extern SDL_HapticID SDL_GetHapticID(SDL_Haptic* haptic);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_GetHapticName", ExactSpelling = true)]
[return: NativeTypeName("const char *")]

View File

@ -170,43 +170,43 @@ namespace SDL
public static extern SDL_bool SDL_HasJoystick();
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("const SDL_JoystickID *")]
public static extern SDL_JoystickID* SDL_GetJoysticks(int* count);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_GetJoystickInstanceName", ExactSpelling = true)]
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_GetJoystickNameForID", ExactSpelling = true)]
[return: NativeTypeName("const char *")]
public static extern byte* Unsafe_SDL_GetJoystickInstanceName(SDL_JoystickID instance_id);
public static extern byte* Unsafe_SDL_GetJoystickNameForID(SDL_JoystickID instance_id);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_GetJoystickInstancePath", ExactSpelling = true)]
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_GetJoystickPathForID", ExactSpelling = true)]
[return: NativeTypeName("const char *")]
public static extern byte* Unsafe_SDL_GetJoystickInstancePath(SDL_JoystickID instance_id);
public static extern byte* Unsafe_SDL_GetJoystickPathForID(SDL_JoystickID instance_id);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern int SDL_GetJoystickInstancePlayerIndex(SDL_JoystickID instance_id);
public static extern int SDL_GetJoystickPlayerIndexForID(SDL_JoystickID instance_id);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("SDL_JoystickGUID")]
public static extern SDL_GUID SDL_GetJoystickInstanceGUID(SDL_JoystickID instance_id);
public static extern SDL_GUID SDL_GetJoystickGUIDForID(SDL_JoystickID instance_id);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("Uint16")]
public static extern ushort SDL_GetJoystickInstanceVendor(SDL_JoystickID instance_id);
public static extern ushort SDL_GetJoystickVendorForID(SDL_JoystickID instance_id);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("Uint16")]
public static extern ushort SDL_GetJoystickInstanceProduct(SDL_JoystickID instance_id);
public static extern ushort SDL_GetJoystickProductForID(SDL_JoystickID instance_id);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("Uint16")]
public static extern ushort SDL_GetJoystickInstanceProductVersion(SDL_JoystickID instance_id);
public static extern ushort SDL_GetJoystickProductVersionForID(SDL_JoystickID instance_id);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern SDL_JoystickType SDL_GetJoystickInstanceType(SDL_JoystickID instance_id);
public static extern SDL_JoystickType SDL_GetJoystickTypeForID(SDL_JoystickID instance_id);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern SDL_Joystick* SDL_OpenJoystick(SDL_JoystickID instance_id);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern SDL_Joystick* SDL_GetJoystickFromInstanceID(SDL_JoystickID instance_id);
public static extern SDL_Joystick* SDL_GetJoystickFromID(SDL_JoystickID instance_id);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern SDL_Joystick* SDL_GetJoystickFromPlayerIndex(int player_index);
@ -256,7 +256,6 @@ namespace SDL
public static extern int SDL_SetJoystickPlayerIndex(SDL_Joystick* joystick, int player_index);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("SDL_JoystickGUID")]
public static extern SDL_GUID SDL_GetJoystickGUID(SDL_Joystick* joystick);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
@ -283,20 +282,13 @@ namespace SDL
public static extern SDL_JoystickType SDL_GetJoystickType(SDL_Joystick* joystick);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern int SDL_GetJoystickGUIDString([NativeTypeName("SDL_JoystickGUID")] SDL_GUID guid, [NativeTypeName("char *")] byte* pszGUID, int cbGUID);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("SDL_JoystickGUID")]
public static extern SDL_GUID SDL_GetJoystickGUIDFromString([NativeTypeName("const char *")] byte* pchGUID);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void SDL_GetJoystickGUIDInfo([NativeTypeName("SDL_JoystickGUID")] SDL_GUID guid, [NativeTypeName("Uint16 *")] ushort* vendor, [NativeTypeName("Uint16 *")] ushort* product, [NativeTypeName("Uint16 *")] ushort* version, [NativeTypeName("Uint16 *")] ushort* crc16);
public static extern void SDL_GetJoystickGUIDInfo(SDL_GUID guid, [NativeTypeName("Uint16 *")] ushort* vendor, [NativeTypeName("Uint16 *")] ushort* product, [NativeTypeName("Uint16 *")] ushort* version, [NativeTypeName("Uint16 *")] ushort* crc16);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern SDL_bool SDL_JoystickConnected(SDL_Joystick* joystick);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern SDL_JoystickID SDL_GetJoystickInstanceID(SDL_Joystick* joystick);
public static extern SDL_JoystickID SDL_GetJoystickID(SDL_Joystick* joystick);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern int SDL_GetNumJoystickAxes(SDL_Joystick* joystick);

View File

@ -33,11 +33,12 @@ namespace SDL
public static extern SDL_bool SDL_HasKeyboard();
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("const SDL_KeyboardID *")]
public static extern SDL_KeyboardID* SDL_GetKeyboards(int* count);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_GetKeyboardInstanceName", ExactSpelling = true)]
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_GetKeyboardNameForID", ExactSpelling = true)]
[return: NativeTypeName("const char *")]
public static extern byte* Unsafe_SDL_GetKeyboardInstanceName(SDL_KeyboardID instance_id);
public static extern byte* Unsafe_SDL_GetKeyboardNameForID(SDL_KeyboardID instance_id);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern SDL_Window* SDL_GetKeyboardFocus();

View File

@ -39,6 +39,7 @@ namespace SDL
public static unsafe partial class SDL3
{
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern SDL_Locale* SDL_GetPreferredLocales();
[return: NativeTypeName("const SDL_Locale *const *")]
public static extern SDL_Locale** SDL_GetPreferredLocales(int* count);
}
}

View File

@ -68,11 +68,12 @@ namespace SDL
public static extern SDL_bool SDL_HasMouse();
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("const SDL_MouseID *")]
public static extern SDL_MouseID* SDL_GetMice(int* count);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_GetMouseInstanceName", ExactSpelling = true)]
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_GetMouseNameForID", ExactSpelling = true)]
[return: NativeTypeName("const char *")]
public static extern byte* Unsafe_SDL_GetMouseInstanceName(SDL_MouseID instance_id);
public static extern byte* Unsafe_SDL_GetMouseNameForID(SDL_MouseID instance_id);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern SDL_Window* SDL_GetMouseFocus();

View File

@ -25,17 +25,8 @@
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using static SDL.SDL_ArrayOrder;
using static SDL.SDL_BitmapOrder;
using static SDL.SDL_ChromaLocation;
using static SDL.SDL_ColorPrimaries;
using static SDL.SDL_ColorRange;
using static SDL.SDL_ColorType;
using static SDL.SDL_MatrixCoefficients;
using static SDL.SDL_PackedLayout;
using static SDL.SDL_PackedOrder;
using static SDL.SDL_PixelType;
using static SDL.SDL_TransferCharacteristics;
using static SDL.SDL_Colorspace;
using static SDL.SDL_PixelFormat;
namespace SDL
{
@ -103,78 +94,70 @@ namespace SDL
[NativeTypeName("int")]
public enum SDL_PixelFormat : uint
{
SDL_PIXELFORMAT_UNKNOWN,
SDL_PIXELFORMAT_INDEX1LSB = ((1 << 28) | ((SDL_PIXELTYPE_INDEX1) << 24) | ((SDL_BITMAPORDER_4321) << 20) | ((0) << 16) | ((1) << 8) | ((0) << 0)),
SDL_PIXELFORMAT_INDEX1MSB = ((1 << 28) | ((SDL_PIXELTYPE_INDEX1) << 24) | ((SDL_BITMAPORDER_1234) << 20) | ((0) << 16) | ((1) << 8) | ((0) << 0)),
SDL_PIXELFORMAT_INDEX2LSB = ((1 << 28) | ((SDL_PIXELTYPE_INDEX2) << 24) | ((SDL_BITMAPORDER_4321) << 20) | ((0) << 16) | ((2) << 8) | ((0) << 0)),
SDL_PIXELFORMAT_INDEX2MSB = ((1 << 28) | ((SDL_PIXELTYPE_INDEX2) << 24) | ((SDL_BITMAPORDER_1234) << 20) | ((0) << 16) | ((2) << 8) | ((0) << 0)),
SDL_PIXELFORMAT_INDEX4LSB = ((1 << 28) | ((SDL_PIXELTYPE_INDEX4) << 24) | ((SDL_BITMAPORDER_4321) << 20) | ((0) << 16) | ((4) << 8) | ((0) << 0)),
SDL_PIXELFORMAT_INDEX4MSB = ((1 << 28) | ((SDL_PIXELTYPE_INDEX4) << 24) | ((SDL_BITMAPORDER_1234) << 20) | ((0) << 16) | ((4) << 8) | ((0) << 0)),
SDL_PIXELFORMAT_INDEX8 = ((1 << 28) | ((SDL_PIXELTYPE_INDEX8) << 24) | ((0) << 20) | ((0) << 16) | ((8) << 8) | ((1) << 0)),
SDL_PIXELFORMAT_RGB332 = ((1 << 28) | ((SDL_PIXELTYPE_PACKED8) << 24) | ((SDL_PACKEDORDER_XRGB) << 20) | ((SDL_PACKEDLAYOUT_332) << 16) | ((8) << 8) | ((1) << 0)),
SDL_PIXELFORMAT_XRGB4444 = ((1 << 28) | ((SDL_PIXELTYPE_PACKED16) << 24) | ((SDL_PACKEDORDER_XRGB) << 20) | ((SDL_PACKEDLAYOUT_4444) << 16) | ((12) << 8) | ((2) << 0)),
SDL_PIXELFORMAT_XBGR4444 = ((1 << 28) | ((SDL_PIXELTYPE_PACKED16) << 24) | ((SDL_PACKEDORDER_XBGR) << 20) | ((SDL_PACKEDLAYOUT_4444) << 16) | ((12) << 8) | ((2) << 0)),
SDL_PIXELFORMAT_XRGB1555 = ((1 << 28) | ((SDL_PIXELTYPE_PACKED16) << 24) | ((SDL_PACKEDORDER_XRGB) << 20) | ((SDL_PACKEDLAYOUT_1555) << 16) | ((15) << 8) | ((2) << 0)),
SDL_PIXELFORMAT_XBGR1555 = ((1 << 28) | ((SDL_PIXELTYPE_PACKED16) << 24) | ((SDL_PACKEDORDER_XBGR) << 20) | ((SDL_PACKEDLAYOUT_1555) << 16) | ((15) << 8) | ((2) << 0)),
SDL_PIXELFORMAT_ARGB4444 = ((1 << 28) | ((SDL_PIXELTYPE_PACKED16) << 24) | ((SDL_PACKEDORDER_ARGB) << 20) | ((SDL_PACKEDLAYOUT_4444) << 16) | ((16) << 8) | ((2) << 0)),
SDL_PIXELFORMAT_RGBA4444 = ((1 << 28) | ((SDL_PIXELTYPE_PACKED16) << 24) | ((SDL_PACKEDORDER_RGBA) << 20) | ((SDL_PACKEDLAYOUT_4444) << 16) | ((16) << 8) | ((2) << 0)),
SDL_PIXELFORMAT_ABGR4444 = ((1 << 28) | ((SDL_PIXELTYPE_PACKED16) << 24) | ((SDL_PACKEDORDER_ABGR) << 20) | ((SDL_PACKEDLAYOUT_4444) << 16) | ((16) << 8) | ((2) << 0)),
SDL_PIXELFORMAT_BGRA4444 = ((1 << 28) | ((SDL_PIXELTYPE_PACKED16) << 24) | ((SDL_PACKEDORDER_BGRA) << 20) | ((SDL_PACKEDLAYOUT_4444) << 16) | ((16) << 8) | ((2) << 0)),
SDL_PIXELFORMAT_ARGB1555 = ((1 << 28) | ((SDL_PIXELTYPE_PACKED16) << 24) | ((SDL_PACKEDORDER_ARGB) << 20) | ((SDL_PACKEDLAYOUT_1555) << 16) | ((16) << 8) | ((2) << 0)),
SDL_PIXELFORMAT_RGBA5551 = ((1 << 28) | ((SDL_PIXELTYPE_PACKED16) << 24) | ((SDL_PACKEDORDER_RGBA) << 20) | ((SDL_PACKEDLAYOUT_5551) << 16) | ((16) << 8) | ((2) << 0)),
SDL_PIXELFORMAT_ABGR1555 = ((1 << 28) | ((SDL_PIXELTYPE_PACKED16) << 24) | ((SDL_PACKEDORDER_ABGR) << 20) | ((SDL_PACKEDLAYOUT_1555) << 16) | ((16) << 8) | ((2) << 0)),
SDL_PIXELFORMAT_BGRA5551 = ((1 << 28) | ((SDL_PIXELTYPE_PACKED16) << 24) | ((SDL_PACKEDORDER_BGRA) << 20) | ((SDL_PACKEDLAYOUT_5551) << 16) | ((16) << 8) | ((2) << 0)),
SDL_PIXELFORMAT_RGB565 = ((1 << 28) | ((SDL_PIXELTYPE_PACKED16) << 24) | ((SDL_PACKEDORDER_XRGB) << 20) | ((SDL_PACKEDLAYOUT_565) << 16) | ((16) << 8) | ((2) << 0)),
SDL_PIXELFORMAT_BGR565 = ((1 << 28) | ((SDL_PIXELTYPE_PACKED16) << 24) | ((SDL_PACKEDORDER_XBGR) << 20) | ((SDL_PACKEDLAYOUT_565) << 16) | ((16) << 8) | ((2) << 0)),
SDL_PIXELFORMAT_RGB24 = ((1 << 28) | ((SDL_PIXELTYPE_ARRAYU8) << 24) | ((SDL_ARRAYORDER_RGB) << 20) | ((0) << 16) | ((24) << 8) | ((3) << 0)),
SDL_PIXELFORMAT_BGR24 = ((1 << 28) | ((SDL_PIXELTYPE_ARRAYU8) << 24) | ((SDL_ARRAYORDER_BGR) << 20) | ((0) << 16) | ((24) << 8) | ((3) << 0)),
SDL_PIXELFORMAT_XRGB8888 = ((1 << 28) | ((SDL_PIXELTYPE_PACKED32) << 24) | ((SDL_PACKEDORDER_XRGB) << 20) | ((SDL_PACKEDLAYOUT_8888) << 16) | ((24) << 8) | ((4) << 0)),
SDL_PIXELFORMAT_RGBX8888 = ((1 << 28) | ((SDL_PIXELTYPE_PACKED32) << 24) | ((SDL_PACKEDORDER_RGBX) << 20) | ((SDL_PACKEDLAYOUT_8888) << 16) | ((24) << 8) | ((4) << 0)),
SDL_PIXELFORMAT_XBGR8888 = ((1 << 28) | ((SDL_PIXELTYPE_PACKED32) << 24) | ((SDL_PACKEDORDER_XBGR) << 20) | ((SDL_PACKEDLAYOUT_8888) << 16) | ((24) << 8) | ((4) << 0)),
SDL_PIXELFORMAT_BGRX8888 = ((1 << 28) | ((SDL_PIXELTYPE_PACKED32) << 24) | ((SDL_PACKEDORDER_BGRX) << 20) | ((SDL_PACKEDLAYOUT_8888) << 16) | ((24) << 8) | ((4) << 0)),
SDL_PIXELFORMAT_ARGB8888 = ((1 << 28) | ((SDL_PIXELTYPE_PACKED32) << 24) | ((SDL_PACKEDORDER_ARGB) << 20) | ((SDL_PACKEDLAYOUT_8888) << 16) | ((32) << 8) | ((4) << 0)),
SDL_PIXELFORMAT_RGBA8888 = ((1 << 28) | ((SDL_PIXELTYPE_PACKED32) << 24) | ((SDL_PACKEDORDER_RGBA) << 20) | ((SDL_PACKEDLAYOUT_8888) << 16) | ((32) << 8) | ((4) << 0)),
SDL_PIXELFORMAT_ABGR8888 = ((1 << 28) | ((SDL_PIXELTYPE_PACKED32) << 24) | ((SDL_PACKEDORDER_ABGR) << 20) | ((SDL_PACKEDLAYOUT_8888) << 16) | ((32) << 8) | ((4) << 0)),
SDL_PIXELFORMAT_BGRA8888 = ((1 << 28) | ((SDL_PIXELTYPE_PACKED32) << 24) | ((SDL_PACKEDORDER_BGRA) << 20) | ((SDL_PACKEDLAYOUT_8888) << 16) | ((32) << 8) | ((4) << 0)),
SDL_PIXELFORMAT_XRGB2101010 = ((1 << 28) | ((SDL_PIXELTYPE_PACKED32) << 24) | ((SDL_PACKEDORDER_XRGB) << 20) | ((SDL_PACKEDLAYOUT_2101010) << 16) | ((32) << 8) | ((4) << 0)),
SDL_PIXELFORMAT_XBGR2101010 = ((1 << 28) | ((SDL_PIXELTYPE_PACKED32) << 24) | ((SDL_PACKEDORDER_XBGR) << 20) | ((SDL_PACKEDLAYOUT_2101010) << 16) | ((32) << 8) | ((4) << 0)),
SDL_PIXELFORMAT_ARGB2101010 = ((1 << 28) | ((SDL_PIXELTYPE_PACKED32) << 24) | ((SDL_PACKEDORDER_ARGB) << 20) | ((SDL_PACKEDLAYOUT_2101010) << 16) | ((32) << 8) | ((4) << 0)),
SDL_PIXELFORMAT_ABGR2101010 = ((1 << 28) | ((SDL_PIXELTYPE_PACKED32) << 24) | ((SDL_PACKEDORDER_ABGR) << 20) | ((SDL_PACKEDLAYOUT_2101010) << 16) | ((32) << 8) | ((4) << 0)),
SDL_PIXELFORMAT_RGB48 = ((1 << 28) | ((SDL_PIXELTYPE_ARRAYU16) << 24) | ((SDL_ARRAYORDER_RGB) << 20) | ((0) << 16) | ((48) << 8) | ((6) << 0)),
SDL_PIXELFORMAT_BGR48 = ((1 << 28) | ((SDL_PIXELTYPE_ARRAYU16) << 24) | ((SDL_ARRAYORDER_BGR) << 20) | ((0) << 16) | ((48) << 8) | ((6) << 0)),
SDL_PIXELFORMAT_RGBA64 = ((1 << 28) | ((SDL_PIXELTYPE_ARRAYU16) << 24) | ((SDL_ARRAYORDER_RGBA) << 20) | ((0) << 16) | ((64) << 8) | ((8) << 0)),
SDL_PIXELFORMAT_ARGB64 = ((1 << 28) | ((SDL_PIXELTYPE_ARRAYU16) << 24) | ((SDL_ARRAYORDER_ARGB) << 20) | ((0) << 16) | ((64) << 8) | ((8) << 0)),
SDL_PIXELFORMAT_BGRA64 = ((1 << 28) | ((SDL_PIXELTYPE_ARRAYU16) << 24) | ((SDL_ARRAYORDER_BGRA) << 20) | ((0) << 16) | ((64) << 8) | ((8) << 0)),
SDL_PIXELFORMAT_ABGR64 = ((1 << 28) | ((SDL_PIXELTYPE_ARRAYU16) << 24) | ((SDL_ARRAYORDER_ABGR) << 20) | ((0) << 16) | ((64) << 8) | ((8) << 0)),
SDL_PIXELFORMAT_RGB48_FLOAT = ((1 << 28) | ((SDL_PIXELTYPE_ARRAYF16) << 24) | ((SDL_ARRAYORDER_RGB) << 20) | ((0) << 16) | ((48) << 8) | ((6) << 0)),
SDL_PIXELFORMAT_BGR48_FLOAT = ((1 << 28) | ((SDL_PIXELTYPE_ARRAYF16) << 24) | ((SDL_ARRAYORDER_BGR) << 20) | ((0) << 16) | ((48) << 8) | ((6) << 0)),
SDL_PIXELFORMAT_RGBA64_FLOAT = ((1 << 28) | ((SDL_PIXELTYPE_ARRAYF16) << 24) | ((SDL_ARRAYORDER_RGBA) << 20) | ((0) << 16) | ((64) << 8) | ((8) << 0)),
SDL_PIXELFORMAT_ARGB64_FLOAT = ((1 << 28) | ((SDL_PIXELTYPE_ARRAYF16) << 24) | ((SDL_ARRAYORDER_ARGB) << 20) | ((0) << 16) | ((64) << 8) | ((8) << 0)),
SDL_PIXELFORMAT_BGRA64_FLOAT = ((1 << 28) | ((SDL_PIXELTYPE_ARRAYF16) << 24) | ((SDL_ARRAYORDER_BGRA) << 20) | ((0) << 16) | ((64) << 8) | ((8) << 0)),
SDL_PIXELFORMAT_ABGR64_FLOAT = ((1 << 28) | ((SDL_PIXELTYPE_ARRAYF16) << 24) | ((SDL_ARRAYORDER_ABGR) << 20) | ((0) << 16) | ((64) << 8) | ((8) << 0)),
SDL_PIXELFORMAT_RGB96_FLOAT = ((1 << 28) | ((SDL_PIXELTYPE_ARRAYF32) << 24) | ((SDL_ARRAYORDER_RGB) << 20) | ((0) << 16) | ((96) << 8) | ((12) << 0)),
SDL_PIXELFORMAT_BGR96_FLOAT = ((1 << 28) | ((SDL_PIXELTYPE_ARRAYF32) << 24) | ((SDL_ARRAYORDER_BGR) << 20) | ((0) << 16) | ((96) << 8) | ((12) << 0)),
SDL_PIXELFORMAT_RGBA128_FLOAT = ((1 << 28) | ((SDL_PIXELTYPE_ARRAYF32) << 24) | ((SDL_ARRAYORDER_RGBA) << 20) | ((0) << 16) | ((128) << 8) | ((16) << 0)),
SDL_PIXELFORMAT_ARGB128_FLOAT = ((1 << 28) | ((SDL_PIXELTYPE_ARRAYF32) << 24) | ((SDL_ARRAYORDER_ARGB) << 20) | ((0) << 16) | ((128) << 8) | ((16) << 0)),
SDL_PIXELFORMAT_BGRA128_FLOAT = ((1 << 28) | ((SDL_PIXELTYPE_ARRAYF32) << 24) | ((SDL_ARRAYORDER_BGRA) << 20) | ((0) << 16) | ((128) << 8) | ((16) << 0)),
SDL_PIXELFORMAT_ABGR128_FLOAT = ((1 << 28) | ((SDL_PIXELTYPE_ARRAYF32) << 24) | ((SDL_ARRAYORDER_ABGR) << 20) | ((0) << 16) | ((128) << 8) | ((16) << 0)),
SDL_PIXELFORMAT_RGBA32 = SDL_PIXELFORMAT_ABGR8888,
SDL_PIXELFORMAT_ARGB32 = SDL_PIXELFORMAT_BGRA8888,
SDL_PIXELFORMAT_BGRA32 = SDL_PIXELFORMAT_ARGB8888,
SDL_PIXELFORMAT_ABGR32 = SDL_PIXELFORMAT_RGBA8888,
SDL_PIXELFORMAT_RGBX32 = SDL_PIXELFORMAT_XBGR8888,
SDL_PIXELFORMAT_XRGB32 = SDL_PIXELFORMAT_BGRX8888,
SDL_PIXELFORMAT_BGRX32 = SDL_PIXELFORMAT_XRGB8888,
SDL_PIXELFORMAT_XBGR32 = SDL_PIXELFORMAT_RGBX8888,
SDL_PIXELFORMAT_YV12 = (unchecked(((uint)((byte)('Y')) << 0) | ((uint)((byte)('V')) << 8) | ((uint)((byte)('1')) << 16) | ((uint)((byte)('2')) << 24))),
SDL_PIXELFORMAT_IYUV = (unchecked(((uint)((byte)('I')) << 0) | ((uint)((byte)('Y')) << 8) | ((uint)((byte)('U')) << 16) | ((uint)((byte)('V')) << 24))),
SDL_PIXELFORMAT_YUY2 = (unchecked(((uint)((byte)('Y')) << 0) | ((uint)((byte)('U')) << 8) | ((uint)((byte)('Y')) << 16) | ((uint)((byte)('2')) << 24))),
SDL_PIXELFORMAT_UYVY = (unchecked(((uint)((byte)('U')) << 0) | ((uint)((byte)('Y')) << 8) | ((uint)((byte)('V')) << 16) | ((uint)((byte)('Y')) << 24))),
SDL_PIXELFORMAT_YVYU = (unchecked(((uint)((byte)('Y')) << 0) | ((uint)((byte)('V')) << 8) | ((uint)((byte)('Y')) << 16) | ((uint)((byte)('U')) << 24))),
SDL_PIXELFORMAT_NV12 = (unchecked(((uint)((byte)('N')) << 0) | ((uint)((byte)('V')) << 8) | ((uint)((byte)('1')) << 16) | ((uint)((byte)('2')) << 24))),
SDL_PIXELFORMAT_NV21 = (unchecked(((uint)((byte)('N')) << 0) | ((uint)((byte)('V')) << 8) | ((uint)((byte)('2')) << 16) | ((uint)((byte)('1')) << 24))),
SDL_PIXELFORMAT_P010 = (unchecked(((uint)((byte)('P')) << 0) | ((uint)((byte)('0')) << 8) | ((uint)((byte)('1')) << 16) | ((uint)((byte)('0')) << 24))),
SDL_PIXELFORMAT_EXTERNAL_OES = (unchecked(((uint)((byte)('O')) << 0) | ((uint)((byte)('E')) << 8) | ((uint)((byte)('S')) << 16) | ((uint)((byte)(' ')) << 24))),
SDL_PIXELFORMAT_UNKNOWN = 0,
SDL_PIXELFORMAT_INDEX1LSB = 0x11100100U,
SDL_PIXELFORMAT_INDEX1MSB = 0x11200100U,
SDL_PIXELFORMAT_INDEX2LSB = 0x1c100200U,
SDL_PIXELFORMAT_INDEX2MSB = 0x1c200200U,
SDL_PIXELFORMAT_INDEX4LSB = 0x12100400U,
SDL_PIXELFORMAT_INDEX4MSB = 0x12200400U,
SDL_PIXELFORMAT_INDEX8 = 0x13000801U,
SDL_PIXELFORMAT_RGB332 = 0x14110801U,
SDL_PIXELFORMAT_XRGB4444 = 0x15120c02U,
SDL_PIXELFORMAT_XBGR4444 = 0x15520c02U,
SDL_PIXELFORMAT_XRGB1555 = 0x15130f02U,
SDL_PIXELFORMAT_XBGR1555 = 0x15530f02U,
SDL_PIXELFORMAT_ARGB4444 = 0x15321002U,
SDL_PIXELFORMAT_RGBA4444 = 0x15421002U,
SDL_PIXELFORMAT_ABGR4444 = 0x15721002U,
SDL_PIXELFORMAT_BGRA4444 = 0x15821002U,
SDL_PIXELFORMAT_ARGB1555 = 0x15331002U,
SDL_PIXELFORMAT_RGBA5551 = 0x15441002U,
SDL_PIXELFORMAT_ABGR1555 = 0x15731002U,
SDL_PIXELFORMAT_BGRA5551 = 0x15841002U,
SDL_PIXELFORMAT_RGB565 = 0x15151002U,
SDL_PIXELFORMAT_BGR565 = 0x15551002U,
SDL_PIXELFORMAT_RGB24 = 0x17101803U,
SDL_PIXELFORMAT_BGR24 = 0x17401803U,
SDL_PIXELFORMAT_XRGB8888 = 0x16161804U,
SDL_PIXELFORMAT_RGBX8888 = 0x16261804U,
SDL_PIXELFORMAT_XBGR8888 = 0x16561804U,
SDL_PIXELFORMAT_BGRX8888 = 0x16661804U,
SDL_PIXELFORMAT_ARGB8888 = 0x16362004U,
SDL_PIXELFORMAT_RGBA8888 = 0x16462004U,
SDL_PIXELFORMAT_ABGR8888 = 0x16762004U,
SDL_PIXELFORMAT_BGRA8888 = 0x16862004U,
SDL_PIXELFORMAT_XRGB2101010 = 0x16172004U,
SDL_PIXELFORMAT_XBGR2101010 = 0x16572004U,
SDL_PIXELFORMAT_ARGB2101010 = 0x16372004U,
SDL_PIXELFORMAT_ABGR2101010 = 0x16772004U,
SDL_PIXELFORMAT_RGB48 = 0x18103006U,
SDL_PIXELFORMAT_BGR48 = 0x18403006U,
SDL_PIXELFORMAT_RGBA64 = 0x18204008U,
SDL_PIXELFORMAT_ARGB64 = 0x18304008U,
SDL_PIXELFORMAT_BGRA64 = 0x18504008U,
SDL_PIXELFORMAT_ABGR64 = 0x18604008U,
SDL_PIXELFORMAT_RGB48_FLOAT = 0x1a103006U,
SDL_PIXELFORMAT_BGR48_FLOAT = 0x1a403006U,
SDL_PIXELFORMAT_RGBA64_FLOAT = 0x1a204008U,
SDL_PIXELFORMAT_ARGB64_FLOAT = 0x1a304008U,
SDL_PIXELFORMAT_BGRA64_FLOAT = 0x1a504008U,
SDL_PIXELFORMAT_ABGR64_FLOAT = 0x1a604008U,
SDL_PIXELFORMAT_RGB96_FLOAT = 0x1b10600cU,
SDL_PIXELFORMAT_BGR96_FLOAT = 0x1b40600cU,
SDL_PIXELFORMAT_RGBA128_FLOAT = 0x1b208010U,
SDL_PIXELFORMAT_ARGB128_FLOAT = 0x1b308010U,
SDL_PIXELFORMAT_BGRA128_FLOAT = 0x1b508010U,
SDL_PIXELFORMAT_ABGR128_FLOAT = 0x1b608010U,
SDL_PIXELFORMAT_YV12 = 0x32315659U,
SDL_PIXELFORMAT_IYUV = 0x56555949U,
SDL_PIXELFORMAT_YUY2 = 0x32595559U,
SDL_PIXELFORMAT_UYVY = 0x59565955U,
SDL_PIXELFORMAT_YVYU = 0x55595659U,
SDL_PIXELFORMAT_NV12 = 0x3231564eU,
SDL_PIXELFORMAT_NV21 = 0x3132564eU,
SDL_PIXELFORMAT_P010 = 0x30313050U,
SDL_PIXELFORMAT_EXTERNAL_OES = 0x2053454fU,
}
public enum SDL_ColorType
@ -262,19 +245,17 @@ namespace SDL
[NativeTypeName("int")]
public enum SDL_Colorspace : uint
{
SDL_COLORSPACE_UNKNOWN,
SDL_COLORSPACE_SRGB = (unchecked(((uint)(SDL_COLOR_TYPE_RGB) << 28) | ((uint)(SDL_COLOR_RANGE_FULL) << 24) | ((uint)(SDL_CHROMA_LOCATION_NONE) << 20) | ((uint)(SDL_COLOR_PRIMARIES_BT709) << 10) | ((uint)(SDL_TRANSFER_CHARACTERISTICS_SRGB) << 5) | ((uint)(SDL_MATRIX_COEFFICIENTS_IDENTITY) << 0))),
SDL_COLORSPACE_SRGB_LINEAR = (unchecked(((uint)(SDL_COLOR_TYPE_RGB) << 28) | ((uint)(SDL_COLOR_RANGE_FULL) << 24) | ((uint)(SDL_CHROMA_LOCATION_NONE) << 20) | ((uint)(SDL_COLOR_PRIMARIES_BT709) << 10) | ((uint)(SDL_TRANSFER_CHARACTERISTICS_LINEAR) << 5) | ((uint)(SDL_MATRIX_COEFFICIENTS_IDENTITY) << 0))),
SDL_COLORSPACE_HDR10 = (unchecked(((uint)(SDL_COLOR_TYPE_RGB) << 28) | ((uint)(SDL_COLOR_RANGE_FULL) << 24) | ((uint)(SDL_CHROMA_LOCATION_NONE) << 20) | ((uint)(SDL_COLOR_PRIMARIES_BT2020) << 10) | ((uint)(SDL_TRANSFER_CHARACTERISTICS_PQ) << 5) | ((uint)(SDL_MATRIX_COEFFICIENTS_IDENTITY) << 0))),
SDL_COLORSPACE_JPEG = (unchecked(((uint)(SDL_COLOR_TYPE_YCBCR) << 28) | ((uint)(SDL_COLOR_RANGE_FULL) << 24) | ((uint)(SDL_CHROMA_LOCATION_NONE) << 20) | ((uint)(SDL_COLOR_PRIMARIES_BT709) << 10) | ((uint)(SDL_TRANSFER_CHARACTERISTICS_BT601) << 5) | ((uint)(SDL_MATRIX_COEFFICIENTS_BT601) << 0))),
SDL_COLORSPACE_BT601_LIMITED = (unchecked(((uint)(SDL_COLOR_TYPE_YCBCR) << 28) | ((uint)(SDL_COLOR_RANGE_LIMITED) << 24) | ((uint)(SDL_CHROMA_LOCATION_LEFT) << 20) | ((uint)(SDL_COLOR_PRIMARIES_BT601) << 10) | ((uint)(SDL_TRANSFER_CHARACTERISTICS_BT601) << 5) | ((uint)(SDL_MATRIX_COEFFICIENTS_BT601) << 0))),
SDL_COLORSPACE_BT601_FULL = (unchecked(((uint)(SDL_COLOR_TYPE_YCBCR) << 28) | ((uint)(SDL_COLOR_RANGE_FULL) << 24) | ((uint)(SDL_CHROMA_LOCATION_LEFT) << 20) | ((uint)(SDL_COLOR_PRIMARIES_BT601) << 10) | ((uint)(SDL_TRANSFER_CHARACTERISTICS_BT601) << 5) | ((uint)(SDL_MATRIX_COEFFICIENTS_BT601) << 0))),
SDL_COLORSPACE_BT709_LIMITED = (unchecked(((uint)(SDL_COLOR_TYPE_YCBCR) << 28) | ((uint)(SDL_COLOR_RANGE_LIMITED) << 24) | ((uint)(SDL_CHROMA_LOCATION_LEFT) << 20) | ((uint)(SDL_COLOR_PRIMARIES_BT709) << 10) | ((uint)(SDL_TRANSFER_CHARACTERISTICS_BT709) << 5) | ((uint)(SDL_MATRIX_COEFFICIENTS_BT709) << 0))),
SDL_COLORSPACE_BT709_FULL = (unchecked(((uint)(SDL_COLOR_TYPE_YCBCR) << 28) | ((uint)(SDL_COLOR_RANGE_FULL) << 24) | ((uint)(SDL_CHROMA_LOCATION_LEFT) << 20) | ((uint)(SDL_COLOR_PRIMARIES_BT709) << 10) | ((uint)(SDL_TRANSFER_CHARACTERISTICS_BT709) << 5) | ((uint)(SDL_MATRIX_COEFFICIENTS_BT709) << 0))),
SDL_COLORSPACE_BT2020_LIMITED = (unchecked(((uint)(SDL_COLOR_TYPE_YCBCR) << 28) | ((uint)(SDL_COLOR_RANGE_LIMITED) << 24) | ((uint)(SDL_CHROMA_LOCATION_LEFT) << 20) | ((uint)(SDL_COLOR_PRIMARIES_BT2020) << 10) | ((uint)(SDL_TRANSFER_CHARACTERISTICS_PQ) << 5) | ((uint)(SDL_MATRIX_COEFFICIENTS_BT2020_NCL) << 0))),
SDL_COLORSPACE_BT2020_FULL = (unchecked(((uint)(SDL_COLOR_TYPE_YCBCR) << 28) | ((uint)(SDL_COLOR_RANGE_FULL) << 24) | ((uint)(SDL_CHROMA_LOCATION_LEFT) << 20) | ((uint)(SDL_COLOR_PRIMARIES_BT2020) << 10) | ((uint)(SDL_TRANSFER_CHARACTERISTICS_PQ) << 5) | ((uint)(SDL_MATRIX_COEFFICIENTS_BT2020_NCL) << 0))),
SDL_COLORSPACE_RGB_DEFAULT = SDL_COLORSPACE_SRGB,
SDL_COLORSPACE_YUV_DEFAULT = SDL_COLORSPACE_JPEG,
SDL_COLORSPACE_UNKNOWN = 0,
SDL_COLORSPACE_SRGB = 0x120005a0U,
SDL_COLORSPACE_SRGB_LINEAR = 0x12000500U,
SDL_COLORSPACE_HDR10 = 0x12002600U,
SDL_COLORSPACE_JPEG = 0x220004c6U,
SDL_COLORSPACE_BT601_LIMITED = 0x211018c6U,
SDL_COLORSPACE_BT601_FULL = 0x221018c6U,
SDL_COLORSPACE_BT709_LIMITED = 0x21100421U,
SDL_COLORSPACE_BT709_FULL = 0x22100421U,
SDL_COLORSPACE_BT2020_LIMITED = 0x21102609U,
SDL_COLORSPACE_BT2020_FULL = 0x22102609U,
}
public partial struct SDL_Color
@ -415,5 +396,35 @@ namespace SDL
[NativeTypeName("#define SDL_ALPHA_TRANSPARENT 0")]
public const int SDL_ALPHA_TRANSPARENT = 0;
[NativeTypeName("#define SDL_PIXELFORMAT_RGBA32 SDL_PIXELFORMAT_ABGR8888")]
public const SDL_PixelFormat SDL_PIXELFORMAT_RGBA32 = SDL_PIXELFORMAT_ABGR8888;
[NativeTypeName("#define SDL_PIXELFORMAT_ARGB32 SDL_PIXELFORMAT_BGRA8888")]
public const SDL_PixelFormat SDL_PIXELFORMAT_ARGB32 = SDL_PIXELFORMAT_BGRA8888;
[NativeTypeName("#define SDL_PIXELFORMAT_BGRA32 SDL_PIXELFORMAT_ARGB8888")]
public const SDL_PixelFormat SDL_PIXELFORMAT_BGRA32 = SDL_PIXELFORMAT_ARGB8888;
[NativeTypeName("#define SDL_PIXELFORMAT_ABGR32 SDL_PIXELFORMAT_RGBA8888")]
public const SDL_PixelFormat SDL_PIXELFORMAT_ABGR32 = SDL_PIXELFORMAT_RGBA8888;
[NativeTypeName("#define SDL_PIXELFORMAT_RGBX32 SDL_PIXELFORMAT_XBGR8888")]
public const SDL_PixelFormat SDL_PIXELFORMAT_RGBX32 = SDL_PIXELFORMAT_XBGR8888;
[NativeTypeName("#define SDL_PIXELFORMAT_XRGB32 SDL_PIXELFORMAT_BGRX8888")]
public const SDL_PixelFormat SDL_PIXELFORMAT_XRGB32 = SDL_PIXELFORMAT_BGRX8888;
[NativeTypeName("#define SDL_PIXELFORMAT_BGRX32 SDL_PIXELFORMAT_XRGB8888")]
public const SDL_PixelFormat SDL_PIXELFORMAT_BGRX32 = SDL_PIXELFORMAT_XRGB8888;
[NativeTypeName("#define SDL_PIXELFORMAT_XBGR32 SDL_PIXELFORMAT_RGBX8888")]
public const SDL_PixelFormat SDL_PIXELFORMAT_XBGR32 = SDL_PIXELFORMAT_RGBX8888;
[NativeTypeName("#define SDL_COLORSPACE_RGB_DEFAULT SDL_COLORSPACE_SRGB")]
public const SDL_Colorspace SDL_COLORSPACE_RGB_DEFAULT = SDL_COLORSPACE_SRGB;
[NativeTypeName("#define SDL_COLORSPACE_YUV_DEFAULT SDL_COLORSPACE_JPEG")]
public const SDL_Colorspace SDL_COLORSPACE_YUV_DEFAULT = SDL_COLORSPACE_JPEG;
}
}

View File

@ -56,10 +56,10 @@ namespace SDL
public static extern void SDL_UnlockProperties(SDL_PropertiesID props);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern int SDL_SetPropertyWithCleanup(SDL_PropertiesID props, [NativeTypeName("const char *")] byte* name, [NativeTypeName("void*")] IntPtr value, [NativeTypeName("SDL_CleanupPropertyCallback")] delegate* unmanaged[Cdecl]<IntPtr, IntPtr, void> cleanup, [NativeTypeName("void*")] IntPtr userdata);
public static extern int SDL_SetPointerPropertyWithCleanup(SDL_PropertiesID props, [NativeTypeName("const char *")] byte* name, [NativeTypeName("void*")] IntPtr value, [NativeTypeName("SDL_CleanupPropertyCallback")] delegate* unmanaged[Cdecl]<IntPtr, IntPtr, void> cleanup, [NativeTypeName("void*")] IntPtr userdata);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern int SDL_SetProperty(SDL_PropertiesID props, [NativeTypeName("const char *")] byte* name, [NativeTypeName("void*")] IntPtr value);
public static extern int SDL_SetPointerProperty(SDL_PropertiesID props, [NativeTypeName("const char *")] byte* name, [NativeTypeName("void*")] IntPtr value);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern int SDL_SetStringProperty(SDL_PropertiesID props, [NativeTypeName("const char *")] byte* name, [NativeTypeName("const char *")] byte* value);
@ -81,7 +81,7 @@ namespace SDL
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("void*")]
public static extern IntPtr SDL_GetProperty(SDL_PropertiesID props, [NativeTypeName("const char *")] byte* name, [NativeTypeName("void*")] IntPtr default_value);
public static extern IntPtr SDL_GetPointerProperty(SDL_PropertiesID props, [NativeTypeName("const char *")] byte* name, [NativeTypeName("void*")] IntPtr default_value);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_GetStringProperty", ExactSpelling = true)]
[return: NativeTypeName("const char *")]

View File

@ -46,23 +46,24 @@ namespace SDL
public static unsafe partial class SDL3
{
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("const SDL_SensorID *")]
public static extern SDL_SensorID* SDL_GetSensors(int* count);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_GetSensorInstanceName", ExactSpelling = true)]
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_GetSensorNameForID", ExactSpelling = true)]
[return: NativeTypeName("const char *")]
public static extern byte* Unsafe_SDL_GetSensorInstanceName(SDL_SensorID instance_id);
public static extern byte* Unsafe_SDL_GetSensorNameForID(SDL_SensorID instance_id);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern SDL_SensorType SDL_GetSensorInstanceType(SDL_SensorID instance_id);
public static extern SDL_SensorType SDL_GetSensorTypeForID(SDL_SensorID instance_id);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern int SDL_GetSensorInstanceNonPortableType(SDL_SensorID instance_id);
public static extern int SDL_GetSensorNonPortableTypeForID(SDL_SensorID instance_id);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern SDL_Sensor* SDL_OpenSensor(SDL_SensorID instance_id);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern SDL_Sensor* SDL_GetSensorFromInstanceID(SDL_SensorID instance_id);
public static extern SDL_Sensor* SDL_GetSensorFromID(SDL_SensorID instance_id);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern SDL_PropertiesID SDL_GetSensorProperties(SDL_Sensor* sensor);
@ -78,7 +79,7 @@ namespace SDL
public static extern int SDL_GetSensorNonPortableType(SDL_Sensor* sensor);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern SDL_SensorID SDL_GetSensorInstanceID(SDL_Sensor* sensor);
public static extern SDL_SensorID SDL_GetSensorID(SDL_Sensor* sensor);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern int SDL_GetSensorData(SDL_Sensor* sensor, float* data, int num_values);

View File

@ -114,7 +114,7 @@ namespace SDL
public static extern ulong SDL_GetStorageSpaceRemaining(SDL_Storage* storage);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("char **")]
[return: NativeTypeName("const char *const *")]
public static extern byte** SDL_GlobStorageDirectory(SDL_Storage* storage, [NativeTypeName("const char *")] byte* path, [NativeTypeName("const char *")] byte* pattern, SDL_GlobFlags flags, int* count);
}
}

View File

@ -86,6 +86,9 @@ namespace SDL
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern SDL_Colorspace SDL_GetSurfaceColorspace(SDL_Surface* surface);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern SDL_Palette* SDL_CreateSurfacePalette(SDL_Surface* surface);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern int SDL_SetSurfacePalette(SDL_Surface* surface, SDL_Palette* palette);
@ -159,7 +162,7 @@ namespace SDL
public static extern SDL_Surface* SDL_ConvertSurface(SDL_Surface* surface, SDL_PixelFormat format);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern SDL_Surface* SDL_ConvertSurfaceAndColorspace(SDL_Surface* surface, SDL_PixelFormat format, [NativeTypeName("const SDL_Palette *")] SDL_Palette* palette, SDL_Colorspace colorspace, SDL_PropertiesID props);
public static extern SDL_Surface* SDL_ConvertSurfaceAndColorspace(SDL_Surface* surface, SDL_PixelFormat format, SDL_Palette* palette, SDL_Colorspace colorspace, SDL_PropertiesID props);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern int SDL_ConvertPixels(int width, int height, SDL_PixelFormat src_format, [NativeTypeName("const void *")] IntPtr src, int src_pitch, SDL_PixelFormat dst_format, [NativeTypeName("void*")] IntPtr dst, int dst_pitch);
@ -168,7 +171,13 @@ namespace SDL
public static extern int SDL_ConvertPixelsAndColorspace(int width, int height, SDL_PixelFormat src_format, SDL_Colorspace src_colorspace, SDL_PropertiesID src_properties, [NativeTypeName("const void *")] IntPtr src, int src_pitch, SDL_PixelFormat dst_format, SDL_Colorspace dst_colorspace, SDL_PropertiesID dst_properties, [NativeTypeName("void*")] IntPtr dst, int dst_pitch);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern int SDL_PremultiplyAlpha(int width, int height, SDL_PixelFormat src_format, [NativeTypeName("const void *")] IntPtr src, int src_pitch, SDL_PixelFormat dst_format, [NativeTypeName("void*")] IntPtr dst, int dst_pitch);
public static extern int SDL_PremultiplyAlpha(int width, int height, SDL_PixelFormat src_format, [NativeTypeName("const void *")] IntPtr src, int src_pitch, SDL_PixelFormat dst_format, [NativeTypeName("void*")] IntPtr dst, int dst_pitch, SDL_bool linear);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern int SDL_PremultiplySurfaceAlpha(SDL_Surface* surface, SDL_bool linear);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern int SDL_ClearSurface(SDL_Surface* surface, float r, float g, float b, float a);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern int SDL_FillSurfaceRect(SDL_Surface* dst, [NativeTypeName("const SDL_Rect *")] SDL_Rect* rect, [NativeTypeName("Uint32")] uint color);
@ -202,6 +211,9 @@ namespace SDL
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern int SDL_ReadSurfacePixel(SDL_Surface* surface, int x, int y, [NativeTypeName("Uint8 *")] byte* r, [NativeTypeName("Uint8 *")] byte* g, [NativeTypeName("Uint8 *")] byte* b, [NativeTypeName("Uint8 *")] byte* a);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern int SDL_ReadSurfacePixelFloat(SDL_Surface* surface, int x, int y, float* r, float* g, float* b, float* a);
[NativeTypeName("#define SDL_SURFACE_PREALLOCATED 0x00000001u")]
public const uint SDL_SURFACE_PREALLOCATED = 0x00000001U;

View File

@ -34,12 +34,12 @@ namespace SDL
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("void*")]
[SupportedOSPlatform("Android")]
public static extern IntPtr SDL_AndroidGetJNIEnv();
public static extern IntPtr SDL_GetAndroidJNIEnv();
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("void*")]
[SupportedOSPlatform("Android")]
public static extern IntPtr SDL_AndroidGetActivity();
public static extern IntPtr SDL_GetAndroidActivity();
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[SupportedOSPlatform("Android")]
@ -59,33 +59,39 @@ namespace SDL
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[SupportedOSPlatform("Android")]
public static extern void SDL_AndroidBackButton();
public static extern void SDL_SendAndroidBackButton();
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_AndroidGetInternalStoragePath", ExactSpelling = true)]
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_GetAndroidInternalStoragePath", ExactSpelling = true)]
[return: NativeTypeName("const char *")]
[SupportedOSPlatform("Android")]
public static extern byte* Unsafe_SDL_AndroidGetInternalStoragePath();
public static extern byte* Unsafe_SDL_GetAndroidInternalStoragePath();
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("Uint32")]
[SupportedOSPlatform("Android")]
public static extern int SDL_AndroidGetExternalStorageState([NativeTypeName("Uint32 *")] uint* state);
public static extern uint SDL_GetAndroidExternalStorageState();
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_AndroidGetExternalStoragePath", ExactSpelling = true)]
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_GetAndroidExternalStoragePath", ExactSpelling = true)]
[return: NativeTypeName("const char *")]
[SupportedOSPlatform("Android")]
public static extern byte* Unsafe_SDL_AndroidGetExternalStoragePath();
public static extern byte* Unsafe_SDL_GetAndroidExternalStoragePath();
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_GetAndroidCachePath", ExactSpelling = true)]
[return: NativeTypeName("const char *")]
[SupportedOSPlatform("Android")]
public static extern byte* Unsafe_SDL_GetAndroidCachePath();
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[SupportedOSPlatform("Android")]
public static extern int SDL_AndroidRequestPermission([NativeTypeName("const char *")] byte* permission, [NativeTypeName("SDL_AndroidRequestPermissionCallback")] delegate* unmanaged[Cdecl]<IntPtr, byte*, SDL_bool, void> cb, [NativeTypeName("void*")] IntPtr userdata);
public static extern int SDL_RequestAndroidPermission([NativeTypeName("const char *")] byte* permission, [NativeTypeName("SDL_RequestAndroidPermissionCallback")] delegate* unmanaged[Cdecl]<IntPtr, byte*, SDL_bool, void> cb, [NativeTypeName("void*")] IntPtr userdata);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[SupportedOSPlatform("Android")]
public static extern int SDL_AndroidShowToast([NativeTypeName("const char *")] byte* message, int duration, int gravity, int xoffset, int yoffset);
public static extern int SDL_ShowAndroidToast([NativeTypeName("const char *")] byte* message, int duration, int gravity, int xoffset, int yoffset);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[SupportedOSPlatform("Android")]
public static extern int SDL_AndroidSendMessage([NativeTypeName("Uint32")] uint command, int param1);
public static extern int SDL_SendAndroidMessage([NativeTypeName("Uint32")] uint command, int param1);
[NativeTypeName("#define SDL_ANDROID_EXTERNAL_STORAGE_READ 0x01")]
public const int SDL_ANDROID_EXTERNAL_STORAGE_READ = 0x01;

View File

@ -32,10 +32,10 @@ namespace SDL
{
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[SupportedOSPlatform("Linux")]
public static extern int SDL_LinuxSetThreadPriority([NativeTypeName("Sint64")] long threadID, int priority);
public static extern int SDL_SetLinuxThreadPriority([NativeTypeName("Sint64")] long threadID, int priority);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[SupportedOSPlatform("Linux")]
public static extern int SDL_LinuxSetThreadPriorityAndPolicy([NativeTypeName("Sint64")] long threadID, int sdlPriority, int schedPolicy);
public static extern int SDL_SetLinuxThreadPriorityAndPolicy([NativeTypeName("Sint64")] long threadID, int sdlPriority, int schedPolicy);
}
}

View File

@ -46,13 +46,13 @@ namespace SDL
public static unsafe partial class SDL3
{
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_WinRTGetFSPath", ExactSpelling = true)]
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_GetWinRTFSPath", ExactSpelling = true)]
[return: NativeTypeName("const char *")]
[SupportedOSPlatform("Windows")]
public static extern byte* Unsafe_SDL_WinRTGetFSPath(SDL_WinRT_Path pathType);
public static extern byte* Unsafe_SDL_GetWinRTFSPath(SDL_WinRT_Path pathType);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[SupportedOSPlatform("Windows")]
public static extern SDL_WinRT_DeviceFamily SDL_WinRTGetDeviceFamily();
public static extern SDL_WinRT_DeviceFamily SDL_GetWinRTDeviceFamily();
}
}

View File

@ -45,18 +45,18 @@ namespace SDL
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[SupportedOSPlatform("Windows")]
public static extern int SDL_Direct3D9GetAdapterIndex(SDL_DisplayID displayID);
public static extern int SDL_GetDirect3D9AdapterIndex(SDL_DisplayID displayID);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[SupportedOSPlatform("Windows")]
public static extern SDL_bool SDL_DXGIGetOutputInfo(SDL_DisplayID displayID, int* adapterIndex, int* outputIndex);
public static extern int SDL_GetDXGIOutputInfo(SDL_DisplayID displayID, int* adapterIndex, int* outputIndex);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[SupportedOSPlatform("Windows")]
public static extern int SDL_GDKGetTaskQueue([NativeTypeName("XTaskQueueHandle *")] XTaskQueueObject** outTaskQueue);
public static extern int SDL_GetGDKTaskQueue([NativeTypeName("XTaskQueueHandle *")] XTaskQueueObject** outTaskQueue);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[SupportedOSPlatform("Windows")]
public static extern int SDL_GDKGetDefaultUser([NativeTypeName("XUserHandle *")] XUser** outUserHandle);
public static extern int SDL_GetGDKDefaultUser([NativeTypeName("XUserHandle *")] XUser** outUserHandle);
}
}

View File

@ -33,11 +33,11 @@ namespace SDL
{
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[SupportedOSPlatform("iOS")]
public static extern int SDL_iOSSetAnimationCallback(SDL_Window* window, int interval, [NativeTypeName("SDL_iOSAnimationCallback")] delegate* unmanaged[Cdecl]<IntPtr, void> callback, [NativeTypeName("void*")] IntPtr callbackParam);
public static extern int SDL_SetiOSAnimationCallback(SDL_Window* window, int interval, [NativeTypeName("SDL_iOSAnimationCallback")] delegate* unmanaged[Cdecl]<IntPtr, void> callback, [NativeTypeName("void*")] IntPtr callbackParam);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[SupportedOSPlatform("iOS")]
public static extern void SDL_iOSSetEventPump(SDL_bool enabled);
public static extern void SDL_SetiOSEventPump(SDL_bool enabled);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[SupportedOSPlatform("iOS")]

View File

@ -67,15 +67,12 @@ namespace SDL
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void SDL_DetachThread(SDL_Thread* thread);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern SDL_TLSID SDL_CreateTLS();
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("void*")]
public static extern IntPtr SDL_GetTLS(SDL_TLSID id);
public static extern IntPtr SDL_GetTLS(SDL_TLSID* id);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern int SDL_SetTLS(SDL_TLSID id, [NativeTypeName("const void *")] IntPtr value, [NativeTypeName("SDL_TLSDestructorCallback")] delegate* unmanaged[Cdecl]<IntPtr, void> destructor);
public static extern int SDL_SetTLS(SDL_TLSID* id, [NativeTypeName("const void *")] IntPtr value, [NativeTypeName("SDL_TLSDestructorCallback")] delegate* unmanaged[Cdecl]<IntPtr, void> destructor);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void SDL_CleanupTLS();

View File

@ -49,6 +49,7 @@ namespace SDL
public static unsafe partial class SDL3
{
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("const SDL_TouchID *")]
public static extern SDL_TouchID* SDL_GetTouchDevices(int* count);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_GetTouchDeviceName", ExactSpelling = true)]
@ -59,6 +60,7 @@ namespace SDL
public static extern SDL_TouchDeviceType SDL_GetTouchDeviceType(SDL_TouchID touchID);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("const SDL_Finger *const *")]
public static extern SDL_Finger** SDL_GetTouchFingers(SDL_TouchID touchID, int* count);
}
}

View File

@ -35,7 +35,11 @@ namespace SDL
SDL_SYSTEM_THEME_DARK,
}
public partial struct SDL_DisplayMode
public partial struct SDL_DisplayModeData
{
}
public unsafe partial struct SDL_DisplayMode
{
public SDL_DisplayID displayID;
@ -49,8 +53,11 @@ namespace SDL
public float refresh_rate;
[NativeTypeName("void*")]
public IntPtr driverdata;
public int refresh_rate_numerator;
public int refresh_rate_denominator;
public SDL_DisplayModeData* @internal;
}
public enum SDL_DisplayOrientation
@ -167,6 +174,7 @@ namespace SDL
public static extern SDL_SystemTheme SDL_GetSystemTheme();
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("const SDL_DisplayID *")]
public static extern SDL_DisplayID* SDL_GetDisplays(int* count);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
@ -195,7 +203,7 @@ namespace SDL
public static extern float SDL_GetDisplayContentScale(SDL_DisplayID displayID);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("const SDL_DisplayMode **")]
[return: NativeTypeName("const SDL_DisplayMode *const *")]
public static extern SDL_DisplayMode** SDL_GetFullscreenDisplayModes(SDL_DisplayID displayID, int* count);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
@ -233,14 +241,14 @@ namespace SDL
public static extern SDL_DisplayMode* SDL_GetWindowFullscreenMode(SDL_Window* window);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("void*")]
[return: NativeTypeName("const void *")]
public static extern IntPtr SDL_GetWindowICCProfile(SDL_Window* window, [NativeTypeName("size_t *")] nuint* size);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("Uint32")]
public static extern uint SDL_GetWindowPixelFormat(SDL_Window* window);
public static extern SDL_PixelFormat SDL_GetWindowPixelFormat(SDL_Window* window);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("SDL_Window *const *")]
public static extern SDL_Window** SDL_GetWindows(int* count);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
@ -393,7 +401,7 @@ namespace SDL
public static extern int SDL_SetWindowOpacity(SDL_Window* window, float opacity);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern int SDL_GetWindowOpacity(SDL_Window* window, float* out_opacity);
public static extern float SDL_GetWindowOpacity(SDL_Window* window);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern int SDL_SetWindowModalFor(SDL_Window* modal_window, SDL_Window* parent_window);

View File

@ -32,6 +32,10 @@ namespace SDL
{
}
public partial struct VkPhysicalDevice_T
{
}
public partial struct VkSurfaceKHR_T
{
}
@ -61,5 +65,8 @@ namespace SDL
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void SDL_Vulkan_DestroySurface([NativeTypeName("VkInstance")] VkInstance_T* instance, [NativeTypeName("VkSurfaceKHR")] VkSurfaceKHR_T* surface, [NativeTypeName("const struct VkAllocationCallbacks *")] VkAllocationCallbacks* allocator);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern SDL_bool SDL_Vulkan_GetPresentationSupport([NativeTypeName("VkInstance")] VkInstance_T* instance, [NativeTypeName("VkPhysicalDevice")] VkPhysicalDevice_T* physicalDevice, [NativeTypeName("Uint32")] uint queueFamilyIndex);
}
}

View File

@ -9,19 +9,6 @@ namespace SDL
[Typedef]
public enum SDL_AudioDeviceID : UInt32;
[Typedef]
public enum SDL_AudioFormat : UInt16
{
SDL_AUDIO_U8 = (UInt16)SDL3.SDL_AUDIO_U8,
SDL_AUDIO_S8 = (UInt16)SDL3.SDL_AUDIO_S8,
SDL_AUDIO_S16LE = (UInt16)SDL3.SDL_AUDIO_S16LE,
SDL_AUDIO_S16BE = (UInt16)SDL3.SDL_AUDIO_S16BE,
SDL_AUDIO_S32LE = (UInt16)SDL3.SDL_AUDIO_S32LE,
SDL_AUDIO_S32BE = (UInt16)SDL3.SDL_AUDIO_S32BE,
SDL_AUDIO_F32LE = (UInt16)SDL3.SDL_AUDIO_F32LE,
SDL_AUDIO_F32BE = (UInt16)SDL3.SDL_AUDIO_F32BE,
}
public static partial class SDL3
{
[Constant]
@ -60,20 +47,18 @@ namespace SDL
[Macro]
public static int SDL_AUDIO_FRAMESIZE(SDL_AudioSpec x) => SDL_AUDIO_BYTESIZE((x).format) * (x).channels;
[MustDisposeResource]
public static unsafe SDLArray<SDL_AudioDeviceID>? SDL_GetAudioPlaybackDevices()
{
int count;
var array = SDL_GetAudioPlaybackDevices(&count);
return SDLArray.Create(array, count);
return SDLArray.CreatePooled(array, count);
}
[MustDisposeResource]
public static unsafe SDLArray<SDL_AudioDeviceID>? SDL_GetAudioRecordingDevices()
{
int count;
var array = SDL_GetAudioRecordingDevices(&count);
return SDLArray.Create(array, count);
return SDLArray.CreatePooled(array, count);
}
}
}

View File

@ -0,0 +1,6 @@
# Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
# See the LICENCE file in the repository root for full licence text.
# Fix errors with uint -> int conversion
--with-type
SDL_AudioFormat=uint

View File

@ -7,24 +7,22 @@ using JetBrains.Annotations;
namespace SDL
{
[Typedef]
public enum SDL_CameraDeviceID : UInt32;
public enum SDL_CameraID : UInt32;
public static partial class SDL3
{
[MustDisposeResource]
public static unsafe SDLArray<SDL_CameraDeviceID>? SDL_GetCameraDevices()
public static unsafe SDLArray<SDL_CameraID>? SDL_GetCameras()
{
int count;
var array = SDL_GetCameraDevices(&count);
return SDLArray.Create(array, count);
var array = SDL_GetCameras(&count);
return SDLArray.CreatePooled(array, count);
}
[MustDisposeResource]
public static unsafe SDLArray<SDL_CameraSpec>? SDL_GetCameraDeviceSupportedFormats(SDL_CameraDeviceID devid)
public static unsafe SDLPointerArray<SDL_CameraSpec>? SDL_GetCameraSupportedFormats(SDL_CameraID devid)
{
int count;
var array = SDL_GetCameraDeviceSupportedFormats(devid, &count);
return SDLArray.Create(array, count);
var array = SDL_GetCameraSupportedFormats(devid, &count);
return SDLArray.CreatePooled(array, count);
}
}
}

View File

@ -12,28 +12,25 @@ namespace SDL
/// <returns>
/// An array of <see cref="nint"/> that can be passed to <see cref="Marshal.PtrToStringUTF8(System.IntPtr)"/>.
/// </returns>
[MustDisposeResource]
public static unsafe SDLArray<IntPtr>? SDL_GetGamepadMappings()
{
int count;
IntPtr* array = (IntPtr*)SDL_GetGamepadMappings(&count);
return SDLArray.Create(array, count);
return SDLArray.CreatePooled(array, count);
}
[MustDisposeResource]
public static unsafe SDLArray<SDL_JoystickID>? SDL_GetGamepads()
{
int count;
var array = SDL_GetGamepads(&count);
return SDLArray.Create(array, count);
return SDLArray.CreatePooled(array, count);
}
[MustDisposeResource]
public static unsafe SDLPointerArray<SDL_GamepadBinding>? SDL_GetGamepadBindings(SDL_Gamepad* gamepad)
{
int count;
var array = SDL_GetGamepadBindings(gamepad, &count);
return SDLArray.Create(array, count);
return SDLArray.CreatePooled(array, count);
}
}
}

View File

@ -11,12 +11,11 @@ namespace SDL
public static partial class SDL3
{
[MustDisposeResource]
public static unsafe SDLArray<SDL_HapticID>? SDL_GetHaptics()
{
int count;
var array = SDL_GetHaptics(&count);
return SDLArray.Create(array, count);
return SDLArray.CreatePooled(array, count);
}
}
}

View File

@ -11,12 +11,11 @@ namespace SDL
public static partial class SDL3
{
[MustDisposeResource]
public static unsafe SDLArray<SDL_JoystickID>? SDL_GetJoysticks()
{
int count;
var array = SDL_GetJoysticks(&count);
return SDLArray.Create(array, count);
return SDLArray.CreatePooled(array, count);
}
}
}

View File

@ -11,12 +11,11 @@ namespace SDL
public static partial class SDL3
{
[MustDisposeResource]
public static unsafe SDLArray<SDL_KeyboardID>? SDL_GetKeyboards()
{
int count;
var array = SDL_GetKeyboards(&count);
return SDLArray.Create(array, count);
return SDLArray.CreatePooled(array, count);
}
}
}

View File

@ -34,12 +34,11 @@ namespace SDL
[Macro]
public static SDL_MouseButtonFlags SDL_BUTTON(SDLButton button) => (SDL_MouseButtonFlags)(1 << ((int)button - 1));
[MustDisposeResource]
public static unsafe SDLArray<SDL_MouseID>? SDL_GetMice()
{
int count;
var array = SDL_GetMice(&count);
return SDLArray.Create(array, count);
return SDLArray.CreatePooled(array, count);
}
}
}

View File

@ -11,12 +11,11 @@ namespace SDL
public static partial class SDL3
{
[MustDisposeResource]
public static unsafe SDLArray<SDL_SensorID>? SDL_GetSensors()
{
int count;
var array = SDL_GetSensors(&count);
return SDLArray.Create(array, count);
return SDLArray.CreatePooled(array, count);
}
}
}

View File

@ -20,20 +20,18 @@ namespace SDL
[Constant]
public const SDL_TouchID SDL_MOUSE_TOUCHID = unchecked((SDL_TouchID)(-1));
[MustDisposeResource]
public static unsafe SDLArray<SDL_TouchID>? SDL_GetTouchDevices()
{
int count;
var array = SDL_GetTouchDevices(&count);
return SDLArray.Create(array, count);
return SDLArray.CreatePooled(array, count);
}
[MustDisposeResource]
public static unsafe SDLPointerArray<SDL_Finger>? SDL_GetTouchFingers(SDL_TouchID touchID)
{
int count;
var array = SDL_GetTouchFingers(touchID, &count);
return SDLArray.Create(array, count);
return SDLArray.CreatePooled(array, count);
}
}
}

View File

@ -55,28 +55,25 @@ namespace SDL
[Macro]
public static bool SDL_WINDOWPOS_ISCENTERED(int X) => (((X) & 0xFFFF0000) == SDL_WINDOWPOS_CENTERED_MASK);
[MustDisposeResource]
public static unsafe SDLArray<SDL_DisplayID>? SDL_GetDisplays()
{
int count;
var array = SDL_GetDisplays(&count);
return SDLArray.Create(array, count);
return SDLArray.CreatePooled(array, count);
}
[MustDisposeResource]
public static unsafe SDLPointerArray<SDL_DisplayMode>? SDL_GetFullscreenDisplayModes(SDL_DisplayID displayID)
{
int count;
var array = SDL_GetFullscreenDisplayModes(displayID, &count);
return SDLArray.Create(array, count);
return SDLArray.CreatePooled(array, count);
}
[MustDisposeResource]
public static unsafe SDLPointerArray<SDL_Window>? SDL_GetWindows()
{
int count;
var array = SDL_GetWindows(&count);
return SDLArray.Create(array, count);
return SDLArray.CreatePooled(array, count);
}
}
}

View File

@ -6,17 +6,18 @@ using JetBrains.Annotations;
namespace SDL
{
[MustDisposeResource]
public sealed unsafe class SDLArray<T> : IDisposable
where T : unmanaged
{
private readonly T* array;
private readonly bool isPooled;
public readonly int Count;
private bool isDisposed;
internal SDLArray(T* array, int count)
internal SDLArray(T* array, int count, bool isPooled = false)
{
this.array = array;
this.isPooled = isPooled;
Count = count;
}
@ -37,7 +38,9 @@ namespace SDL
return;
isDisposed = true;
SDL3.SDL_free(array);
if (!isPooled)
SDL3.SDL_free(array);
}
}
@ -62,5 +65,23 @@ namespace SDL
return new SDLPointerArray<T>(array, count);
}
internal static SDLArray<T>? CreatePooled<T>(T* array, int count)
where T : unmanaged
{
if (array == null)
return null;
return new SDLArray<T>(array, count, true);
}
internal static SDLPointerArray<T>? CreatePooled<T>(T** array, int count)
where T : unmanaged
{
if (array == null)
return null;
return new SDLPointerArray<T>(array, count, true);
}
}
}

View File

@ -8,17 +8,18 @@ using JetBrains.Annotations;
namespace SDL
{
// T* can't be used as a type parameter, so this has to be a separate class
[MustDisposeResource]
public sealed unsafe class SDLPointerArray<T> : IDisposable
where T : unmanaged
{
private readonly T** array;
private readonly bool isPooled;
public readonly int Count;
private bool isDisposed;
internal SDLPointerArray(T** array, int count)
internal SDLPointerArray(T** array, int count, bool isPooled = false)
{
this.array = array;
this.isPooled = isPooled;
Count = count;
}
@ -40,7 +41,9 @@ namespace SDL
return;
isDisposed = true;
SDL3.SDL_free(array);
if (!isPooled)
SDL3.SDL_free(array);
}
}
}