Skip to content

Commit

Permalink
Merge pull request #70 from Susko3/update-bindings
Browse files Browse the repository at this point in the history
Update SDL3 bindings
  • Loading branch information
smoogipoo authored May 18, 2024
2 parents 9f385f6 + 25c2558 commit 9ef6d54
Show file tree
Hide file tree
Showing 12 changed files with 54 additions and 67 deletions.
39 changes: 0 additions & 39 deletions SDL3-CS/SDL3/ClangSharp/SDL.g.cs

This file was deleted.

5 changes: 1 addition & 4 deletions SDL3-CS/SDL3/ClangSharp/SDL_audio.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ public static unsafe partial class SDL3
public static extern int SDL_LoadWAV([NativeTypeName("const char *")] byte* path, SDL_AudioSpec* spec, [NativeTypeName("Uint8 **")] byte** audio_buf, [NativeTypeName("Uint32 *")] uint* audio_len);

[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern int SDL_MixAudioFormat([NativeTypeName("Uint8 *")] byte* dst, [NativeTypeName("const Uint8 *")] byte* src, SDL_AudioFormat format, [NativeTypeName("Uint32")] uint len, int volume);
public static extern int SDL_MixAudio([NativeTypeName("Uint8 *")] byte* dst, [NativeTypeName("const Uint8 *")] byte* src, SDL_AudioFormat format, [NativeTypeName("Uint32")] uint len, float volume);

[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern int SDL_ConvertAudioSamples([NativeTypeName("const SDL_AudioSpec *")] SDL_AudioSpec* src_spec, [NativeTypeName("const Uint8 *")] byte* src_data, int src_len, [NativeTypeName("const SDL_AudioSpec *")] SDL_AudioSpec* dst_spec, [NativeTypeName("Uint8 **")] byte** dst_data, int* dst_len);
Expand Down Expand Up @@ -210,8 +210,5 @@ public static unsafe partial class SDL3

[NativeTypeName("#define SDL_AUDIO_DEVICE_DEFAULT_CAPTURE ((SDL_AudioDeviceID) 0xFFFFFFFE)")]
public const SDL_AudioDeviceID SDL_AUDIO_DEVICE_DEFAULT_CAPTURE = ((SDL_AudioDeviceID)(0xFFFFFFFE));

[NativeTypeName("#define SDL_MIX_MAXVOLUME 128")]
public const int SDL_MIX_MAXVOLUME = 128;
}
}
2 changes: 1 addition & 1 deletion SDL3-CS/SDL3/ClangSharp/SDL_cpuinfo.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public static partial class SDL3

[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("size_t")]
public static extern nuint SDL_SIMDGetAlignment();
public static extern nuint SDL_GetSIMDAlignment();

[NativeTypeName("#define SDL_CACHELINE_SIZE 128")]
public const int SDL_CACHELINE_SIZE = 128;
Expand Down
3 changes: 3 additions & 0 deletions SDL3-CS/SDL3/ClangSharp/SDL_hints.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,9 @@ public static unsafe partial class SDL3
[NativeTypeName("#define SDL_HINT_JOYSTICK_HIDAPI_PS4 \"SDL_JOYSTICK_HIDAPI_PS4\"")]
public static ReadOnlySpan<byte> SDL_HINT_JOYSTICK_HIDAPI_PS4 => "SDL_JOYSTICK_HIDAPI_PS4"u8;

[NativeTypeName("#define SDL_HINT_JOYSTICK_HIDAPI_PS4_REPORT_INTERVAL \"SDL_JOYSTICK_HIDAPI_PS4_REPORT_INTERVAL\"")]
public static ReadOnlySpan<byte> SDL_HINT_JOYSTICK_HIDAPI_PS4_REPORT_INTERVAL => "SDL_JOYSTICK_HIDAPI_PS4_REPORT_INTERVAL"u8;

[NativeTypeName("#define SDL_HINT_JOYSTICK_HIDAPI_PS4_RUMBLE \"SDL_JOYSTICK_HIDAPI_PS4_RUMBLE\"")]
public static ReadOnlySpan<byte> SDL_HINT_JOYSTICK_HIDAPI_PS4_RUMBLE => "SDL_JOYSTICK_HIDAPI_PS4_RUMBLE"u8;

Expand Down
8 changes: 4 additions & 4 deletions SDL3-CS/SDL3/ClangSharp/SDL_log.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,16 +66,16 @@ public enum SDL_LogPriority
public static unsafe partial class SDL3
{
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void SDL_LogSetAllPriority(SDL_LogPriority priority);
public static extern void SDL_SetLogPriorities(SDL_LogPriority priority);

[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void SDL_LogSetPriority(int category, SDL_LogPriority priority);
public static extern void SDL_SetLogPriority(int category, SDL_LogPriority priority);

[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern SDL_LogPriority SDL_LogGetPriority(int category);
public static extern SDL_LogPriority SDL_GetLogPriority(int category);

[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void SDL_LogResetPriorities();
public static extern void SDL_ResetLogPriorities();

[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void SDL_Log([NativeTypeName("const char *")] byte* fmt, __arglist);
Expand Down
6 changes: 6 additions & 0 deletions SDL3-CS/SDL3/ClangSharp/SDL_render.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -562,5 +562,11 @@ public static unsafe partial class SDL3

[NativeTypeName("#define SDL_PROP_TEXTURE_VULKAN_TEXTURE_NUMBER \"SDL.texture.vulkan.texture\"")]
public static ReadOnlySpan<byte> SDL_PROP_TEXTURE_VULKAN_TEXTURE_NUMBER => "SDL.texture.vulkan.texture"u8;

[NativeTypeName("#define SDL_RENDERER_VSYNC_DISABLED 0")]
public const int SDL_RENDERER_VSYNC_DISABLED = 0;

[NativeTypeName("#define SDL_RENDERER_VSYNC_ADAPTIVE (-1)")]
public const int SDL_RENDERER_VSYNC_ADAPTIVE = (-1);
}
}
26 changes: 11 additions & 15 deletions SDL3-CS/SDL3/ClangSharp/SDL_surface.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,7 @@ public enum SDL_FlipMode

public unsafe partial struct SDL_Surface
{
[NativeTypeName("Uint32")]
public uint flags;
public SDL_SurfaceFlags flags;

public SDL_PixelFormat* format;

Expand Down Expand Up @@ -205,23 +204,20 @@ public static unsafe partial class SDL3
[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);

[NativeTypeName("#define SDL_SWSURFACE 0")]
public const int SDL_SWSURFACE = 0;
[NativeTypeName("#define SDL_PREALLOC 0x00000001u")]
public const uint SDL_PREALLOC = 0x00000001U;

[NativeTypeName("#define SDL_PREALLOC 0x00000001")]
public const int SDL_PREALLOC = 0x00000001;
[NativeTypeName("#define SDL_RLEACCEL 0x00000002u")]
public const uint SDL_RLEACCEL = 0x00000002U;

[NativeTypeName("#define SDL_RLEACCEL 0x00000002")]
public const int SDL_RLEACCEL = 0x00000002;
[NativeTypeName("#define SDL_DONTFREE 0x00000004u")]
public const uint SDL_DONTFREE = 0x00000004U;

[NativeTypeName("#define SDL_DONTFREE 0x00000004")]
public const int SDL_DONTFREE = 0x00000004;
[NativeTypeName("#define SDL_SIMD_ALIGNED 0x00000008u")]
public const uint SDL_SIMD_ALIGNED = 0x00000008U;

[NativeTypeName("#define SDL_SIMD_ALIGNED 0x00000008")]
public const int SDL_SIMD_ALIGNED = 0x00000008;

[NativeTypeName("#define SDL_SURFACE_USES_PROPERTIES 0x00000010")]
public const int SDL_SURFACE_USES_PROPERTIES = 0x00000010;
[NativeTypeName("#define SDL_SURFACE_USES_PROPERTIES 0x00000010u")]
public const uint SDL_SURFACE_USES_PROPERTIES = 0x00000010U;

[NativeTypeName("#define SDL_PROP_SURFACE_COLORSPACE_NUMBER \"SDL.surface.colorspace\"")]
public static ReadOnlySpan<byte> SDL_PROP_SURFACE_COLORSPACE_NUMBER => "SDL.surface.colorspace"u8;
Expand Down
9 changes: 9 additions & 0 deletions SDL3-CS/SDL3/ClangSharp/SDL_version.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,14 @@ public static unsafe partial class SDL3
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_GetRevision", ExactSpelling = true)]
[return: NativeTypeName("const char *")]
public static extern byte* Unsafe_SDL_GetRevision();

[NativeTypeName("#define SDL_MAJOR_VERSION 3")]
public const int SDL_MAJOR_VERSION = 3;

[NativeTypeName("#define SDL_MINOR_VERSION 1")]
public const int SDL_MINOR_VERSION = 1;

[NativeTypeName("#define SDL_MICRO_VERSION 2")]
public const int SDL_MICRO_VERSION = 2;
}
}
3 changes: 3 additions & 0 deletions SDL3-CS/SDL3/ClangSharp/SDL_vulkan.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,5 +58,8 @@ public static unsafe partial class SDL3

[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern SDL_bool SDL_Vulkan_CreateSurface(SDL_Window* window, [NativeTypeName("VkInstance")] VkInstance_T* instance, [NativeTypeName("const struct VkAllocationCallbacks *")] VkAllocationCallbacks* allocator, [NativeTypeName("VkSurfaceKHR *")] VkSurfaceKHR_T** surface);

[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);
}
}
4 changes: 2 additions & 2 deletions SDL3-CS/SDL3/SDL_log.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ namespace SDL
{
public static partial class SDL3
{
public static void SDL_LogSetPriority(SDL_LogCategory category, SDL_LogPriority priority) => SDL_LogSetPriority((int)category, priority);
public static SDL_LogPriority SDL_LogGetPriority(SDL_LogCategory category) => SDL_LogGetPriority((int)category);
public static void SDL_SetLogPriority(SDL_LogCategory category, SDL_LogPriority priority) => SDL_SetLogPriority((int)category, priority);
public static SDL_LogPriority SDL_GetLogPriority(SDL_LogCategory category) => SDL_GetLogPriority((int)category);
}
}
15 changes: 14 additions & 1 deletion SDL3-CS/SDL3/SDL_surface.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,24 @@
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.

using System;

namespace SDL
{
[Flags]
[Typedef]
public enum SDL_SurfaceFlags : UInt32
{
SDL_PREALLOC = SDL3.SDL_PREALLOC,
SDL_RLEACCEL = SDL3.SDL_RLEACCEL,
SDL_DONTFREE = SDL3.SDL_DONTFREE,
SDL_SIMD_ALIGNED = SDL3.SDL_SIMD_ALIGNED,
SDL_SURFACE_USES_PROPERTIES = SDL3.SDL_SURFACE_USES_PROPERTIES,
}

public static partial class SDL3
{
[Macro]
public static unsafe bool SDL_MUSTLOCK(SDL_Surface* S) => (((S)->flags & SDL_RLEACCEL) != 0);
public static unsafe bool SDL_MUSTLOCK(SDL_Surface* S) => (((S)->flags & SDL_SurfaceFlags.SDL_RLEACCEL) != 0);
}
}
1 change: 0 additions & 1 deletion SDL3-CS/generate_bindings.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ def add(s: str):


headers = [
add("SDL3/SDL.h"),
add("SDL3/SDL_atomic.h"),
add("SDL3/SDL_audio.h"),
add("SDL3/SDL_blendmode.h"),
Expand Down

0 comments on commit 9ef6d54

Please sign in to comment.