diff --git a/SDL3-CS/SDL3-CS.csproj b/SDL3-CS/SDL3-CS.csproj index 9ddb845..cff8be8 100644 --- a/SDL3-CS/SDL3-CS.csproj +++ b/SDL3-CS/SDL3-CS.csproj @@ -12,4 +12,8 @@ + + + + diff --git a/SDL3-CS/SDL3/SDL_audio.cs b/SDL3-CS/SDL3/SDL_audio.cs index 1a0fe41..9743dac 100644 --- a/SDL3-CS/SDL3/SDL_audio.cs +++ b/SDL3-CS/SDL3/SDL_audio.cs @@ -2,6 +2,7 @@ // See the LICENCE file in the repository root for full licence text. using System; +using JetBrains.Annotations; namespace SDL { @@ -59,6 +60,7 @@ 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_GetAudioOutputDevices() { int count; @@ -66,6 +68,7 @@ namespace SDL return SDLArray.Create(array, count); } + [MustDisposeResource] public static unsafe SDLArray? SDL_GetAudioCaptureDevices() { int count; diff --git a/SDL3-CS/SDL3/SDL_gamepad.cs b/SDL3-CS/SDL3/SDL_gamepad.cs index f1c0a85..b22e209 100644 --- a/SDL3-CS/SDL3/SDL_gamepad.cs +++ b/SDL3-CS/SDL3/SDL_gamepad.cs @@ -3,6 +3,7 @@ using System; using System.Runtime.InteropServices; +using JetBrains.Annotations; namespace SDL { @@ -11,6 +12,7 @@ namespace SDL /// /// An array of that can be passed to . /// + [MustDisposeResource] public static unsafe SDLArray? SDL_GetGamepadMappings() { int count; @@ -18,6 +20,7 @@ namespace SDL return SDLArray.Create(array, count); } + [MustDisposeResource] public static unsafe SDLArray? SDL_GetGamepads() { int count; @@ -25,6 +28,7 @@ namespace SDL return SDLArray.Create(array, count); } + [MustDisposeResource] public static unsafe SDLPointerArray? SDL_GetGamepadBindings(SDL_Gamepad* gamepad) { int count; diff --git a/SDL3-CS/SDL3/SDL_haptic.cs b/SDL3-CS/SDL3/SDL_haptic.cs index eede833..9b52131 100644 --- a/SDL3-CS/SDL3/SDL_haptic.cs +++ b/SDL3-CS/SDL3/SDL_haptic.cs @@ -2,6 +2,7 @@ // See the LICENCE file in the repository root for full licence text. using System; +using JetBrains.Annotations; namespace SDL { @@ -10,6 +11,7 @@ namespace SDL public static partial class SDL3 { + [MustDisposeResource] public static unsafe SDLArray? SDL_GetHaptics() { int count; diff --git a/SDL3-CS/SDL3/SDL_joystick.cs b/SDL3-CS/SDL3/SDL_joystick.cs index 5dff357..fdc7a2f 100644 --- a/SDL3-CS/SDL3/SDL_joystick.cs +++ b/SDL3-CS/SDL3/SDL_joystick.cs @@ -2,6 +2,7 @@ // See the LICENCE file in the repository root for full licence text. using System; +using JetBrains.Annotations; namespace SDL { @@ -10,6 +11,7 @@ namespace SDL public static partial class SDL3 { + [MustDisposeResource] public static unsafe SDLArray? SDL_GetJoysticks() { int count; diff --git a/SDL3-CS/SDL3/SDL_keyboard.cs b/SDL3-CS/SDL3/SDL_keyboard.cs index b5e32b3..cdd4ced 100644 --- a/SDL3-CS/SDL3/SDL_keyboard.cs +++ b/SDL3-CS/SDL3/SDL_keyboard.cs @@ -2,6 +2,7 @@ // See the LICENCE file in the repository root for full licence text. using System; +using JetBrains.Annotations; namespace SDL { @@ -15,6 +16,7 @@ namespace SDL public static partial class SDL3 { + [MustDisposeResource] public static unsafe SDLArray? SDL_GetKeyboards() { int count; diff --git a/SDL3-CS/SDL3/SDL_mouse.cs b/SDL3-CS/SDL3/SDL_mouse.cs index 62be8af..2d473b6 100644 --- a/SDL3-CS/SDL3/SDL_mouse.cs +++ b/SDL3-CS/SDL3/SDL_mouse.cs @@ -2,6 +2,7 @@ // See the LICENCE file in the repository root for full licence text. using System; +using JetBrains.Annotations; namespace SDL { @@ -32,6 +33,7 @@ namespace SDL [Macro] public static SDLButtonMask SDL_BUTTON(SDLButton button) => (SDLButtonMask)(1 << ((int)button - 1)); + [MustDisposeResource] public static unsafe SDLArray? SDL_GetMice() { int count; diff --git a/SDL3-CS/SDL3/SDL_pen.cs b/SDL3-CS/SDL3/SDL_pen.cs index 06f064b..aab107e 100644 --- a/SDL3-CS/SDL3/SDL_pen.cs +++ b/SDL3-CS/SDL3/SDL_pen.cs @@ -2,6 +2,7 @@ // See the LICENCE file in the repository root for full licence text. using System; +using JetBrains.Annotations; namespace SDL { @@ -34,6 +35,7 @@ namespace SDL [Macro] public static SDL_PEN_CAPABILITIES 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() { int count; diff --git a/SDL3-CS/SDL3/SDL_sensor.cs b/SDL3-CS/SDL3/SDL_sensor.cs index 2361554..540b22c 100644 --- a/SDL3-CS/SDL3/SDL_sensor.cs +++ b/SDL3-CS/SDL3/SDL_sensor.cs @@ -2,6 +2,7 @@ // See the LICENCE file in the repository root for full licence text. using System; +using JetBrains.Annotations; namespace SDL { @@ -10,6 +11,7 @@ namespace SDL public static partial class SDL3 { + [MustDisposeResource] public static unsafe SDLArray? SDL_GetSensors() { int count; diff --git a/SDL3-CS/SDL3/SDL_touch.cs b/SDL3-CS/SDL3/SDL_touch.cs index 772ac51..8c8ae44 100644 --- a/SDL3-CS/SDL3/SDL_touch.cs +++ b/SDL3-CS/SDL3/SDL_touch.cs @@ -2,6 +2,7 @@ // See the LICENCE file in the repository root for full licence text. using System; +using JetBrains.Annotations; namespace SDL { @@ -19,6 +20,7 @@ namespace SDL [Constant] public const SDL_TouchID SDL_MOUSE_TOUCHID = unchecked((SDL_TouchID)(-1)); + [MustDisposeResource] public static unsafe SDLArray? SDL_GetTouchDevices() { int count; diff --git a/SDL3-CS/SDL3/SDL_video.cs b/SDL3-CS/SDL3/SDL_video.cs index 83c02fe..335eaf5 100644 --- a/SDL3-CS/SDL3/SDL_video.cs +++ b/SDL3-CS/SDL3/SDL_video.cs @@ -2,6 +2,7 @@ // See the LICENCE file in the repository root for full licence text. using System; +using JetBrains.Annotations; namespace SDL { @@ -54,6 +55,7 @@ namespace SDL [Macro] public static bool SDL_WINDOWPOS_ISCENTERED(int X) => (((X) & 0xFFFF0000) == SDL_WINDOWPOS_CENTERED_MASK); + [MustDisposeResource] public static unsafe SDLArray? SDL_GetDisplays() { int count; @@ -61,6 +63,7 @@ namespace SDL return SDLArray.Create(array, count); } + [MustDisposeResource] public static unsafe SDLPointerArray? SDL_GetFullscreenDisplayModes(SDL_DisplayID displayID) { int count; diff --git a/SDL3-CS/SDLArray.cs b/SDL3-CS/SDLArray.cs index 65858f5..229ad8a 100644 --- a/SDL3-CS/SDLArray.cs +++ b/SDL3-CS/SDLArray.cs @@ -2,9 +2,11 @@ // See the LICENCE file in the repository root for full licence text. using System; +using JetBrains.Annotations; namespace SDL { + [MustDisposeResource] public sealed unsafe class SDLArray : IDisposable where T : unmanaged { @@ -41,6 +43,7 @@ namespace SDL internal static unsafe class SDLArray { + [MustDisposeResource] internal static SDLArray? Create(T* array, int count) where T : unmanaged { @@ -50,6 +53,7 @@ namespace SDL return new SDLArray(array, count); } + [MustDisposeResource] internal static SDLPointerArray? Create(T** array, int count) where T : unmanaged { @@ -58,6 +62,5 @@ namespace SDL return new SDLPointerArray(array, count); } - } } diff --git a/SDL3-CS/SDLPointerArray.cs b/SDL3-CS/SDLPointerArray.cs index 806266b..4e1d93b 100644 --- a/SDL3-CS/SDLPointerArray.cs +++ b/SDL3-CS/SDLPointerArray.cs @@ -3,10 +3,12 @@ using System; using System.Diagnostics; +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 : IDisposable where T : unmanaged {