From 5b0abdca7cbeb42ae574a628503a9589deb871bc Mon Sep 17 00:00:00 2001 From: WizzardMaker Date: Sun, 1 Dec 2024 19:37:28 +0100 Subject: [PATCH 01/23] added sdl_image and sdl_ttf --- .gitmodules | 8 + External/SDL_image | 1 + External/SDL_ttf | 1 + SDL3-CS/SDL3/ClangSharp/SDL_audio.g.cs | 1 + SDL3-CS/SDL3/ClangSharp/SDL_pixels.g.cs | 2 + SDL3-CS/SDL3_image/ClangSharp/SDL_image.g.cs | 283 ++++++++++ .../SDL3_ttf/ClangSharp/SDL_textengine.g.cs | 131 +++++ SDL3-CS/SDL3_ttf/ClangSharp/SDL_ttf.g.cs | 506 ++++++++++++++++++ SDL3-CS/generate_bindings.py | 50 +- 9 files changed, 965 insertions(+), 18 deletions(-) create mode 160000 External/SDL_image create mode 160000 External/SDL_ttf create mode 100644 SDL3-CS/SDL3_image/ClangSharp/SDL_image.g.cs create mode 100644 SDL3-CS/SDL3_ttf/ClangSharp/SDL_textengine.g.cs create mode 100644 SDL3-CS/SDL3_ttf/ClangSharp/SDL_ttf.g.cs diff --git a/.gitmodules b/.gitmodules index bb220c2..3201d62 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,11 @@ [submodule "SDL"] path = External/SDL url = https://github.com/libsdl-org/SDL +[submodule "SDL_image"] + path = External/SDL_image + url = https://github.com/libsdl-org/SDL_image.git + branch = main +[submodule "SDL_ttf"] + path = External/SDL_ttf + url = https://github.com/libsdl-org/SDL_ttf.git + branch = main diff --git a/External/SDL_image b/External/SDL_image new file mode 160000 index 0000000..0d418a2 --- /dev/null +++ b/External/SDL_image @@ -0,0 +1 @@ +Subproject commit 0d418a2a2dc562699854d9c2fc264304ec404e2c diff --git a/External/SDL_ttf b/External/SDL_ttf new file mode 160000 index 0000000..582c695 --- /dev/null +++ b/External/SDL_ttf @@ -0,0 +1 @@ +Subproject commit 582c6957161d6cc4d3b09cae37744bdfe3700368 diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_audio.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_audio.g.cs index de63476..addb1b8 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_audio.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_audio.g.cs @@ -28,6 +28,7 @@ using System.Runtime.InteropServices; namespace SDL { + [NativeTypeName("int")] public enum SDL_AudioFormat : uint { SDL_AUDIO_UNKNOWN = 0x0000U, diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_pixels.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_pixels.g.cs index aae40df..b963cec 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_pixels.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_pixels.g.cs @@ -89,6 +89,7 @@ namespace SDL SDL_PACKEDLAYOUT_1010102, } + [NativeTypeName("int")] public enum SDL_PixelFormat : uint { SDL_PIXELFORMAT_UNKNOWN = 0, @@ -239,6 +240,7 @@ namespace SDL SDL_CHROMA_LOCATION_TOPLEFT = 3, } + [NativeTypeName("int")] public enum SDL_Colorspace : uint { SDL_COLORSPACE_UNKNOWN = 0, diff --git a/SDL3-CS/SDL3_image/ClangSharp/SDL_image.g.cs b/SDL3-CS/SDL3_image/ClangSharp/SDL_image.g.cs new file mode 100644 index 0000000..aaa6500 --- /dev/null +++ b/SDL3-CS/SDL3_image/ClangSharp/SDL_image.g.cs @@ -0,0 +1,283 @@ +/* + + C# bindings for Simple DirectMedia Layer. + Original copyright notice of input files: + + Simple DirectMedia Layer + Copyright (C) 1997-2024 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +using System.Runtime.InteropServices; + +namespace SDL +{ + public unsafe partial struct IMG_Animation + { + public int w; + + public int h; + + public int count; + + public SDL_Surface** frames; + + public int* delays; + } + + public static unsafe partial class SDL3 + { + [DllImport("SDL3_image", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int IMG_Version(); + + [DllImport("SDL3_image", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("IMG_InitFlags")] + public static extern uint IMG_Init([NativeTypeName("IMG_InitFlags")] uint flags); + + [DllImport("SDL3_image", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void IMG_Quit(); + + [DllImport("SDL3_image", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_Surface* IMG_LoadTyped_IO(SDL_IOStream* src, [NativeTypeName("bool")] SDLBool closeio, [NativeTypeName("const char *")] byte* type); + + [DllImport("SDL3_image", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_Surface* IMG_Load([NativeTypeName("const char *")] byte* file); + + [DllImport("SDL3_image", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_Surface* IMG_Load_IO(SDL_IOStream* src, [NativeTypeName("bool")] SDLBool closeio); + + [DllImport("SDL3_image", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_Texture* IMG_LoadTexture(SDL_Renderer* renderer, [NativeTypeName("const char *")] byte* file); + + [DllImport("SDL3_image", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_Texture* IMG_LoadTexture_IO(SDL_Renderer* renderer, SDL_IOStream* src, [NativeTypeName("bool")] SDLBool closeio); + + [DllImport("SDL3_image", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_Texture* IMG_LoadTextureTyped_IO(SDL_Renderer* renderer, SDL_IOStream* src, [NativeTypeName("bool")] SDLBool closeio, [NativeTypeName("const char *")] byte* type); + + [DllImport("SDL3_image", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("bool")] + public static extern SDLBool IMG_isAVIF(SDL_IOStream* src); + + [DllImport("SDL3_image", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("bool")] + public static extern SDLBool IMG_isICO(SDL_IOStream* src); + + [DllImport("SDL3_image", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("bool")] + public static extern SDLBool IMG_isCUR(SDL_IOStream* src); + + [DllImport("SDL3_image", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("bool")] + public static extern SDLBool IMG_isBMP(SDL_IOStream* src); + + [DllImport("SDL3_image", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("bool")] + public static extern SDLBool IMG_isGIF(SDL_IOStream* src); + + [DllImport("SDL3_image", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("bool")] + public static extern SDLBool IMG_isJPG(SDL_IOStream* src); + + [DllImport("SDL3_image", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("bool")] + public static extern SDLBool IMG_isJXL(SDL_IOStream* src); + + [DllImport("SDL3_image", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("bool")] + public static extern SDLBool IMG_isLBM(SDL_IOStream* src); + + [DllImport("SDL3_image", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("bool")] + public static extern SDLBool IMG_isPCX(SDL_IOStream* src); + + [DllImport("SDL3_image", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("bool")] + public static extern SDLBool IMG_isPNG(SDL_IOStream* src); + + [DllImport("SDL3_image", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("bool")] + public static extern SDLBool IMG_isPNM(SDL_IOStream* src); + + [DllImport("SDL3_image", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("bool")] + public static extern SDLBool IMG_isSVG(SDL_IOStream* src); + + [DllImport("SDL3_image", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("bool")] + public static extern SDLBool IMG_isQOI(SDL_IOStream* src); + + [DllImport("SDL3_image", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("bool")] + public static extern SDLBool IMG_isTIF(SDL_IOStream* src); + + [DllImport("SDL3_image", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("bool")] + public static extern SDLBool IMG_isXCF(SDL_IOStream* src); + + [DllImport("SDL3_image", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("bool")] + public static extern SDLBool IMG_isXPM(SDL_IOStream* src); + + [DllImport("SDL3_image", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("bool")] + public static extern SDLBool IMG_isXV(SDL_IOStream* src); + + [DllImport("SDL3_image", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("bool")] + public static extern SDLBool IMG_isWEBP(SDL_IOStream* src); + + [DllImport("SDL3_image", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_Surface* IMG_LoadAVIF_IO(SDL_IOStream* src); + + [DllImport("SDL3_image", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_Surface* IMG_LoadICO_IO(SDL_IOStream* src); + + [DllImport("SDL3_image", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_Surface* IMG_LoadCUR_IO(SDL_IOStream* src); + + [DllImport("SDL3_image", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_Surface* IMG_LoadBMP_IO(SDL_IOStream* src); + + [DllImport("SDL3_image", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_Surface* IMG_LoadGIF_IO(SDL_IOStream* src); + + [DllImport("SDL3_image", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_Surface* IMG_LoadJPG_IO(SDL_IOStream* src); + + [DllImport("SDL3_image", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_Surface* IMG_LoadJXL_IO(SDL_IOStream* src); + + [DllImport("SDL3_image", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_Surface* IMG_LoadLBM_IO(SDL_IOStream* src); + + [DllImport("SDL3_image", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_Surface* IMG_LoadPCX_IO(SDL_IOStream* src); + + [DllImport("SDL3_image", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_Surface* IMG_LoadPNG_IO(SDL_IOStream* src); + + [DllImport("SDL3_image", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_Surface* IMG_LoadPNM_IO(SDL_IOStream* src); + + [DllImport("SDL3_image", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_Surface* IMG_LoadSVG_IO(SDL_IOStream* src); + + [DllImport("SDL3_image", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_Surface* IMG_LoadQOI_IO(SDL_IOStream* src); + + [DllImport("SDL3_image", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_Surface* IMG_LoadTGA_IO(SDL_IOStream* src); + + [DllImport("SDL3_image", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_Surface* IMG_LoadTIF_IO(SDL_IOStream* src); + + [DllImport("SDL3_image", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_Surface* IMG_LoadXCF_IO(SDL_IOStream* src); + + [DllImport("SDL3_image", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_Surface* IMG_LoadXPM_IO(SDL_IOStream* src); + + [DllImport("SDL3_image", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_Surface* IMG_LoadXV_IO(SDL_IOStream* src); + + [DllImport("SDL3_image", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_Surface* IMG_LoadWEBP_IO(SDL_IOStream* src); + + [DllImport("SDL3_image", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_Surface* IMG_LoadSizedSVG_IO(SDL_IOStream* src, int width, int height); + + [DllImport("SDL3_image", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_Surface* IMG_ReadXPMFromArray([NativeTypeName("char **")] byte** xpm); + + [DllImport("SDL3_image", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_Surface* IMG_ReadXPMFromArrayToRGB888([NativeTypeName("char **")] byte** xpm); + + [DllImport("SDL3_image", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("bool")] + public static extern SDLBool IMG_SaveAVIF(SDL_Surface* surface, [NativeTypeName("const char *")] byte* file, int quality); + + [DllImport("SDL3_image", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("bool")] + public static extern SDLBool IMG_SaveAVIF_IO(SDL_Surface* surface, SDL_IOStream* dst, int closeio, int quality); + + [DllImport("SDL3_image", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("bool")] + public static extern SDLBool IMG_SavePNG(SDL_Surface* surface, [NativeTypeName("const char *")] byte* file); + + [DllImport("SDL3_image", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("bool")] + public static extern SDLBool IMG_SavePNG_IO(SDL_Surface* surface, SDL_IOStream* dst, int closeio); + + [DllImport("SDL3_image", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("bool")] + public static extern SDLBool IMG_SaveJPG(SDL_Surface* surface, [NativeTypeName("const char *")] byte* file, int quality); + + [DllImport("SDL3_image", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("bool")] + public static extern SDLBool IMG_SaveJPG_IO(SDL_Surface* surface, SDL_IOStream* dst, int closeio, int quality); + + [DllImport("SDL3_image", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern IMG_Animation* IMG_LoadAnimation([NativeTypeName("const char *")] byte* file); + + [DllImport("SDL3_image", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern IMG_Animation* IMG_LoadAnimation_IO(SDL_IOStream* src, [NativeTypeName("bool")] SDLBool closeio); + + [DllImport("SDL3_image", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern IMG_Animation* IMG_LoadAnimationTyped_IO(SDL_IOStream* src, [NativeTypeName("bool")] SDLBool closeio, [NativeTypeName("const char *")] byte* type); + + [DllImport("SDL3_image", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void IMG_FreeAnimation(IMG_Animation* anim); + + [DllImport("SDL3_image", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern IMG_Animation* IMG_LoadGIFAnimation_IO(SDL_IOStream* src); + + [DllImport("SDL3_image", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern IMG_Animation* IMG_LoadWEBPAnimation_IO(SDL_IOStream* src); + + [NativeTypeName("#define SDL_IMAGE_MAJOR_VERSION 3")] + public const int SDL_IMAGE_MAJOR_VERSION = 3; + + [NativeTypeName("#define SDL_IMAGE_MINOR_VERSION 1")] + public const int SDL_IMAGE_MINOR_VERSION = 1; + + [NativeTypeName("#define SDL_IMAGE_MICRO_VERSION 0")] + public const int SDL_IMAGE_MICRO_VERSION = 0; + + [NativeTypeName("#define SDL_IMAGE_VERSION SDL_VERSIONNUM(SDL_IMAGE_MAJOR_VERSION, SDL_IMAGE_MINOR_VERSION, SDL_IMAGE_MICRO_VERSION)")] + public const int SDL_IMAGE_VERSION = ((3) * 1000000 + (1) * 1000 + (0)); + + [NativeTypeName("#define IMG_INIT_JPG 0x00000001")] + public const int IMG_INIT_JPG = 0x00000001; + + [NativeTypeName("#define IMG_INIT_PNG 0x00000002")] + public const int IMG_INIT_PNG = 0x00000002; + + [NativeTypeName("#define IMG_INIT_TIF 0x00000004")] + public const int IMG_INIT_TIF = 0x00000004; + + [NativeTypeName("#define IMG_INIT_WEBP 0x00000008")] + public const int IMG_INIT_WEBP = 0x00000008; + + [NativeTypeName("#define IMG_INIT_JXL 0x00000010")] + public const int IMG_INIT_JXL = 0x00000010; + + [NativeTypeName("#define IMG_INIT_AVIF 0x00000020")] + public const int IMG_INIT_AVIF = 0x00000020; + } +} diff --git a/SDL3-CS/SDL3_ttf/ClangSharp/SDL_textengine.g.cs b/SDL3-CS/SDL3_ttf/ClangSharp/SDL_textengine.g.cs new file mode 100644 index 0000000..7cd9fcd --- /dev/null +++ b/SDL3-CS/SDL3_ttf/ClangSharp/SDL_textengine.g.cs @@ -0,0 +1,131 @@ +/* + + C# bindings for Simple DirectMedia Layer. + Original copyright notice of input files: + + Simple DirectMedia Layer + Copyright (C) 1997-2024 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +using System; +using System.Runtime.InteropServices; + +namespace SDL +{ + public enum TTF_DrawCommand + { + TTF_DRAW_COMMAND_NOOP, + TTF_DRAW_COMMAND_FILL, + TTF_DRAW_COMMAND_COPY, + } + + public partial struct TTF_FillOperation + { + public TTF_DrawCommand cmd; + + public SDL_Rect rect; + } + + public partial struct TTF_CopyOperation + { + public TTF_DrawCommand cmd; + + public int text_offset; + + [NativeTypeName("Uint32")] + public uint glyph_index; + + public SDL_Rect src; + + public SDL_Rect dst; + + [NativeTypeName("void*")] + public IntPtr reserved; + } + + [StructLayout(LayoutKind.Explicit)] + public partial struct TTF_DrawOperation + { + [FieldOffset(0)] + public TTF_DrawCommand cmd; + + [FieldOffset(0)] + public TTF_FillOperation fill; + + [FieldOffset(0)] + public TTF_CopyOperation copy; + } + + public partial struct TTF_TextLayout + { + } + + public unsafe partial struct TTF_TextData + { + public TTF_Font* font; + + public SDL_FColor color; + + [NativeTypeName("bool")] + public SDLBool needs_layout_update; + + public TTF_TextLayout* layout; + + public int x; + + public int y; + + public int w; + + public int h; + + public int num_ops; + + public TTF_DrawOperation* ops; + + public int num_clusters; + + public TTF_SubString* clusters; + + public SDL_PropertiesID props; + + [NativeTypeName("bool")] + public SDLBool needs_engine_update; + + public TTF_TextEngine* engine; + + [NativeTypeName("void*")] + public IntPtr engine_text; + } + + public unsafe partial struct TTF_TextEngine + { + [NativeTypeName("Uint32")] + public uint version; + + [NativeTypeName("void*")] + public IntPtr userdata; + + [NativeTypeName("bool (*)(void *, TTF_Text *)")] + public delegate* unmanaged[Cdecl] CreateText; + + [NativeTypeName("void (*)(void *, TTF_Text *)")] + public delegate* unmanaged[Cdecl] DestroyText; + } +} diff --git a/SDL3-CS/SDL3_ttf/ClangSharp/SDL_ttf.g.cs b/SDL3-CS/SDL3_ttf/ClangSharp/SDL_ttf.g.cs new file mode 100644 index 0000000..fe13e1a --- /dev/null +++ b/SDL3-CS/SDL3_ttf/ClangSharp/SDL_ttf.g.cs @@ -0,0 +1,506 @@ +/* + + C# bindings for Simple DirectMedia Layer. + Original copyright notice of input files: + + Simple DirectMedia Layer + Copyright (C) 1997-2024 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +using System; +using System.Runtime.InteropServices; + +namespace SDL +{ + public partial struct TTF_Font + { + } + + public enum TTF_HorizontalAlignment + { + TTF_HORIZONTAL_ALIGN_INVALID = -1, + TTF_HORIZONTAL_ALIGN_LEFT, + TTF_HORIZONTAL_ALIGN_CENTER, + TTF_HORIZONTAL_ALIGN_RIGHT, + } + + public enum TTF_Direction + { + TTF_DIRECTION_LTR = 0, + TTF_DIRECTION_RTL, + TTF_DIRECTION_TTB, + TTF_DIRECTION_BTT, + } + + public partial struct TTF_TextEngine + { + } + + public partial struct TTF_TextData + { + } + + public unsafe partial struct TTF_Text + { + [NativeTypeName("char *")] + public byte* text; + + public int num_lines; + + public int refcount; + + public TTF_TextData* @internal; + } + + public partial struct TTF_SubString + { + [NativeTypeName("TTF_SubStringFlags")] + public uint flags; + + public int offset; + + public int length; + + public int line_index; + + public int cluster_index; + + public SDL_Rect rect; + } + + public static unsafe partial class SDL3 + { + [DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int TTF_Version(); + + [DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void TTF_GetFreeTypeVersion(int* major, int* minor, int* patch); + + [DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void TTF_GetHarfBuzzVersion(int* major, int* minor, int* patch); + + [DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("bool")] + public static extern SDLBool TTF_Init(); + + [DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern TTF_Font* TTF_OpenFont([NativeTypeName("const char *")] byte* file, float ptsize); + + [DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern TTF_Font* TTF_OpenFontIO(SDL_IOStream* src, [NativeTypeName("bool")] SDLBool closeio, float ptsize); + + [DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern TTF_Font* TTF_OpenFontWithProperties(SDL_PropertiesID props); + + [DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_PropertiesID TTF_GetFontProperties(TTF_Font* font); + + [DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("Uint32")] + public static extern uint TTF_GetFontGeneration(TTF_Font* font); + + [DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("bool")] + public static extern SDLBool TTF_SetFontSize(TTF_Font* font, float ptsize); + + [DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("bool")] + public static extern SDLBool TTF_SetFontSizeDPI(TTF_Font* font, float ptsize, int hdpi, int vdpi); + + [DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern float TTF_GetFontSize(TTF_Font* font); + + [DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("bool")] + public static extern SDLBool TTF_GetFontDPI(TTF_Font* font, int* hdpi, int* vdpi); + + [DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void TTF_SetFontStyle(TTF_Font* font, int style); + + [DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int TTF_GetFontStyle([NativeTypeName("const TTF_Font *")] TTF_Font* font); + + [DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("bool")] + public static extern SDLBool TTF_SetFontOutline(TTF_Font* font, int outline); + + [DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int TTF_GetFontOutline([NativeTypeName("const TTF_Font *")] TTF_Font* font); + + [DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void TTF_SetFontHinting(TTF_Font* font, int hinting); + + [DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int TTF_GetFontHinting([NativeTypeName("const TTF_Font *")] TTF_Font* font); + + [DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("bool")] + public static extern SDLBool TTF_SetFontSDF(TTF_Font* font, [NativeTypeName("bool")] SDLBool enabled); + + [DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("bool")] + public static extern SDLBool TTF_GetFontSDF([NativeTypeName("const TTF_Font *")] TTF_Font* font); + + [DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void TTF_SetFontWrapAlignment(TTF_Font* font, TTF_HorizontalAlignment align); + + [DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern TTF_HorizontalAlignment TTF_GetFontWrapAlignment([NativeTypeName("const TTF_Font *")] TTF_Font* font); + + [DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int TTF_GetFontHeight([NativeTypeName("const TTF_Font *")] TTF_Font* font); + + [DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int TTF_GetFontAscent([NativeTypeName("const TTF_Font *")] TTF_Font* font); + + [DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int TTF_GetFontDescent([NativeTypeName("const TTF_Font *")] TTF_Font* font); + + [DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void TTF_SetFontLineSkip(TTF_Font* font, int lineskip); + + [DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int TTF_GetFontLineSkip([NativeTypeName("const TTF_Font *")] TTF_Font* font); + + [DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void TTF_SetFontKerning(TTF_Font* font, [NativeTypeName("bool")] SDLBool enabled); + + [DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("bool")] + public static extern SDLBool TTF_GetFontKerning([NativeTypeName("const TTF_Font *")] TTF_Font* font); + + [DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("bool")] + public static extern SDLBool TTF_FontIsFixedWidth([NativeTypeName("const TTF_Font *")] TTF_Font* font); + + [DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("bool")] + public static extern SDLBool TTF_FontIsScalable([NativeTypeName("const TTF_Font *")] TTF_Font* font); + + [DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("const char *")] + public static extern byte* TTF_GetFontFamilyName([NativeTypeName("const TTF_Font *")] TTF_Font* font); + + [DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("const char *")] + public static extern byte* TTF_GetFontStyleName([NativeTypeName("const TTF_Font *")] TTF_Font* font); + + [DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_Surface* TTF_RenderText_Solid(TTF_Font* font, [NativeTypeName("const char *")] byte* text, [NativeTypeName("size_t")] nuint length, SDL_Color fg); + + [DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_Surface* TTF_RenderText_Solid_Wrapped(TTF_Font* font, [NativeTypeName("const char *")] byte* text, [NativeTypeName("size_t")] nuint length, SDL_Color fg, int wrapLength); + + [DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_Surface* TTF_RenderGlyph_Solid(TTF_Font* font, [NativeTypeName("Uint32")] uint ch, SDL_Color fg); + + [DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("bool")] + public static extern SDLBool TTF_SetFontDirection(TTF_Font* font, TTF_Direction direction); + + [DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern TTF_Direction TTF_GetFontDirection(TTF_Font* font); + + [DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("bool")] + public static extern SDLBool TTF_SetFontScript(TTF_Font* font, [NativeTypeName("const char *")] byte* script); + + [DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("bool")] + public static extern SDLBool TTF_GetGlyphScript([NativeTypeName("Uint32")] uint ch, [NativeTypeName("char *")] byte* script, [NativeTypeName("size_t")] nuint script_size); + + [DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("bool")] + public static extern SDLBool TTF_SetFontLanguage(TTF_Font* font, [NativeTypeName("const char *")] byte* language_bcp47); + + [DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("bool")] + public static extern SDLBool TTF_FontHasGlyph(TTF_Font* font, [NativeTypeName("Uint32")] uint ch); + + [DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_Surface* TTF_GetGlyphImage(TTF_Font* font, [NativeTypeName("Uint32")] uint ch); + + [DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_Surface* TTF_GetGlyphImageForIndex(TTF_Font* font, [NativeTypeName("Uint32")] uint glyph_index); + + [DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("bool")] + public static extern SDLBool TTF_GetGlyphMetrics(TTF_Font* font, [NativeTypeName("Uint32")] uint ch, int* minx, int* maxx, int* miny, int* maxy, int* advance); + + [DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("bool")] + public static extern SDLBool TTF_GetGlyphKerning(TTF_Font* font, [NativeTypeName("Uint32")] uint previous_ch, [NativeTypeName("Uint32")] uint ch, int* kerning); + + [DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("bool")] + public static extern SDLBool TTF_GetStringSize(TTF_Font* font, [NativeTypeName("const char *")] byte* text, [NativeTypeName("size_t")] nuint length, int* w, int* h); + + [DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("bool")] + public static extern SDLBool TTF_GetStringSizeWrapped(TTF_Font* font, [NativeTypeName("const char *")] byte* text, [NativeTypeName("size_t")] nuint length, int wrap_width, int* w, int* h); + + [DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("bool")] + public static extern SDLBool TTF_MeasureString(TTF_Font* font, [NativeTypeName("const char *")] byte* text, [NativeTypeName("size_t")] nuint length, int max_width, int* measured_width, [NativeTypeName("size_t *")] nuint* measured_length); + + [DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_Surface* TTF_RenderText_Shaded(TTF_Font* font, [NativeTypeName("const char *")] byte* text, [NativeTypeName("size_t")] nuint length, SDL_Color fg, SDL_Color bg); + + [DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_Surface* TTF_RenderText_Shaded_Wrapped(TTF_Font* font, [NativeTypeName("const char *")] byte* text, [NativeTypeName("size_t")] nuint length, SDL_Color fg, SDL_Color bg, int wrap_width); + + [DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_Surface* TTF_RenderGlyph_Shaded(TTF_Font* font, [NativeTypeName("Uint32")] uint ch, SDL_Color fg, SDL_Color bg); + + [DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_Surface* TTF_RenderText_Blended(TTF_Font* font, [NativeTypeName("const char *")] byte* text, [NativeTypeName("size_t")] nuint length, SDL_Color fg); + + [DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_Surface* TTF_RenderText_Blended_Wrapped(TTF_Font* font, [NativeTypeName("const char *")] byte* text, [NativeTypeName("size_t")] nuint length, SDL_Color fg, int wrap_width); + + [DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_Surface* TTF_RenderGlyph_Blended(TTF_Font* font, [NativeTypeName("Uint32")] uint ch, SDL_Color fg); + + [DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_Surface* TTF_RenderText_LCD(TTF_Font* font, [NativeTypeName("const char *")] byte* text, [NativeTypeName("size_t")] nuint length, SDL_Color fg, SDL_Color bg); + + [DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_Surface* TTF_RenderText_LCD_Wrapped(TTF_Font* font, [NativeTypeName("const char *")] byte* text, [NativeTypeName("size_t")] nuint length, SDL_Color fg, SDL_Color bg, int wrap_width); + + [DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_Surface* TTF_RenderGlyph_LCD(TTF_Font* font, [NativeTypeName("Uint32")] uint ch, SDL_Color fg, SDL_Color bg); + + [DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern TTF_TextEngine* TTF_CreateSurfaceTextEngine(); + + [DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("bool")] + public static extern SDLBool TTF_DrawSurfaceText(TTF_Text* text, int x, int y, SDL_Surface* surface); + + [DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void TTF_DestroySurfaceTextEngine(TTF_TextEngine* engine); + + [DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern TTF_TextEngine* TTF_CreateRendererTextEngine(SDL_Renderer* renderer); + + [DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("bool")] + public static extern SDLBool TTF_DrawRendererText(TTF_Text* text, float x, float y); + + [DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void TTF_DestroyRendererTextEngine(TTF_TextEngine* engine); + + [DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern TTF_Text* TTF_CreateText(TTF_TextEngine* engine, TTF_Font* font, [NativeTypeName("const char *")] byte* text, [NativeTypeName("size_t")] nuint length); + + [DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_PropertiesID TTF_GetTextProperties(TTF_Text* text); + + [DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("bool")] + public static extern SDLBool TTF_SetTextEngine(TTF_Text* text, TTF_TextEngine* engine); + + [DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern TTF_TextEngine* TTF_GetTextEngine(TTF_Text* text); + + [DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("bool")] + public static extern SDLBool TTF_SetTextFont(TTF_Text* text, TTF_Font* font); + + [DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern TTF_Font* TTF_GetTextFont(TTF_Text* text); + + [DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("bool")] + public static extern SDLBool TTF_SetTextColor(TTF_Text* text, [NativeTypeName("Uint8")] byte r, [NativeTypeName("Uint8")] byte g, [NativeTypeName("Uint8")] byte b, [NativeTypeName("Uint8")] byte a); + + [DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("bool")] + public static extern SDLBool TTF_SetTextColorFloat(TTF_Text* text, float r, float g, float b, float a); + + [DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("bool")] + public static extern SDLBool TTF_GetTextColor(TTF_Text* text, [NativeTypeName("Uint8 *")] byte* r, [NativeTypeName("Uint8 *")] byte* g, [NativeTypeName("Uint8 *")] byte* b, [NativeTypeName("Uint8 *")] byte* a); + + [DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("bool")] + public static extern SDLBool TTF_GetTextColorFloat(TTF_Text* text, float* r, float* g, float* b, float* a); + + [DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("bool")] + public static extern SDLBool TTF_SetTextPosition(TTF_Text* text, int x, int y); + + [DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("bool")] + public static extern SDLBool TTF_GetTextPosition(TTF_Text* text, int* x, int* y); + + [DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("bool")] + public static extern SDLBool TTF_SetTextWrapWidth(TTF_Text* text, int wrap_width); + + [DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("bool")] + public static extern SDLBool TTF_GetTextWrapWidth(TTF_Text* text, int* wrap_width); + + [DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("bool")] + public static extern SDLBool TTF_SetTextWrapWhitespaceVisible(TTF_Text* text, [NativeTypeName("bool")] SDLBool visible); + + [DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("bool")] + public static extern SDLBool TTF_TextWrapWhitespaceVisible(TTF_Text* text); + + [DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("bool")] + public static extern SDLBool TTF_SetTextString(TTF_Text* text, [NativeTypeName("const char *")] byte* @string, [NativeTypeName("size_t")] nuint length); + + [DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("bool")] + public static extern SDLBool TTF_InsertTextString(TTF_Text* text, int offset, [NativeTypeName("const char *")] byte* @string, [NativeTypeName("size_t")] nuint length); + + [DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("bool")] + public static extern SDLBool TTF_AppendTextString(TTF_Text* text, [NativeTypeName("const char *")] byte* @string, [NativeTypeName("size_t")] nuint length); + + [DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("bool")] + public static extern SDLBool TTF_DeleteTextString(TTF_Text* text, int offset, int length); + + [DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("bool")] + public static extern SDLBool TTF_GetTextSize(TTF_Text* text, int* w, int* h); + + [DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("bool")] + public static extern SDLBool TTF_GetTextSubString(TTF_Text* text, int offset, TTF_SubString* substring); + + [DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("bool")] + public static extern SDLBool TTF_GetTextSubStringForLine(TTF_Text* text, int line, TTF_SubString* substring); + + [DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern TTF_SubString** TTF_GetTextSubStringsForRange(TTF_Text* text, int offset, int length, int* count); + + [DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("bool")] + public static extern SDLBool TTF_GetTextSubStringForPoint(TTF_Text* text, int x, int y, TTF_SubString* substring); + + [DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("bool")] + public static extern SDLBool TTF_GetPreviousTextSubString(TTF_Text* text, [NativeTypeName("const TTF_SubString *")] TTF_SubString* substring, TTF_SubString* previous); + + [DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("bool")] + public static extern SDLBool TTF_GetNextTextSubString(TTF_Text* text, [NativeTypeName("const TTF_SubString *")] TTF_SubString* substring, TTF_SubString* next); + + [DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("bool")] + public static extern SDLBool TTF_UpdateText(TTF_Text* text); + + [DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void TTF_DestroyText(TTF_Text* text); + + [DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void TTF_CloseFont(TTF_Font* font); + + [DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void TTF_Quit(); + + [DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int TTF_WasInit(); + + [NativeTypeName("#define SDL_TTF_MAJOR_VERSION 3")] + public const int SDL_TTF_MAJOR_VERSION = 3; + + [NativeTypeName("#define SDL_TTF_MINOR_VERSION 0")] + public const int SDL_TTF_MINOR_VERSION = 0; + + [NativeTypeName("#define SDL_TTF_MICRO_VERSION 0")] + public const int SDL_TTF_MICRO_VERSION = 0; + + [NativeTypeName("#define SDL_TTF_VERSION SDL_VERSIONNUM(SDL_TTF_MAJOR_VERSION, SDL_TTF_MINOR_VERSION, SDL_TTF_MICRO_VERSION)")] + public const int SDL_TTF_VERSION = ((3) * 1000000 + (0) * 1000 + (0)); + + [NativeTypeName("#define TTF_PROP_FONT_CREATE_FILENAME_STRING \"SDL_ttf.font.create.filename\"")] + public static ReadOnlySpan TTF_PROP_FONT_CREATE_FILENAME_STRING => "SDL_ttf.font.create.filename"u8; + + [NativeTypeName("#define TTF_PROP_FONT_CREATE_IOSTREAM_POINTER \"SDL_ttf.font.create.iostream\"")] + public static ReadOnlySpan TTF_PROP_FONT_CREATE_IOSTREAM_POINTER => "SDL_ttf.font.create.iostream"u8; + + [NativeTypeName("#define TTF_PROP_FONT_CREATE_IOSTREAM_OFFSET_NUMBER \"SDL_ttf.font.create.iostream.offset\"")] + public static ReadOnlySpan TTF_PROP_FONT_CREATE_IOSTREAM_OFFSET_NUMBER => "SDL_ttf.font.create.iostream.offset"u8; + + [NativeTypeName("#define TTF_PROP_FONT_CREATE_IOSTREAM_AUTOCLOSE_BOOLEAN \"SDL_ttf.font.create.iostream.autoclose\"")] + public static ReadOnlySpan TTF_PROP_FONT_CREATE_IOSTREAM_AUTOCLOSE_BOOLEAN => "SDL_ttf.font.create.iostream.autoclose"u8; + + [NativeTypeName("#define TTF_PROP_FONT_CREATE_SIZE_FLOAT \"SDL_ttf.font.create.size\"")] + public static ReadOnlySpan TTF_PROP_FONT_CREATE_SIZE_FLOAT => "SDL_ttf.font.create.size"u8; + + [NativeTypeName("#define TTF_PROP_FONT_CREATE_FACE_NUMBER \"SDL_ttf.font.create.face\"")] + public static ReadOnlySpan TTF_PROP_FONT_CREATE_FACE_NUMBER => "SDL_ttf.font.create.face"u8; + + [NativeTypeName("#define TTF_PROP_FONT_CREATE_HORIZONTAL_DPI_NUMBER \"SDL_ttf.font.create.hdpi\"")] + public static ReadOnlySpan TTF_PROP_FONT_CREATE_HORIZONTAL_DPI_NUMBER => "SDL_ttf.font.create.hdpi"u8; + + [NativeTypeName("#define TTF_PROP_FONT_CREATE_VERTICAL_DPI_NUMBER \"SDL_ttf.font.create.vdpi\"")] + public static ReadOnlySpan TTF_PROP_FONT_CREATE_VERTICAL_DPI_NUMBER => "SDL_ttf.font.create.vdpi"u8; + + [NativeTypeName("#define TTF_STYLE_NORMAL 0x00")] + public const int TTF_STYLE_NORMAL = 0x00; + + [NativeTypeName("#define TTF_STYLE_BOLD 0x01")] + public const int TTF_STYLE_BOLD = 0x01; + + [NativeTypeName("#define TTF_STYLE_ITALIC 0x02")] + public const int TTF_STYLE_ITALIC = 0x02; + + [NativeTypeName("#define TTF_STYLE_UNDERLINE 0x04")] + public const int TTF_STYLE_UNDERLINE = 0x04; + + [NativeTypeName("#define TTF_STYLE_STRIKETHROUGH 0x08")] + public const int TTF_STYLE_STRIKETHROUGH = 0x08; + + [NativeTypeName("#define TTF_HINTING_NORMAL 0")] + public const int TTF_HINTING_NORMAL = 0; + + [NativeTypeName("#define TTF_HINTING_LIGHT 1")] + public const int TTF_HINTING_LIGHT = 1; + + [NativeTypeName("#define TTF_HINTING_MONO 2")] + public const int TTF_HINTING_MONO = 2; + + [NativeTypeName("#define TTF_HINTING_NONE 3")] + public const int TTF_HINTING_NONE = 3; + + [NativeTypeName("#define TTF_HINTING_LIGHT_SUBPIXEL 4")] + public const int TTF_HINTING_LIGHT_SUBPIXEL = 4; + + [NativeTypeName("#define TTF_SUBSTRING_TEXT_START 0x00000001")] + public const int TTF_SUBSTRING_TEXT_START = 0x00000001; + + [NativeTypeName("#define TTF_SUBSTRING_LINE_START 0x00000002")] + public const int TTF_SUBSTRING_LINE_START = 0x00000002; + + [NativeTypeName("#define TTF_SUBSTRING_LINE_END 0x00000004")] + public const int TTF_SUBSTRING_LINE_END = 0x00000004; + + [NativeTypeName("#define TTF_SUBSTRING_TEXT_END 0x00000008")] + public const int TTF_SUBSTRING_TEXT_END = 0x00000008; + } +} diff --git a/SDL3-CS/generate_bindings.py b/SDL3-CS/generate_bindings.py index d855256..7eaad20 100644 --- a/SDL3-CS/generate_bindings.py +++ b/SDL3-CS/generate_bindings.py @@ -34,8 +34,14 @@ unsafe_prefix = "Unsafe_" repository_root = pathlib.Path(__file__).resolve().parents[1] -SDL_root = repository_root / "External" / "SDL" -SDL_include_root = SDL_root / "include" +SDL_lib_root = "External" +SDL_libs = ["SDL", "SDL_image", "SDL_ttf"] +SDL_lib_include_root = { + "SDL3": SDL_lib_root + "/SDL/include", + "SDL3_image": SDL_lib_root + "/SDL_image/include", + "SDL3_ttf": SDL_lib_root + "/SDL_ttf/include" +} + SDL3_header_base = "SDL3" # base folder of header files csproj_root = repository_root / "SDL3-CS" @@ -44,12 +50,13 @@ csproj_root = repository_root / "SDL3-CS" class Header: """Represents a SDL header file that is used in ClangSharp generation.""" - def __init__(self, base: str, name: str, output_suffix=None): - assert base == SDL3_header_base + def __init__(self, base: str, name: str, folder: str, output_suffix=None): + assert base in SDL_lib_include_root assert name.startswith("SDL") assert not name.endswith(".h") self.base = base self.name = name + self.folder = folder self.output_suffix = output_suffix def __str__(self): @@ -60,8 +67,8 @@ class Header: return f"{self.name}.h" def input_file(self): - """Input header file relative to SDL_include_root.""" - return f"{self.base}/{self.name}.h" + """Input header file relative to repository_root.""" + return f"{self.folder}/{self.base}/{self.name}.h" def output_file(self): """Location of generated C# file.""" @@ -99,14 +106,14 @@ def make_header_fuzzy(s: str) -> Header: if name.endswith(".h"): name = name.replace(".h", "") - return Header(base, name) + return Header(base, name, SDL_lib_include_root[base]) def add(s: str): base, name = s.split("/") assert s.endswith(".h") name = name.replace(".h", "") - return Header(base, name) + return Header(base, name, SDL_lib_include_root[base]) headers = [ @@ -160,22 +167,26 @@ headers = [ add("SDL3/SDL_version.h"), add("SDL3/SDL_video.h"), add("SDL3/SDL_vulkan.h"), + add("SDL3_image/SDL_image.h"), + add("SDL3_ttf/SDL_ttf.h"), + add("SDL3_ttf/SDL_textengine.h"), ] def prepare_sdl_source(): - subprocess.run([ - "git", - "reset", - "--hard", - "HEAD" - ], cwd=SDL_root) + for lib in SDL_libs: + subprocess.run([ + "git", + "reset", + "--hard", + "HEAD" + ], cwd=repository_root / SDL_lib_root / lib) def get_sdl_api_dump(): subprocess.run([ sys.executable, - SDL_root / "src" / "dynapi" / "gendynapi.py", + repository_root / SDL_lib_root / "SDL" / "src" / "dynapi" / "gendynapi.py", "--dump" ]) @@ -250,9 +261,11 @@ base_command = [ "windows-types", "generate-macro-bindings", - "--file-directory", SDL_include_root, - "--include-directory", SDL_include_root, - "--libraryPath", "SDL3", + "--file-directory", repository_root, + "--include-directory", repository_root / SDL_lib_include_root["SDL3"], + "--include-directory", repository_root / SDL_lib_include_root["SDL3_image"], + "--include-directory", repository_root / SDL_lib_include_root["SDL3_ttf"], +# "--libraryPath", "SDL3", "--methodClassName", "SDL3", "--namespace", "SDL", @@ -295,6 +308,7 @@ def run_clangsharp(command, header: Header): cmd = command + [ "--file", header.input_file(), "--output", header.output_file(), + "--libraryPath", header.base, ] for rsp in header.rsp_files(): From 1e786197161982199a85fa9163280263383cb221 Mon Sep 17 00:00:00 2001 From: WizzardMaker Date: Tue, 3 Dec 2024 12:20:09 +0100 Subject: [PATCH 02/23] updated c# source generator to also take other SDL methods into account --- .../UnfriendlyMethodFinder.cs | 33 +++++++++++++++++-- SDL3-CS/SDL3/ClangSharp/SDL_audio.g.cs | 1 - SDL3-CS/SDL3/ClangSharp/SDL_pixels.g.cs | 2 -- SDL3-CS/generate_bindings.py | 1 - 4 files changed, 31 insertions(+), 6 deletions(-) diff --git a/SDL3-CS.SourceGeneration/UnfriendlyMethodFinder.cs b/SDL3-CS.SourceGeneration/UnfriendlyMethodFinder.cs index 7f5461f..4554ede 100644 --- a/SDL3-CS.SourceGeneration/UnfriendlyMethodFinder.cs +++ b/SDL3-CS.SourceGeneration/UnfriendlyMethodFinder.cs @@ -15,14 +15,43 @@ namespace SDL.SourceGeneration { public readonly Dictionary> Methods = new Dictionary>(); + /// + /// Checks whether the method is from any SDL library. + /// It identifies those by checking if the method has a DllImport attribute for a library starting with "SDL". + /// + private static bool IsMethodFromSDL(MethodDeclarationSyntax methodNode) + { + if (methodNode.AttributeLists.Count == 0) + return false; + + foreach (var attributeList in methodNode.AttributeLists) + { + foreach (var attribute in attributeList.Attributes) + { + if (attribute.Name.ToString() != "DllImport") continue; + if (attribute.ArgumentList == null || attribute.ArgumentList.Arguments.Count <= 0) continue; // this should never happen, but rather continue than throw + + var libraryNameArgument = attribute.ArgumentList.Arguments[0]; + + if (libraryNameArgument.Expression is LiteralExpressionSyntax literal && + literal.Token.ValueText.StartsWith("SDL", StringComparison.Ordinal)) + { + return true; + } + } + } + + return false; + } + public void OnVisitSyntaxNode(SyntaxNode syntaxNode) { if (syntaxNode is MethodDeclarationSyntax method) { string name = method.Identifier.ValueText; - bool isUnsafe = name.StartsWith($"{Helper.UnsafePrefix}SDL_", StringComparison.Ordinal); + bool isUnsafe = name.StartsWith($"{Helper.UnsafePrefix}", StringComparison.Ordinal); - if (!name.StartsWith("SDL_", StringComparison.Ordinal) && !isUnsafe) + if (!IsMethodFromSDL(method) && !isUnsafe) return; if (method.ParameterList.Parameters.Any(p => p.Identifier.IsKind(SyntaxKind.ArgListKeyword))) diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_audio.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_audio.g.cs index addb1b8..de63476 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_audio.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_audio.g.cs @@ -28,7 +28,6 @@ using System.Runtime.InteropServices; namespace SDL { - [NativeTypeName("int")] public enum SDL_AudioFormat : uint { SDL_AUDIO_UNKNOWN = 0x0000U, diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_pixels.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_pixels.g.cs index b963cec..aae40df 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_pixels.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_pixels.g.cs @@ -89,7 +89,6 @@ namespace SDL SDL_PACKEDLAYOUT_1010102, } - [NativeTypeName("int")] public enum SDL_PixelFormat : uint { SDL_PIXELFORMAT_UNKNOWN = 0, @@ -240,7 +239,6 @@ namespace SDL SDL_CHROMA_LOCATION_TOPLEFT = 3, } - [NativeTypeName("int")] public enum SDL_Colorspace : uint { SDL_COLORSPACE_UNKNOWN = 0, diff --git a/SDL3-CS/generate_bindings.py b/SDL3-CS/generate_bindings.py index 7eaad20..023e294 100644 --- a/SDL3-CS/generate_bindings.py +++ b/SDL3-CS/generate_bindings.py @@ -265,7 +265,6 @@ base_command = [ "--include-directory", repository_root / SDL_lib_include_root["SDL3"], "--include-directory", repository_root / SDL_lib_include_root["SDL3_image"], "--include-directory", repository_root / SDL_lib_include_root["SDL3_ttf"], -# "--libraryPath", "SDL3", "--methodClassName", "SDL3", "--namespace", "SDL", From af476b4cc4357abdfb2a9e1ec46677addf2f1c0e Mon Sep 17 00:00:00 2001 From: WizzardMaker Date: Tue, 3 Dec 2024 13:30:45 +0100 Subject: [PATCH 03/23] added sister projects to visible internals in SDL3-CS --- SDL3-CS/Properties/AssemblyInfo.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/SDL3-CS/Properties/AssemblyInfo.cs b/SDL3-CS/Properties/AssemblyInfo.cs index 4fabb01..1572169 100644 --- a/SDL3-CS/Properties/AssemblyInfo.cs +++ b/SDL3-CS/Properties/AssemblyInfo.cs @@ -4,3 +4,7 @@ using System.Runtime.CompilerServices; [assembly: InternalsVisibleTo("SDL3-CS.Tests")] + +// Allow access to internal CodeGen members (e.g. NativeTypeNameAttribute, etc.) for SDL sister projects: +[assembly: InternalsVisibleTo("SDL3_ttf-CS")] +[assembly: InternalsVisibleTo("SDL3_image-CS")] From 52c2c1b31e69eef5e46fb917a56a4065720f21a9 Mon Sep 17 00:00:00 2001 From: WizzardMaker Date: Tue, 3 Dec 2024 13:32:37 +0100 Subject: [PATCH 04/23] split up sdl libraries into separate projects --- SDL3-CS.Android.slnf | 2 + SDL3-CS.Desktop.slnf | 2 + .../FriendlyOverloadGenerator.cs | 18 ++- .../UnfriendlyMethodFinder.cs | 27 +--- SDL3-CS.iOS.slnf | 2 + SDL3-CS.sln | 12 ++ SDL3-CS/SDL3-CS.csproj | 4 +- SDL3-CS/generate_bindings.py | 15 +- SDL3_image-CS/SDL3_image-CS.csproj | 138 ++++++++++++++++++ .../SDL3_image/ClangSharp/SDL_image.g.cs | 2 +- SDL3_ttf-CS/SDL3_ttf-CS.csproj | 102 +++++++++++++ .../SDL3_ttf/ClangSharp/SDL_textengine.g.cs | 0 .../SDL3_ttf/ClangSharp/SDL_ttf.g.cs | 2 +- 13 files changed, 294 insertions(+), 32 deletions(-) create mode 100644 SDL3_image-CS/SDL3_image-CS.csproj rename {SDL3-CS => SDL3_image-CS}/SDL3_image/ClangSharp/SDL_image.g.cs (99%) create mode 100644 SDL3_ttf-CS/SDL3_ttf-CS.csproj rename {SDL3-CS => SDL3_ttf-CS}/SDL3_ttf/ClangSharp/SDL_textengine.g.cs (100%) rename {SDL3-CS => SDL3_ttf-CS}/SDL3_ttf/ClangSharp/SDL_ttf.g.cs (99%) diff --git a/SDL3-CS.Android.slnf b/SDL3-CS.Android.slnf index 061ae2f..8bef5a4 100644 --- a/SDL3-CS.Android.slnf +++ b/SDL3-CS.Android.slnf @@ -3,6 +3,8 @@ "path": "SDL3-CS.sln", "projects": [ "SDL3-CS\\SDL3-CS.csproj", + "SDL3_ttf-CS\\SDL3-CS_ttf.csproj", + "SDL3_image-CS\\SDL3_image-CS.csproj", "SDL3-CS.SourceGeneration\\SDL3-CS.SourceGeneration.csproj", "SDL3-CS.Android\\SDL3-CS.Android.csproj", "SDL3-CS.Tests\\SDL3-CS.Tests.csproj", diff --git a/SDL3-CS.Desktop.slnf b/SDL3-CS.Desktop.slnf index dba27f4..7eb442c 100644 --- a/SDL3-CS.Desktop.slnf +++ b/SDL3-CS.Desktop.slnf @@ -3,6 +3,8 @@ "path": "SDL3-CS.sln", "projects": [ "SDL3-CS\\SDL3-CS.csproj", + "SDL3_ttf-CS\\SDL3-CS_ttf.csproj", + "SDL3_image-CS\\SDL3_image-CS.csproj", "SDL3-CS.SourceGeneration\\SDL3-CS.SourceGeneration.csproj", "SDL3-CS.Tests\\SDL3-CS.Tests.csproj", "SDL3-CS.Tests.Desktop\\SDL3-CS.Tests.Desktop.csproj" diff --git a/SDL3-CS.SourceGeneration/FriendlyOverloadGenerator.cs b/SDL3-CS.SourceGeneration/FriendlyOverloadGenerator.cs index ce1538d..a65f8e3 100644 --- a/SDL3-CS.SourceGeneration/FriendlyOverloadGenerator.cs +++ b/SDL3-CS.SourceGeneration/FriendlyOverloadGenerator.cs @@ -5,6 +5,7 @@ using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Text; + using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CSharp; using Microsoft.CodeAnalysis.CSharp.Syntax; @@ -32,9 +33,14 @@ using System; foreach (var kvp in finder.Methods) { + if (kvp.Value.Count == 0) + return; + string filename = kvp.Key; var foundMethods = kvp.Value; + string className = ClassNameFromMethod(foundMethods.First().NativeMethod); + var result = new StringBuilder(); result.Append(file_header); result.Append( @@ -42,7 +48,7 @@ using System; SyntaxFactory.IdentifierName("SDL")) .WithMembers( SyntaxFactory.SingletonList( - SyntaxFactory.ClassDeclaration("SDL3") + SyntaxFactory.ClassDeclaration(className) .WithModifiers( SyntaxFactory.TokenList( SyntaxFactory.Token(SyntaxKind.UnsafeKeyword), @@ -54,6 +60,16 @@ using System; } } + private static string ClassNameFromMethod(MethodDeclarationSyntax methodNode) + { + if (methodNode.Parent is ClassDeclarationSyntax classDeclaration) + { + return classDeclaration.Identifier.Text; + } + + return "SDL3"; // fallback! + } + private static MemberDeclarationSyntax makeFriendlyMethod(GeneratedMethod gm) { var returnType = gm.RequiredChanges.HasFlag(Changes.ChangeReturnTypeToString) diff --git a/SDL3-CS.SourceGeneration/UnfriendlyMethodFinder.cs b/SDL3-CS.SourceGeneration/UnfriendlyMethodFinder.cs index 4554ede..24eeb9f 100644 --- a/SDL3-CS.SourceGeneration/UnfriendlyMethodFinder.cs +++ b/SDL3-CS.SourceGeneration/UnfriendlyMethodFinder.cs @@ -5,6 +5,7 @@ using System; using System.Collections.Generic; using System.IO; using System.Linq; + using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CSharp; using Microsoft.CodeAnalysis.CSharp.Syntax; @@ -15,33 +16,19 @@ namespace SDL.SourceGeneration { public readonly Dictionary> Methods = new Dictionary>(); + private static readonly string[] sdlPrefixes = ["SDL", "TTF", "IMG"]; + /// /// Checks whether the method is from any SDL library. - /// It identifies those by checking if the method has a DllImport attribute for a library starting with "SDL". + /// It identifies those by checking the SDL prefix in the method name. /// private static bool IsMethodFromSDL(MethodDeclarationSyntax methodNode) { - if (methodNode.AttributeLists.Count == 0) + string? libraryPrefix = methodNode.Identifier.ValueText.Split('_').FirstOrDefault(); + if (libraryPrefix == null) return false; - foreach (var attributeList in methodNode.AttributeLists) - { - foreach (var attribute in attributeList.Attributes) - { - if (attribute.Name.ToString() != "DllImport") continue; - if (attribute.ArgumentList == null || attribute.ArgumentList.Arguments.Count <= 0) continue; // this should never happen, but rather continue than throw - - var libraryNameArgument = attribute.ArgumentList.Arguments[0]; - - if (libraryNameArgument.Expression is LiteralExpressionSyntax literal && - literal.Token.ValueText.StartsWith("SDL", StringComparison.Ordinal)) - { - return true; - } - } - } - - return false; + return sdlPrefixes.Contains(libraryPrefix); } public void OnVisitSyntaxNode(SyntaxNode syntaxNode) diff --git a/SDL3-CS.iOS.slnf b/SDL3-CS.iOS.slnf index 321cc23..957e7fa 100644 --- a/SDL3-CS.iOS.slnf +++ b/SDL3-CS.iOS.slnf @@ -3,6 +3,8 @@ "path": "SDL3-CS.sln", "projects": [ "SDL3-CS\\SDL3-CS.csproj", + "SDL3_ttf-CS\\SDL3-CS_ttf.csproj", + "SDL3_image-CS\\SDL3_image-CS.csproj", "SDL3-CS.SourceGeneration\\SDL3-CS.SourceGeneration.csproj", "SDL3-CS.Tests\\SDL3-CS.Tests.csproj", "SDL3-CS.Tests.iOS\\SDL3-CS.Tests.iOS.csproj" diff --git a/SDL3-CS.sln b/SDL3-CS.sln index a7f2209..c0b2111 100644 --- a/SDL3-CS.sln +++ b/SDL3-CS.sln @@ -27,6 +27,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SDL3-CS.Tests.iOS", "SDL3-C EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SDL3-CS.Tests.Desktop", "SDL3-CS.Tests.Desktop\SDL3-CS.Tests.Desktop.csproj", "{7E8D719A-5B69-43B7-A9D5-385B6FE7F411}" EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SDL3_ttf-CS", "SDL3_ttf-CS\SDL3_ttf-CS.csproj", "{8E37EB82-ACC4-4656-A6E5-DB298AE72066}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SDL3_image-CS", "SDL3_image-CS\SDL3_image-CS.csproj", "{A0D6FC5F-BA26-4298-ABF0-234D2481E323}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -61,6 +65,14 @@ Global {7E8D719A-5B69-43B7-A9D5-385B6FE7F411}.Debug|Any CPU.Build.0 = Debug|Any CPU {7E8D719A-5B69-43B7-A9D5-385B6FE7F411}.Release|Any CPU.ActiveCfg = Release|Any CPU {7E8D719A-5B69-43B7-A9D5-385B6FE7F411}.Release|Any CPU.Build.0 = Release|Any CPU + {8E37EB82-ACC4-4656-A6E5-DB298AE72066}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8E37EB82-ACC4-4656-A6E5-DB298AE72066}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8E37EB82-ACC4-4656-A6E5-DB298AE72066}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8E37EB82-ACC4-4656-A6E5-DB298AE72066}.Release|Any CPU.Build.0 = Release|Any CPU + {A0D6FC5F-BA26-4298-ABF0-234D2481E323}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A0D6FC5F-BA26-4298-ABF0-234D2481E323}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A0D6FC5F-BA26-4298-ABF0-234D2481E323}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A0D6FC5F-BA26-4298-ABF0-234D2481E323}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/SDL3-CS/SDL3-CS.csproj b/SDL3-CS/SDL3-CS.csproj index dd15bdd..94fde2d 100644 --- a/SDL3-CS/SDL3-CS.csproj +++ b/SDL3-CS/SDL3-CS.csproj @@ -73,8 +73,8 @@ runtimes/linux-arm/native true - - runtimes/ios/native + + runtimes/ios/native/SDL3.xcframework true diff --git a/SDL3-CS/generate_bindings.py b/SDL3-CS/generate_bindings.py index 023e294..52addbf 100644 --- a/SDL3-CS/generate_bindings.py +++ b/SDL3-CS/generate_bindings.py @@ -73,22 +73,22 @@ class Header: def output_file(self): """Location of generated C# file.""" if self.output_suffix is None: - return csproj_root / f"{self.base}/ClangSharp/{self.name}.g.cs" + return repository_root / f"{self.base}-CS" / f"{self.base}/ClangSharp/{self.name}.g.cs" else: - return csproj_root / f"{self.base}/ClangSharp/{self.name}.{self.output_suffix}.g.cs" + return repository_root / f"{self.base}-CS" / f"{self.base}/ClangSharp/{self.name}.{self.output_suffix}.g.cs" def rsp_files(self): """Location of ClangSharp response files.""" - yield csproj_root / f"{self.base}/{self.name}.rsp" + yield repository_root / f"{self.base}-CS" / f"{self.base}/{self.name}.rsp" if self.output_suffix is not None: - yield csproj_root / f"{self.base}/{self.name}.{self.output_suffix}.rsp" + yield repository_root / f"{self.base}-CS" / f"{self.base}/{self.name}.{self.output_suffix}.rsp" def cs_file(self): """Location of the manually-written C# file that implements some parts of the header.""" if self.output_suffix is None: - return csproj_root / f"{self.base}/{self.name}.cs" + return repository_root / f"{self.base}-CS" / f"{self.base}/{self.name}.cs" else: - return csproj_root / f"{self.base}/{self.name}.{self.output_suffix}.cs" + return repository_root / f"{self.base}-CS" / f"{self.base}/{self.name}.{self.output_suffix}.cs" def make_header_fuzzy(s: str) -> Header: @@ -265,7 +265,6 @@ base_command = [ "--include-directory", repository_root / SDL_lib_include_root["SDL3"], "--include-directory", repository_root / SDL_lib_include_root["SDL3_image"], "--include-directory", repository_root / SDL_lib_include_root["SDL3_ttf"], - "--methodClassName", "SDL3", "--namespace", "SDL", "--remap", @@ -308,6 +307,8 @@ def run_clangsharp(command, header: Header): "--file", header.input_file(), "--output", header.output_file(), "--libraryPath", header.base, + + "--methodClassName", header.base, ] for rsp in header.rsp_files(): diff --git a/SDL3_image-CS/SDL3_image-CS.csproj b/SDL3_image-CS/SDL3_image-CS.csproj new file mode 100644 index 0000000..d594c0b --- /dev/null +++ b/SDL3_image-CS/SDL3_image-CS.csproj @@ -0,0 +1,138 @@ + + + + net8.0 + SDL + enable + true + $(NoWarn);SYSLIB1054;CA1401 + + + + ppy Pty Ltd + ppy Pty Ltd + Copyright (c) 2024 ppy Pty Ltd + ppy.SDL3_image-CS + ppy.SDL3_image-CS + Automated release. + MIT + https://github.com/ppy/SDL3-CS + https://github.com/ppy/SDL3-CS + + + + + + + + + + + all + + + + all + + + + all + + + + + + runtimes/win-x64/native + true + + + runtimes/win-arm64/native + true + + + runtimes/win-x86/native + true + + + runtimes/win-x64/native + true + + + runtimes/win-arm64/native + true + + + runtimes/win-x86/native + true + + + runtimes/win-x64/native + true + + + runtimes/win-arm64/native + true + + + runtimes/win-x86/native + true + + + runtimes/win-x64/native + true + + + runtimes/win-arm64/native + true + + + runtimes/win-x86/native + true + + + runtimes/osx-x64/native + true + + + runtimes/osx-arm64/native + true + + + runtimes/linux-x64/native + true + + + runtimes/linux-x86/native + true + + + runtimes/linux-arm64/native + true + + + runtimes/linux-arm/native + true + + + runtimes/ios/native/SDL3.xcframework + true + + + runtimes/android-arm/native + true + + + runtimes/android-arm64/native + true + + + runtimes/android-x64/native + true + + + runtimes/android-x86/native + true + + + + diff --git a/SDL3-CS/SDL3_image/ClangSharp/SDL_image.g.cs b/SDL3_image-CS/SDL3_image/ClangSharp/SDL_image.g.cs similarity index 99% rename from SDL3-CS/SDL3_image/ClangSharp/SDL_image.g.cs rename to SDL3_image-CS/SDL3_image/ClangSharp/SDL_image.g.cs index aaa6500..7be3e82 100644 --- a/SDL3-CS/SDL3_image/ClangSharp/SDL_image.g.cs +++ b/SDL3_image-CS/SDL3_image/ClangSharp/SDL_image.g.cs @@ -40,7 +40,7 @@ namespace SDL public int* delays; } - public static unsafe partial class SDL3 + public static unsafe partial class SDL3_image { [DllImport("SDL3_image", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern int IMG_Version(); diff --git a/SDL3_ttf-CS/SDL3_ttf-CS.csproj b/SDL3_ttf-CS/SDL3_ttf-CS.csproj new file mode 100644 index 0000000..0c8eec4 --- /dev/null +++ b/SDL3_ttf-CS/SDL3_ttf-CS.csproj @@ -0,0 +1,102 @@ + + + + net8.0 + SDL + enable + true + $(NoWarn);SYSLIB1054;CA1401 + + + + ppy Pty Ltd + ppy Pty Ltd + Copyright (c) 2024 ppy Pty Ltd + ppy.SDL3_ttf-CS + ppy.SDL3_ttf-CS + Automated release. + MIT + https://github.com/ppy/SDL3-CS + https://github.com/ppy/SDL3-CS + + + + + + + + + + + all + + + + all + + + + all + + + + + + runtimes/win-x64/native + true + + + runtimes/win-arm64/native + true + + + runtimes/win-x86/native + true + + + runtimes/osx-x64/native + true + + + runtimes/osx-arm64/native + true + + + runtimes/linux-x64/native + true + + + runtimes/linux-x86/native + true + + + runtimes/linux-arm64/native + true + + + runtimes/linux-arm/native + true + + + runtimes/ios/native/SDL3.xcframework + true + + + runtimes/android-arm/native + true + + + runtimes/android-arm64/native + true + + + runtimes/android-x64/native + true + + + runtimes/android-x86/native + true + + + + diff --git a/SDL3-CS/SDL3_ttf/ClangSharp/SDL_textengine.g.cs b/SDL3_ttf-CS/SDL3_ttf/ClangSharp/SDL_textengine.g.cs similarity index 100% rename from SDL3-CS/SDL3_ttf/ClangSharp/SDL_textengine.g.cs rename to SDL3_ttf-CS/SDL3_ttf/ClangSharp/SDL_textengine.g.cs diff --git a/SDL3-CS/SDL3_ttf/ClangSharp/SDL_ttf.g.cs b/SDL3_ttf-CS/SDL3_ttf/ClangSharp/SDL_ttf.g.cs similarity index 99% rename from SDL3-CS/SDL3_ttf/ClangSharp/SDL_ttf.g.cs rename to SDL3_ttf-CS/SDL3_ttf/ClangSharp/SDL_ttf.g.cs index fe13e1a..8134818 100644 --- a/SDL3-CS/SDL3_ttf/ClangSharp/SDL_ttf.g.cs +++ b/SDL3_ttf-CS/SDL3_ttf/ClangSharp/SDL_ttf.g.cs @@ -84,7 +84,7 @@ namespace SDL public SDL_Rect rect; } - public static unsafe partial class SDL3 + public static unsafe partial class SDL3_ttf { [DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern int TTF_Version(); From 957e29d137b8922b30c26c6dff617426a2ed5a63 Mon Sep 17 00:00:00 2001 From: WizzardMaker Date: Tue, 3 Dec 2024 14:14:29 +0100 Subject: [PATCH 05/23] updated SDL build script to build ttf and image --- External/build.sh | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/External/build.sh b/External/build.sh index 9a715ed..8ea5241 100755 --- a/External/build.sh +++ b/External/build.sh @@ -102,4 +102,48 @@ elif [[ $RUNNER_OS == 'macOS' ]]; then cp SDL/install_output/lib/libSDL3.dylib ../native/$NAME/libSDL3.dylib fi +# Build SDL_image +pushd SDL_image >/dev/null +git reset --hard HEAD +# -DSDLIMAGE_AVIF=OFF is used because windows requires special setup to build avif support (nasm) +# TODO: Add support for avif on windows (VisualC script uses dynamic imports) +cmake -B build $FLAGS -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DSDL_SHARED_ENABLED_BY_DEFAULT=ON -DSDL_STATIC_ENABLED_BY_DEFAULT=ON -DCMAKE_PREFIX_PATH="../SDL/install_output/cmake/" -DSDLIMAGE_AVIF=OFF +cmake --build build/ --config Release +$SUDO cmake --install build/ --prefix install_output --config Release +popd >/dev/null + +# Move build lib into correct folders +if [[ $RUNNER_OS == 'Windows' ]]; then + cp SDL_image/install_output/bin/SDL3_image.dll ../native/$NAME/SDL3_image.dll + cp SDL_image/install_output/bin/libwebp.dll ../native/$NAME/libwebp.dll + cp SDL_image/install_output/bin/libwebpdemux.dll ../native/$NAME/libwebpdemux.dll + cp SDL_image/install_output/bin/tiff.dll ../native/$NAME/tiff.dll +elif [[ $RUNNER_OS == 'Linux' ]]; then + cp SDL_image/install_output/lib/libSDL3_image.so ../native/$NAME/libSDL3_image.so + # TODO: find out if webp, etc. are also needed on linux here +elif [[ $RUNNER_OS == 'macOS' ]]; then + cp SDL_image/install_output/lib/libSDL3_image.dylib ../native/$NAME/libSDL3_image.dylib + # TODO: find out if webp, etc. are also needed on macOS here +fi + + +# Build SDL_ttf +pushd SDL_ttf >/dev/null +git reset --hard HEAD +cmake -B build $FLAGS -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DSDL_SHARED_ENABLED_BY_DEFAULT=ON -DSDL_STATIC_ENABLED_BY_DEFAULT=ON -DCMAKE_PREFIX_PATH="../SDL/install_output/cmake/" +cmake --build build/ --config Release +$SUDO cmake --install build/ --prefix install_output --config Release +popd >/dev/null + +# Move build lib into correct folders +if [[ $RUNNER_OS == 'Windows' ]]; then + cp SDL3_ttf/install_output/bin/SDL3_ttf.dll ../native/$NAME/SDL3_ttf.dll +elif [[ $RUNNER_OS == 'Linux' ]]; then + cp SDL3_ttf/install_output/lib/libSDL3_ttf.so ../native/$NAME/libSDL3_ttf.so +elif [[ $RUNNER_OS == 'macOS' ]]; then + cp SDL3_ttf/install_output/lib/libSDL3_ttf.dylib ../native/$NAME/libSDL3_ttf.dylib +fi + + +# pop External popd >/dev/null From 06fabcf8b0d94c1ba4c1110704ac1518728590c8 Mon Sep 17 00:00:00 2001 From: WizzardMaker Date: Tue, 3 Dec 2024 15:36:08 +0100 Subject: [PATCH 06/23] added enums to ttf and image --- SDL3-CS/generate_bindings.py | 5 ++-- .../SDL3_image/ClangSharp/SDL_image.g.cs | 6 +---- SDL3_image-CS/SDL3_image/SDL_image.cs | 25 +++++++++++++++++++ SDL3_ttf-CS/SDL3_ttf/ClangSharp/SDL_ttf.g.cs | 6 +---- SDL3_ttf-CS/SDL3_ttf/SDL_ttf.cs | 23 +++++++++++++++++ 5 files changed, 52 insertions(+), 13 deletions(-) create mode 100644 SDL3_image-CS/SDL3_image/SDL_image.cs create mode 100644 SDL3_ttf-CS/SDL3_ttf/SDL_ttf.cs diff --git a/SDL3-CS/generate_bindings.py b/SDL3-CS/generate_bindings.py index 52addbf..9a784fc 100644 --- a/SDL3-CS/generate_bindings.py +++ b/SDL3-CS/generate_bindings.py @@ -221,7 +221,7 @@ def check_generated_functions(sdl_api, header, generated_file_paths): print(f"[⚠️ Warning] Function {name} not found in generated files:", *generated_file_paths) -defined_constant_regex = re.compile(r"\[Constant]\s*public (const|static readonly) \w+ (SDL_\w+) = ", re.MULTILINE) +defined_constant_regex = re.compile(r"\[Constant]\s*public (const|static readonly) \w+ (\w+_\w+) = ", re.MULTILINE) def get_manually_written_symbols(header): @@ -232,11 +232,10 @@ def get_manually_written_symbols(header): text = f.read() for match in defined_constant_regex.finditer(text): m = match.group(2) - assert m.startswith("SDL_") yield m -typedef_enum_regex = re.compile(r"\[Typedef]\s*public enum (SDL_\w+)", re.MULTILINE) +typedef_enum_regex = re.compile(r"\[Typedef]\s*public enum (\w+_\w+)", re.MULTILINE) def get_typedefs(): diff --git a/SDL3_image-CS/SDL3_image/ClangSharp/SDL_image.g.cs b/SDL3_image-CS/SDL3_image/ClangSharp/SDL_image.g.cs index 7be3e82..d182ae2 100644 --- a/SDL3_image-CS/SDL3_image/ClangSharp/SDL_image.g.cs +++ b/SDL3_image-CS/SDL3_image/ClangSharp/SDL_image.g.cs @@ -46,8 +46,7 @@ namespace SDL public static extern int IMG_Version(); [DllImport("SDL3_image", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("IMG_InitFlags")] - public static extern uint IMG_Init([NativeTypeName("IMG_InitFlags")] uint flags); + public static extern IMG_InitFlags IMG_Init(IMG_InitFlags flags); [DllImport("SDL3_image", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern void IMG_Quit(); @@ -259,9 +258,6 @@ namespace SDL [NativeTypeName("#define SDL_IMAGE_MICRO_VERSION 0")] public const int SDL_IMAGE_MICRO_VERSION = 0; - [NativeTypeName("#define SDL_IMAGE_VERSION SDL_VERSIONNUM(SDL_IMAGE_MAJOR_VERSION, SDL_IMAGE_MINOR_VERSION, SDL_IMAGE_MICRO_VERSION)")] - public const int SDL_IMAGE_VERSION = ((3) * 1000000 + (1) * 1000 + (0)); - [NativeTypeName("#define IMG_INIT_JPG 0x00000001")] public const int IMG_INIT_JPG = 0x00000001; diff --git a/SDL3_image-CS/SDL3_image/SDL_image.cs b/SDL3_image-CS/SDL3_image/SDL_image.cs new file mode 100644 index 0000000..275bf23 --- /dev/null +++ b/SDL3_image-CS/SDL3_image/SDL_image.cs @@ -0,0 +1,25 @@ +// Copyright (c) ppy Pty Ltd . 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 IMG_InitFlags : int + { + IMG_INIT_JPG = SDL3_image.IMG_INIT_JPG, + IMG_INIT_PNG = SDL3_image.IMG_INIT_PNG, + IMG_INIT_TIF = SDL3_image.IMG_INIT_TIF, + IMG_INIT_WEBP = SDL3_image.IMG_INIT_WEBP, + IMG_INIT_JXL = SDL3_image.IMG_INIT_JXL, + IMG_INIT_AVIF = SDL3_image.IMG_INIT_AVIF, + } + + public static unsafe partial class SDL3_image + { + [Constant] + public static readonly int SDL_IMAGE_VERSION = SDL3.SDL_VERSIONNUM(SDL_IMAGE_MAJOR_VERSION, SDL_IMAGE_MINOR_VERSION, SDL_IMAGE_MICRO_VERSION); + } +} diff --git a/SDL3_ttf-CS/SDL3_ttf/ClangSharp/SDL_ttf.g.cs b/SDL3_ttf-CS/SDL3_ttf/ClangSharp/SDL_ttf.g.cs index 8134818..80e71eb 100644 --- a/SDL3_ttf-CS/SDL3_ttf/ClangSharp/SDL_ttf.g.cs +++ b/SDL3_ttf-CS/SDL3_ttf/ClangSharp/SDL_ttf.g.cs @@ -70,8 +70,7 @@ namespace SDL public partial struct TTF_SubString { - [NativeTypeName("TTF_SubStringFlags")] - public uint flags; + public TTF_SubStringFlags flags; public int offset; @@ -434,9 +433,6 @@ namespace SDL [NativeTypeName("#define SDL_TTF_MICRO_VERSION 0")] public const int SDL_TTF_MICRO_VERSION = 0; - [NativeTypeName("#define SDL_TTF_VERSION SDL_VERSIONNUM(SDL_TTF_MAJOR_VERSION, SDL_TTF_MINOR_VERSION, SDL_TTF_MICRO_VERSION)")] - public const int SDL_TTF_VERSION = ((3) * 1000000 + (0) * 1000 + (0)); - [NativeTypeName("#define TTF_PROP_FONT_CREATE_FILENAME_STRING \"SDL_ttf.font.create.filename\"")] public static ReadOnlySpan TTF_PROP_FONT_CREATE_FILENAME_STRING => "SDL_ttf.font.create.filename"u8; diff --git a/SDL3_ttf-CS/SDL3_ttf/SDL_ttf.cs b/SDL3_ttf-CS/SDL3_ttf/SDL_ttf.cs new file mode 100644 index 0000000..c1a9b08 --- /dev/null +++ b/SDL3_ttf-CS/SDL3_ttf/SDL_ttf.cs @@ -0,0 +1,23 @@ +// Copyright (c) ppy Pty Ltd . 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 TTF_SubStringFlags : int + { + TTF_SUBSTRING_TEXT_START = SDL3_ttf.TTF_SUBSTRING_TEXT_START, + TTF_SUBSTRING_LINE_START = SDL3_ttf.TTF_SUBSTRING_LINE_START, + TTF_SUBSTRING_LINE_END = SDL3_ttf.TTF_SUBSTRING_LINE_END, + TTF_SUBSTRING_TEXT_END = SDL3_ttf.TTF_SUBSTRING_TEXT_END, + } + + public static unsafe partial class SDL3_ttf + { + [Constant] + public static readonly int SDL_TTF_VERSION = SDL3.SDL_VERSIONNUM(SDL_TTF_MAJOR_VERSION, SDL_TTF_MINOR_VERSION, SDL_TTF_MICRO_VERSION); + } +} From 8e928a4f2e87f8a8a39047813bd6dc9b2820bc95 Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Mon, 9 Dec 2024 10:31:25 +0900 Subject: [PATCH 07/23] Fix filtered solutions --- SDL3-CS.Android.slnf | 2 +- SDL3-CS.Desktop.slnf | 2 +- SDL3-CS.iOS.slnf | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/SDL3-CS.Android.slnf b/SDL3-CS.Android.slnf index 8bef5a4..a966f98 100644 --- a/SDL3-CS.Android.slnf +++ b/SDL3-CS.Android.slnf @@ -3,7 +3,7 @@ "path": "SDL3-CS.sln", "projects": [ "SDL3-CS\\SDL3-CS.csproj", - "SDL3_ttf-CS\\SDL3-CS_ttf.csproj", + "SDL3_ttf-CS\\SDL3_ttf-CS.csproj", "SDL3_image-CS\\SDL3_image-CS.csproj", "SDL3-CS.SourceGeneration\\SDL3-CS.SourceGeneration.csproj", "SDL3-CS.Android\\SDL3-CS.Android.csproj", diff --git a/SDL3-CS.Desktop.slnf b/SDL3-CS.Desktop.slnf index 7eb442c..70fda20 100644 --- a/SDL3-CS.Desktop.slnf +++ b/SDL3-CS.Desktop.slnf @@ -3,7 +3,7 @@ "path": "SDL3-CS.sln", "projects": [ "SDL3-CS\\SDL3-CS.csproj", - "SDL3_ttf-CS\\SDL3-CS_ttf.csproj", + "SDL3_ttf-CS\\SDL3_ttf-CS.csproj", "SDL3_image-CS\\SDL3_image-CS.csproj", "SDL3-CS.SourceGeneration\\SDL3-CS.SourceGeneration.csproj", "SDL3-CS.Tests\\SDL3-CS.Tests.csproj", diff --git a/SDL3-CS.iOS.slnf b/SDL3-CS.iOS.slnf index 957e7fa..73da442 100644 --- a/SDL3-CS.iOS.slnf +++ b/SDL3-CS.iOS.slnf @@ -3,7 +3,7 @@ "path": "SDL3-CS.sln", "projects": [ "SDL3-CS\\SDL3-CS.csproj", - "SDL3_ttf-CS\\SDL3-CS_ttf.csproj", + "SDL3_ttf-CS\\SDL3_ttf-CS.csproj", "SDL3_image-CS\\SDL3_image-CS.csproj", "SDL3-CS.SourceGeneration\\SDL3-CS.SourceGeneration.csproj", "SDL3-CS.Tests\\SDL3-CS.Tests.csproj", From 491a9bceaeb77d9e8f5e2f6fc391a86aaaa0dac8 Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Mon, 9 Dec 2024 10:32:37 +0900 Subject: [PATCH 08/23] Adjust SDL3-CS references --- SDL3_image-CS/SDL3_image-CS.csproj | 17 +---------------- SDL3_ttf-CS/SDL3_ttf-CS.csproj | 17 +---------------- 2 files changed, 2 insertions(+), 32 deletions(-) diff --git a/SDL3_image-CS/SDL3_image-CS.csproj b/SDL3_image-CS/SDL3_image-CS.csproj index d594c0b..6e01486 100644 --- a/SDL3_image-CS/SDL3_image-CS.csproj +++ b/SDL3_image-CS/SDL3_image-CS.csproj @@ -22,22 +22,7 @@ - - - - - - - all - - - - all - - - - all - + diff --git a/SDL3_ttf-CS/SDL3_ttf-CS.csproj b/SDL3_ttf-CS/SDL3_ttf-CS.csproj index 0c8eec4..9e0e3ee 100644 --- a/SDL3_ttf-CS/SDL3_ttf-CS.csproj +++ b/SDL3_ttf-CS/SDL3_ttf-CS.csproj @@ -22,22 +22,7 @@ - - - - - - - all - - - - all - - - - all - + From 53a87f4a740ac098e948c151f4fb81d005e9a690 Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Mon, 9 Dec 2024 10:42:27 +0900 Subject: [PATCH 09/23] Fix SDL3-CS iOS native include --- SDL3-CS/SDL3-CS.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SDL3-CS/SDL3-CS.csproj b/SDL3-CS/SDL3-CS.csproj index 94fde2d..84ef448 100644 --- a/SDL3-CS/SDL3-CS.csproj +++ b/SDL3-CS/SDL3-CS.csproj @@ -73,7 +73,7 @@ runtimes/linux-arm/native true - + runtimes/ios/native/SDL3.xcframework true From b3dec6b80cec964abdb7143fdbc89af1c6ee8b5d Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Mon, 9 Dec 2024 10:51:26 +0900 Subject: [PATCH 10/23] Refactor source generator a bit --- .../UnfriendlyMethodFinder.cs | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/SDL3-CS.SourceGeneration/UnfriendlyMethodFinder.cs b/SDL3-CS.SourceGeneration/UnfriendlyMethodFinder.cs index 24eeb9f..969c09b 100644 --- a/SDL3-CS.SourceGeneration/UnfriendlyMethodFinder.cs +++ b/SDL3-CS.SourceGeneration/UnfriendlyMethodFinder.cs @@ -5,7 +5,6 @@ using System; using System.Collections.Generic; using System.IO; using System.Linq; - using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CSharp; using Microsoft.CodeAnalysis.CSharp.Syntax; @@ -16,7 +15,7 @@ namespace SDL.SourceGeneration { public readonly Dictionary> Methods = new Dictionary>(); - private static readonly string[] sdlPrefixes = ["SDL", "TTF", "IMG"]; + private static readonly string[] sdlPrefixes = ["SDL_", "TTF_", "IMG_"]; /// /// Checks whether the method is from any SDL library. @@ -24,11 +23,13 @@ namespace SDL.SourceGeneration /// private static bool IsMethodFromSDL(MethodDeclarationSyntax methodNode) { - string? libraryPrefix = methodNode.Identifier.ValueText.Split('_').FirstOrDefault(); - if (libraryPrefix == null) - return false; + foreach (string prefix in sdlPrefixes) + { + if (methodNode.Identifier.ValueText.StartsWith(prefix, StringComparison.Ordinal)) + return true; + } - return sdlPrefixes.Contains(libraryPrefix); + return false; } public void OnVisitSyntaxNode(SyntaxNode syntaxNode) @@ -36,7 +37,7 @@ namespace SDL.SourceGeneration if (syntaxNode is MethodDeclarationSyntax method) { string name = method.Identifier.ValueText; - bool isUnsafe = name.StartsWith($"{Helper.UnsafePrefix}", StringComparison.Ordinal); + bool isUnsafe = name.StartsWith(Helper.UnsafePrefix, StringComparison.Ordinal); if (!IsMethodFromSDL(method) && !isUnsafe) return; From 1616f6056c80780136d0b9c8d830f7f678a0f1ee Mon Sep 17 00:00:00 2001 From: "MINI\\jairo" Date: Thu, 19 Jun 2025 07:08:49 -0500 Subject: [PATCH 11/23] Fix fetch submodule recursively for libtiff --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3a3372a..820caab 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -27,7 +27,7 @@ jobs: steps: - uses: actions/checkout@v4 with: - submodules: true + submodules: recursive - name: Build (Linux ARM) if: contains(matrix.platform.container, 'arm') From 318c2d8527d0f78792b74dc31afe2f98bc1a3b51 Mon Sep 17 00:00:00 2001 From: "MINI\\jairo" Date: Thu, 19 Jun 2025 07:18:20 -0500 Subject: [PATCH 12/23] Fix path for copying DLLs of SDL3_ttf --- .idea/.idea.SDL3-CS/.idea/AndroidProjectSystem.xml | 6 ++++++ External/build.sh | 14 +++++++++----- 2 files changed, 15 insertions(+), 5 deletions(-) create mode 100644 .idea/.idea.SDL3-CS/.idea/AndroidProjectSystem.xml diff --git a/.idea/.idea.SDL3-CS/.idea/AndroidProjectSystem.xml b/.idea/.idea.SDL3-CS/.idea/AndroidProjectSystem.xml new file mode 100644 index 0000000..e82600c --- /dev/null +++ b/.idea/.idea.SDL3-CS/.idea/AndroidProjectSystem.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/External/build.sh b/External/build.sh index 3fd6a8b..38b35d7 100755 --- a/External/build.sh +++ b/External/build.sh @@ -10,7 +10,11 @@ if [[ -z $NAME || -z $RUNNER_OS || -z $FLAGS ]]; then exit 1 fi -SUDO=$(which sudo || exit 0) +if [[ $RUNNER_OS == 'Windows' ]]; then + SUDO="" +else + SUDO=$(which sudo || exit 0) +fi export DEBIAN_FRONTEND=noninteractive @@ -121,18 +125,18 @@ fi # Build SDL_ttf pushd SDL_ttf git reset --hard HEAD -cmake -B build $FLAGS -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DSDL_SHARED_ENABLED_BY_DEFAULT=ON -DSDL_STATIC_ENABLED_BY_DEFAULT=ON -DCMAKE_PREFIX_PATH="../SDL/install_output/cmake/" +cmake -B build $FLAGS -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DSDL_SHARED_ENABLED_BY_DEFAULT=ON -DSDL_STATIC_ENABLED_BY_DEFAULT=ON -DCMAKE_PREFIX_PATH="../SDL/install_output/cmake/" -DCMAKE_POLICY_VERSION_MINIMUM=3.5 cmake --build build/ --config Release $SUDO cmake --install build/ --prefix install_output --config Release popd # Move build lib into correct folders if [[ $RUNNER_OS == 'Windows' ]]; then - cp SDL3_ttf/install_output/bin/SDL3_ttf.dll ../native/$NAME/SDL3_ttf.dll + cp SDL_ttf/install_output/bin/SDL3_ttf.dll ../native/$NAME/SDL3_ttf.dll elif [[ $RUNNER_OS == 'Linux' ]]; then - cp SDL3_ttf/install_output/lib/libSDL3_ttf.so ../native/$NAME/libSDL3_ttf.so + cp SDL_ttf/install_output/lib/libSDL3_ttf.so ../native/$NAME/libSDL3_ttf.so elif [[ $RUNNER_OS == 'macOS' ]]; then - cp SDL3_ttf/install_output/lib/libSDL3_ttf.dylib ../native/$NAME/libSDL3_ttf.dylib + cp SDL_ttf/install_output/lib/libSDL3_ttf.dylib ../native/$NAME/libSDL3_ttf.dylib fi popd From 49da8cf519fa2723b862ec0a08482de5296ebf8b Mon Sep 17 00:00:00 2001 From: "MINI\\jairo" Date: Thu, 19 Jun 2025 07:18:45 -0500 Subject: [PATCH 13/23] Fix path for copying DLLs of SDL3_ttf --- .idea/.idea.SDL3-CS/.idea/AndroidProjectSystem.xml | 6 ------ 1 file changed, 6 deletions(-) delete mode 100644 .idea/.idea.SDL3-CS/.idea/AndroidProjectSystem.xml diff --git a/.idea/.idea.SDL3-CS/.idea/AndroidProjectSystem.xml b/.idea/.idea.SDL3-CS/.idea/AndroidProjectSystem.xml deleted file mode 100644 index e82600c..0000000 --- a/.idea/.idea.SDL3-CS/.idea/AndroidProjectSystem.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - \ No newline at end of file From f5dcc15710f6e1e75a48aba6bf786af3dafc9174 Mon Sep 17 00:00:00 2001 From: "MINI\\jairo" Date: Thu, 19 Jun 2025 07:29:52 -0500 Subject: [PATCH 14/23] Fix path for CMAKE_PREFIX_PATH in different archs --- External/build.sh | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/External/build.sh b/External/build.sh index 38b35d7..d8b1332 100755 --- a/External/build.sh +++ b/External/build.sh @@ -98,12 +98,21 @@ elif [[ $RUNNER_OS == 'macOS' ]]; then cp SDL/install_output/lib/libSDL3.dylib ../native/$NAME/libSDL3.dylib fi +# Use the correct CMAKE_PREFIX_PATH for SDL_image and SDL_ttf, probably due differences in Cmake versions +if [[ $RUNNER_OS == 'Windows' ]]; then + CMAKE_PREFIX_PATH="../SDL/install_output/cmake/" +elif [[ $RUNNER_OS == 'Linux' ]]; then + CMAKE_PREFIX_PATH="../SDL/install_output/cmake/SDL3/" +elif [[ $RUNNER_OS == 'macOS' ]]; then + CMAKE_PREFIX_PATH="../SDL/install_output/cmake/SDL3/" +fi + # Build SDL_image pushd SDL_image git reset --hard HEAD # -DSDLIMAGE_AVIF=OFF is used because windows requires special setup to build avif support (nasm) # TODO: Add support for avif on windows (VisualC script uses dynamic imports) -cmake -B build $FLAGS -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DSDL_SHARED_ENABLED_BY_DEFAULT=ON -DSDL_STATIC_ENABLED_BY_DEFAULT=ON -DCMAKE_PREFIX_PATH="../SDL/install_output/cmake/" -DSDLIMAGE_AVIF=OFF +cmake -B build $FLAGS -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DSDL_SHARED_ENABLED_BY_DEFAULT=ON -DSDL_STATIC_ENABLED_BY_DEFAULT=ON -DCMAKE_PREFIX_PATH=$CMAKE_PREFIX_PATH -DSDLIMAGE_AVIF=OFF cmake --build build/ --config Release $SUDO cmake --install build/ --prefix install_output --config Release popd From 5b535590d514bd88847b1d769349314c1b3cd911 Mon Sep 17 00:00:00 2001 From: "MINI\\jairo" Date: Thu, 19 Jun 2025 07:37:52 -0500 Subject: [PATCH 15/23] Fix path for CMAKE_PREFIX_PATH in different archs --- External/build.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/External/build.sh b/External/build.sh index d8b1332..18c2295 100755 --- a/External/build.sh +++ b/External/build.sh @@ -102,9 +102,9 @@ fi if [[ $RUNNER_OS == 'Windows' ]]; then CMAKE_PREFIX_PATH="../SDL/install_output/cmake/" elif [[ $RUNNER_OS == 'Linux' ]]; then - CMAKE_PREFIX_PATH="../SDL/install_output/cmake/SDL3/" + CMAKE_PREFIX_PATH="../SDL/install_output/lib/cmake/SDL3/" elif [[ $RUNNER_OS == 'macOS' ]]; then - CMAKE_PREFIX_PATH="../SDL/install_output/cmake/SDL3/" + CMAKE_PREFIX_PATH="../SDL/install_output/lib/cmake/SDL3/" fi # Build SDL_image From 06fdeb01b3ec6ec5e74bfdacc402a75ff13cdee4 Mon Sep 17 00:00:00 2001 From: "MINI\\jairo" Date: Thu, 19 Jun 2025 07:42:09 -0500 Subject: [PATCH 16/23] Fix path for CMAKE_PREFIX_PATH in different archs --- External/build.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/External/build.sh b/External/build.sh index 18c2295..ed4f76a 100755 --- a/External/build.sh +++ b/External/build.sh @@ -102,9 +102,9 @@ fi if [[ $RUNNER_OS == 'Windows' ]]; then CMAKE_PREFIX_PATH="../SDL/install_output/cmake/" elif [[ $RUNNER_OS == 'Linux' ]]; then - CMAKE_PREFIX_PATH="../SDL/install_output/lib/cmake/SDL3/" + CMAKE_PREFIX_PATH="../SDL/install_output/lib/cmake/" elif [[ $RUNNER_OS == 'macOS' ]]; then - CMAKE_PREFIX_PATH="../SDL/install_output/lib/cmake/SDL3/" + CMAKE_PREFIX_PATH="../SDL/install_output/lib/cmake/" fi # Build SDL_image From b8f0998d8c329af8f85e5521efb8bea8f1bd50d0 Mon Sep 17 00:00:00 2001 From: "MINI\\jairo" Date: Thu, 19 Jun 2025 07:46:22 -0500 Subject: [PATCH 17/23] Fix path for CMAKE_PREFIX_PATH in different archs --- External/build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/External/build.sh b/External/build.sh index ed4f76a..9ba6979 100755 --- a/External/build.sh +++ b/External/build.sh @@ -134,7 +134,7 @@ fi # Build SDL_ttf pushd SDL_ttf git reset --hard HEAD -cmake -B build $FLAGS -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DSDL_SHARED_ENABLED_BY_DEFAULT=ON -DSDL_STATIC_ENABLED_BY_DEFAULT=ON -DCMAKE_PREFIX_PATH="../SDL/install_output/cmake/" -DCMAKE_POLICY_VERSION_MINIMUM=3.5 +cmake -B build $FLAGS -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DSDL_SHARED_ENABLED_BY_DEFAULT=ON -DSDL_STATIC_ENABLED_BY_DEFAULT=ON -DCMAKE_PREFIX_PATH=$CMAKE_PREFIX_PATH -DCMAKE_POLICY_VERSION_MINIMUM=3.5 cmake --build build/ --config Release $SUDO cmake --install build/ --prefix install_output --config Release popd From 3471b340070fd6793a3e087f7779b2fda7b88499 Mon Sep 17 00:00:00 2001 From: "MINI\\jairo" Date: Thu, 19 Jun 2025 08:15:50 -0500 Subject: [PATCH 18/23] Fix dubious ownership in repository when running in container --- .github/workflows/build.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 820caab..fbaee01 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -43,6 +43,9 @@ jobs: -e BUILD_TYPE=${{ env.BUILD_TYPE }} run: | cd /workspace + git config --global --add safe.directory /workspace/External/SDL + git config --global --add safe.directory /workspace/External/SDL_image + git config --global --add safe.directory /workspace/External/SDL_ttf ./External/build.sh - name: Build From 477bd7da13ef1c805f320809911d5a403f4941bb Mon Sep 17 00:00:00 2001 From: "MINI\\jairo" Date: Thu, 19 Jun 2025 08:27:07 -0500 Subject: [PATCH 19/23] Fix dubious ownership in repository when running in container --- .github/workflows/build.yml | 3 --- External/build.sh | 4 ++++ 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index fbaee01..820caab 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -43,9 +43,6 @@ jobs: -e BUILD_TYPE=${{ env.BUILD_TYPE }} run: | cd /workspace - git config --global --add safe.directory /workspace/External/SDL - git config --global --add safe.directory /workspace/External/SDL_image - git config --global --add safe.directory /workspace/External/SDL_ttf ./External/build.sh - name: Build diff --git a/External/build.sh b/External/build.sh index 9ba6979..8fea3bc 100755 --- a/External/build.sh +++ b/External/build.sh @@ -73,6 +73,10 @@ if [[ $RUNNER_OS == 'Linux' ]]; then libpulse-dev$TARGET_APT_ARCH \ libpipewire-0.3-dev$TARGET_APT_ARCH \ libdecor-0-dev$TARGET_APT_ARCH + + git config --global --add safe.directory /workspace/External/SDL + git config --global --add safe.directory /workspace/External/SDL_image + git config --global --add safe.directory /workspace/External/SDL_ttf fi # Build SDL From 63df878decfa97388a694582ceff28ea59fcaebe Mon Sep 17 00:00:00 2001 From: "MINI\\jairo" Date: Thu, 19 Jun 2025 09:30:43 -0500 Subject: [PATCH 20/23] Fix build for macos intel --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 820caab..1380057 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -21,7 +21,7 @@ jobs: - { name: linux-x86, os: ubuntu-22.04, flags: -GNinja -DCMAKE_C_FLAGS=-m32 -DCMAKE_CXX_FLAGS=-m32", target_apt_arch: ":i386" } - { name: linux-arm64, os: ubuntu-22.04-arm, flags: -GNinja, target_apt_arch: ":arm64", container: "arm64v8/ubuntu:22.04" } - { name: linux-arm, os: ubuntu-22.04-arm, flags: -GNinja, target_apt_arch: ":armhf", container: "arm32v7/ubuntu:22.04" } - - { name: osx-x64, os: macos-latest, flags: -DCMAKE_OSX_ARCHITECTURES=x86_64 -DCMAKE_OSX_DEPLOYMENT_TARGET=10.14 } + - { name: osx-x64, os: macos-13, flags: -DCMAKE_OSX_ARCHITECTURES=x86_64 -DCMAKE_OSX_DEPLOYMENT_TARGET=10.14 } # NOTE: macOS 11.0 is the first released supported by Apple Silicon. - { name: osx-arm64, os: macos-latest, flags: -DCMAKE_OSX_ARCHITECTURES=arm64 -DCMAKE_OSX_DEPLOYMENT_TARGET=11.0 } steps: From b0260c0d316cc10906b971003996a6ec7848177a Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Fri, 20 Jun 2025 00:32:12 +0900 Subject: [PATCH 21/23] Exclude iOS/Android libs from package --- SDL3_image-CS/SDL3_image-CS.csproj | 2 ++ SDL3_ttf-CS/SDL3_ttf-CS.csproj | 2 ++ 2 files changed, 4 insertions(+) diff --git a/SDL3_image-CS/SDL3_image-CS.csproj b/SDL3_image-CS/SDL3_image-CS.csproj index 6e01486..027c84f 100644 --- a/SDL3_image-CS/SDL3_image-CS.csproj +++ b/SDL3_image-CS/SDL3_image-CS.csproj @@ -98,6 +98,7 @@ runtimes/linux-arm/native true + diff --git a/SDL3_ttf-CS/SDL3_ttf-CS.csproj b/SDL3_ttf-CS/SDL3_ttf-CS.csproj index 9e0e3ee..212a723 100644 --- a/SDL3_ttf-CS/SDL3_ttf-CS.csproj +++ b/SDL3_ttf-CS/SDL3_ttf-CS.csproj @@ -62,6 +62,7 @@ runtimes/linux-arm/native true + From c563ecc3be86f34140289959e0269b8e732fa255 Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Fri, 20 Jun 2025 00:38:43 +0900 Subject: [PATCH 22/23] Mark test projects as non-packable --- SDL3-CS.Tests.Android/SDL3-CS.Tests.Android.csproj | 4 ++++ SDL3-CS.Tests.Desktop/SDL3-CS.Tests.Desktop.csproj | 4 ++++ SDL3-CS.Tests.iOS/SDL3-CS.Tests.iOS.csproj | 6 +++++- SDL3-CS.Tests/SDL3-CS.Tests.csproj | 4 ++++ 4 files changed, 17 insertions(+), 1 deletion(-) diff --git a/SDL3-CS.Tests.Android/SDL3-CS.Tests.Android.csproj b/SDL3-CS.Tests.Android/SDL3-CS.Tests.Android.csproj index e639325..beaa9a7 100644 --- a/SDL3-CS.Tests.Android/SDL3-CS.Tests.Android.csproj +++ b/SDL3-CS.Tests.Android/SDL3-CS.Tests.Android.csproj @@ -11,6 +11,10 @@ SDL.Tests.Android + + false + + diff --git a/SDL3-CS.Tests.Desktop/SDL3-CS.Tests.Desktop.csproj b/SDL3-CS.Tests.Desktop/SDL3-CS.Tests.Desktop.csproj index 32a9a6c..481a9d4 100644 --- a/SDL3-CS.Tests.Desktop/SDL3-CS.Tests.Desktop.csproj +++ b/SDL3-CS.Tests.Desktop/SDL3-CS.Tests.Desktop.csproj @@ -8,6 +8,10 @@ enable + + false + + diff --git a/SDL3-CS.Tests.iOS/SDL3-CS.Tests.iOS.csproj b/SDL3-CS.Tests.iOS/SDL3-CS.Tests.iOS.csproj index 31c6e93..9c23c76 100644 --- a/SDL3-CS.Tests.iOS/SDL3-CS.Tests.iOS.csproj +++ b/SDL3-CS.Tests.iOS/SDL3-CS.Tests.iOS.csproj @@ -1,4 +1,4 @@ - + net8.0-ios @@ -11,6 +11,10 @@ iPhone Developer + + false + + diff --git a/SDL3-CS.Tests/SDL3-CS.Tests.csproj b/SDL3-CS.Tests/SDL3-CS.Tests.csproj index a789eb7..db77335 100644 --- a/SDL3-CS.Tests/SDL3-CS.Tests.csproj +++ b/SDL3-CS.Tests/SDL3-CS.Tests.csproj @@ -10,6 +10,10 @@ false + + false + + From 32b5f88a5e6e554902aa193f6a1359479598c287 Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Fri, 20 Jun 2025 00:45:54 +0900 Subject: [PATCH 23/23] Adjust deploy script to build all packages --- .github/workflows/deploy.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 3f6b211..fa3220c 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -26,16 +26,16 @@ jobs: uses: android-actions/setup-android@v3 - name: Install .NET workloads - run: dotnet workload restore SDL3-CS/SDL3-CS.csproj + run: dotnet workload restore - name: Build & pack - run: dotnet pack SDL3-CS/SDL3-CS.csproj -c Release /p:Version=$(git describe --exact-match --tags HEAD) + run: dotnet pack -c Release /p:Version=$(git describe --exact-match --tags HEAD) -o artifacts - name: Upload artifact uses: actions/upload-artifact@v4 with: - name: SDL3-CS - path: SDL3-CS/bin/Release/ppy.*.nupkg + name: Packages + path: artifacts/ppy.*.nupkg - name: Publish tagged release to nuget.org - run: dotnet nuget push SDL3-CS/bin/Release/ppy.*.nupkg -s https://api.nuget.org/v3/index.json --api-key ${{secrets.NUGET_API_KEY}} + run: dotnet nuget push artifacts/ppy.*.nupkg -s https://api.nuget.org/v3/index.json --api-key ${{secrets.NUGET_API_KEY}}