diff --git a/External/SDL b/External/SDL index 7dd5e76..9ed83e7 160000 --- a/External/SDL +++ b/External/SDL @@ -1 +1 @@ -Subproject commit 7dd5e765df239986f78c9b0016e3f3023d885084 +Subproject commit 9ed83e71f6cc445316e1b599aad98fa79019544d diff --git a/External/SDL_image b/External/SDL_image index 0d418a2..925c19d 160000 --- a/External/SDL_image +++ b/External/SDL_image @@ -1 +1 @@ -Subproject commit 0d418a2a2dc562699854d9c2fc264304ec404e2c +Subproject commit 925c19db4d0bc9809fd3ac25c7e0ef771b668390 diff --git a/External/SDL_ttf b/External/SDL_ttf index 582c695..ffa54ca 160000 --- a/External/SDL_ttf +++ b/External/SDL_ttf @@ -1 +1 @@ -Subproject commit 582c6957161d6cc4d3b09cae37744bdfe3700368 +Subproject commit ffa54ca2ec6b89b4f6dc92ab113484cfa2ccc3a7 diff --git a/SDL3-CS.Tests/TestImage.cs b/SDL3-CS.Tests/TestImage.cs index 845cce2..109b379 100644 --- a/SDL3-CS.Tests/TestImage.cs +++ b/SDL3-CS.Tests/TestImage.cs @@ -14,12 +14,8 @@ namespace SDL.Tests { SDL_Init(0); - const IMG_InitFlags flags = IMG_InitFlags.IMG_INIT_PNG; - var actual = IMG_Init(flags); - try { - Assert.That(actual, Is.EqualTo(flags), SDL_GetError); Assert.That(IMG_Version(), Is.EqualTo(SDL_IMAGE_VERSION)); Assume.That("sample.png", Does.Exist); @@ -38,7 +34,6 @@ namespace SDL.Tests } finally { - IMG_Quit(); SDL_Quit(); } } diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_audio.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_audio.g.cs index b48db07..047d876 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_audio.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_audio.g.cs @@ -287,5 +287,8 @@ namespace SDL [NativeTypeName("#define SDL_AUDIO_DEVICE_DEFAULT_RECORDING ((SDL_AudioDeviceID) 0xFFFFFFFEu)")] public const SDL_AudioDeviceID SDL_AUDIO_DEVICE_DEFAULT_RECORDING = ((SDL_AudioDeviceID)(0xFFFFFFFEU)); + + [NativeTypeName("#define SDL_PROP_AUDIOSTREAM_AUTO_CLEANUP_BOOLEAN \"SDL.audiostream.auto_cleanup\"")] + public static ReadOnlySpan SDL_PROP_AUDIOSTREAM_AUTO_CLEANUP_BOOLEAN => "SDL.audiostream.auto_cleanup"u8; } } 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 d182ae2..28c4e0c 100644 --- a/SDL3_image-CS/SDL3_image/ClangSharp/SDL_image.g.cs +++ b/SDL3_image-CS/SDL3_image/ClangSharp/SDL_image.g.cs @@ -45,12 +45,6 @@ namespace SDL [DllImport("SDL3_image", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern int IMG_Version(); - [DllImport("SDL3_image", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IMG_InitFlags IMG_Init(IMG_InitFlags 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); @@ -213,7 +207,7 @@ namespace SDL [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); + public static extern SDLBool IMG_SaveAVIF_IO(SDL_Surface* surface, SDL_IOStream* dst, [NativeTypeName("bool")] SDLBool closeio, int quality); [DllImport("SDL3_image", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("bool")] @@ -221,7 +215,7 @@ namespace SDL [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); + public static extern SDLBool IMG_SavePNG_IO(SDL_Surface* surface, SDL_IOStream* dst, [NativeTypeName("bool")] SDLBool closeio); [DllImport("SDL3_image", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("bool")] @@ -229,7 +223,7 @@ namespace SDL [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); + public static extern SDLBool IMG_SaveJPG_IO(SDL_Surface* surface, SDL_IOStream* dst, [NativeTypeName("bool")] SDLBool closeio, int quality); [DllImport("SDL3_image", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern IMG_Animation* IMG_LoadAnimation([NativeTypeName("const char *")] byte* file); @@ -252,28 +246,10 @@ namespace SDL [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_MINOR_VERSION 3")] + public const int SDL_IMAGE_MINOR_VERSION = 3; [NativeTypeName("#define SDL_IMAGE_MICRO_VERSION 0")] public const int SDL_IMAGE_MICRO_VERSION = 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_image-CS/SDL3_image/SDL_image.cs b/SDL3_image-CS/SDL3_image/SDL_image.cs index ffeb286..9f8a5d0 100644 --- a/SDL3_image-CS/SDL3_image/SDL_image.cs +++ b/SDL3_image-CS/SDL3_image/SDL_image.cs @@ -1,22 +1,8 @@ // 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 : UInt32 - { - 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] diff --git a/SDL3_ttf-CS/SDL3_ttf/ClangSharp/SDL_textengine.g.cs b/SDL3_ttf-CS/SDL3_ttf/ClangSharp/SDL_textengine.g.cs index 7cd9fcd..aea1441 100644 --- a/SDL3_ttf-CS/SDL3_ttf/ClangSharp/SDL_textengine.g.cs +++ b/SDL3_ttf-CS/SDL3_ttf/ClangSharp/SDL_textengine.g.cs @@ -42,12 +42,14 @@ namespace SDL public SDL_Rect rect; } - public partial struct TTF_CopyOperation + public unsafe partial struct TTF_CopyOperation { public TTF_DrawCommand cmd; public int text_offset; + public TTF_Font* glyph_font; + [NativeTypeName("Uint32")] public uint glyph_index; 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 80e71eb..abada70 100644 --- a/SDL3_ttf-CS/SDL3_ttf/ClangSharp/SDL_ttf.g.cs +++ b/SDL3_ttf-CS/SDL3_ttf/ClangSharp/SDL_ttf.g.cs @@ -32,6 +32,16 @@ namespace SDL { } + public enum TTF_HintingFlags + { + TTF_HINTING_INVALID = -1, + TTF_HINTING_NORMAL, + TTF_HINTING_LIGHT, + TTF_HINTING_MONO, + TTF_HINTING_NONE, + TTF_HINTING_LIGHT_SUBPIXEL, + } + public enum TTF_HorizontalAlignment { TTF_HORIZONTAL_ALIGN_INVALID = -1, @@ -42,12 +52,21 @@ namespace SDL public enum TTF_Direction { - TTF_DIRECTION_LTR = 0, + TTF_DIRECTION_INVALID = 0, + TTF_DIRECTION_LTR = 4, TTF_DIRECTION_RTL, TTF_DIRECTION_TTB, TTF_DIRECTION_BTT, } + public enum TTF_ImageType + { + TTF_IMAGE_INVALID, + TTF_IMAGE_ALPHA, + TTF_IMAGE_COLOR, + TTF_IMAGE_SDF, + } + public partial struct TTF_TextEngine { } @@ -68,6 +87,33 @@ namespace SDL public TTF_TextData* @internal; } + public unsafe partial struct TTF_GPUAtlasDrawSequence + { + public SDL_GPUTexture* atlas_texture; + + public SDL_FPoint* xy; + + public SDL_FPoint* uv; + + public int num_vertices; + + public int* indices; + + public int num_indices; + + public TTF_ImageType image_type; + + [NativeTypeName("struct TTF_GPUAtlasDrawSequence *")] + public TTF_GPUAtlasDrawSequence* next; + } + + public enum TTF_GPUTextEngineWinding + { + TTF_GPU_TEXTENGINE_WINDING_INVALID = -1, + TTF_GPU_TEXTENGINE_WINDING_CLOCKWISE, + TTF_GPU_TEXTENGINE_WINDING_COUNTER_CLOCKWISE, + } + public partial struct TTF_SubString { public TTF_SubStringFlags flags; @@ -107,6 +153,9 @@ namespace SDL [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 TTF_Font* TTF_CopyFont(TTF_Font* existing_font); + [DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern SDL_PropertiesID TTF_GetFontProperties(TTF_Font* font); @@ -114,6 +163,16 @@ namespace SDL [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_AddFallbackFont(TTF_Font* font, TTF_Font* fallback); + + [DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void TTF_RemoveFallbackFont(TTF_Font* font, TTF_Font* fallback); + + [DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void TTF_ClearFallbackFonts(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); @@ -130,10 +189,10 @@ namespace SDL 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); + public static extern void TTF_SetFontStyle(TTF_Font* font, TTF_FontStyleFlags style); [DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int TTF_GetFontStyle([NativeTypeName("const TTF_Font *")] TTF_Font* font); + public static extern TTF_FontStyleFlags TTF_GetFontStyle([NativeTypeName("const TTF_Font *")] TTF_Font* font); [DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("bool")] @@ -143,10 +202,13 @@ namespace SDL 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); + public static extern void TTF_SetFontHinting(TTF_Font* font, TTF_HintingFlags hinting); [DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int TTF_GetFontHinting([NativeTypeName("const TTF_Font *")] TTF_Font* font); + public static extern int TTF_GetNumFontFaces([NativeTypeName("const TTF_Font *")] TTF_Font* font); + + [DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern TTF_HintingFlags TTF_GetFontHinting([NativeTypeName("const TTF_Font *")] TTF_Font* font); [DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("bool")] @@ -156,6 +218,9 @@ namespace SDL [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 int TTF_GetFontWeight([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); @@ -200,15 +265,6 @@ namespace SDL [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); @@ -217,12 +273,23 @@ namespace SDL 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); + [return: NativeTypeName("Uint32")] + public static extern uint TTF_StringToTag([NativeTypeName("const char *")] byte* @string); + + [DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void TTF_TagToString([NativeTypeName("Uint32")] uint tag, [NativeTypeName("char *")] byte* @string, [NativeTypeName("size_t")] nuint size); [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); + public static extern SDLBool TTF_SetFontScript(TTF_Font* font, [NativeTypeName("Uint32")] uint script); + + [DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("Uint32")] + public static extern uint TTF_GetFontScript(TTF_Font* font); + + [DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("Uint32")] + public static extern uint TTF_GetGlyphScript([NativeTypeName("Uint32")] uint ch); [DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("bool")] @@ -233,10 +300,10 @@ namespace SDL 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); + public static extern SDL_Surface* TTF_GetGlyphImage(TTF_Font* font, [NativeTypeName("Uint32")] uint ch, TTF_ImageType* image_type); [DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern SDL_Surface* TTF_GetGlyphImageForIndex(TTF_Font* font, [NativeTypeName("Uint32")] uint glyph_index); + public static extern SDL_Surface* TTF_GetGlyphImageForIndex(TTF_Font* font, [NativeTypeName("Uint32")] uint glyph_index, TTF_ImageType* image_type); [DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("bool")] @@ -258,6 +325,15 @@ namespace SDL [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_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)] 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); @@ -298,6 +374,9 @@ namespace SDL [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)] + public static extern TTF_TextEngine* TTF_CreateRendererTextEngineWithProperties(SDL_PropertiesID props); + [DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("bool")] public static extern SDLBool TTF_DrawRendererText(TTF_Text* text, float x, float y); @@ -305,6 +384,24 @@ namespace SDL [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_TextEngine* TTF_CreateGPUTextEngine(SDL_GPUDevice* device); + + [DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern TTF_TextEngine* TTF_CreateGPUTextEngineWithProperties(SDL_PropertiesID props); + + [DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern TTF_GPUAtlasDrawSequence* TTF_GetGPUTextDrawData(TTF_Text* text); + + [DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void TTF_DestroyGPUTextEngine(TTF_TextEngine* engine); + + [DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void TTF_SetGPUTextEngineWinding(TTF_TextEngine* engine, TTF_GPUTextEngineWinding winding); + + [DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern TTF_GPUTextEngineWinding TTF_GetGPUTextEngineWinding([NativeTypeName("const TTF_TextEngine *")] 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); @@ -325,6 +422,21 @@ namespace SDL [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_SetTextDirection(TTF_Text* text, TTF_Direction direction); + + [DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern TTF_Direction TTF_GetTextDirection(TTF_Text* text); + + [DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("bool")] + public static extern SDLBool TTF_SetTextScript(TTF_Text* text, [NativeTypeName("Uint32")] uint script); + + [DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("Uint32")] + public static extern uint TTF_GetTextScript(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); @@ -427,8 +539,8 @@ namespace SDL [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_MINOR_VERSION 3")] + public const int SDL_TTF_MINOR_VERSION = 3; [NativeTypeName("#define SDL_TTF_MICRO_VERSION 0")] public const int SDL_TTF_MICRO_VERSION = 0; @@ -457,6 +569,18 @@ namespace SDL [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_PROP_FONT_CREATE_EXISTING_FONT_POINTER \"SDL_ttf.font.create.existing_font\"")] + public static ReadOnlySpan TTF_PROP_FONT_CREATE_EXISTING_FONT_POINTER => "SDL_ttf.font.create.existing_font"u8; + + [NativeTypeName("#define TTF_PROP_FONT_OUTLINE_LINE_CAP_NUMBER \"SDL_ttf.font.outline.line_cap\"")] + public static ReadOnlySpan TTF_PROP_FONT_OUTLINE_LINE_CAP_NUMBER => "SDL_ttf.font.outline.line_cap"u8; + + [NativeTypeName("#define TTF_PROP_FONT_OUTLINE_LINE_JOIN_NUMBER \"SDL_ttf.font.outline.line_join\"")] + public static ReadOnlySpan TTF_PROP_FONT_OUTLINE_LINE_JOIN_NUMBER => "SDL_ttf.font.outline.line_join"u8; + + [NativeTypeName("#define TTF_PROP_FONT_OUTLINE_MITER_LIMIT_NUMBER \"SDL_ttf.font.outline.miter_limit\"")] + public static ReadOnlySpan TTF_PROP_FONT_OUTLINE_MITER_LIMIT_NUMBER => "SDL_ttf.font.outline.miter_limit"u8; + [NativeTypeName("#define TTF_STYLE_NORMAL 0x00")] public const int TTF_STYLE_NORMAL = 0x00; @@ -472,31 +596,61 @@ namespace SDL [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_FONT_WEIGHT_THIN 100")] + public const int TTF_FONT_WEIGHT_THIN = 100; - [NativeTypeName("#define TTF_HINTING_LIGHT 1")] - public const int TTF_HINTING_LIGHT = 1; + [NativeTypeName("#define TTF_FONT_WEIGHT_EXTRA_LIGHT 200")] + public const int TTF_FONT_WEIGHT_EXTRA_LIGHT = 200; - [NativeTypeName("#define TTF_HINTING_MONO 2")] - public const int TTF_HINTING_MONO = 2; + [NativeTypeName("#define TTF_FONT_WEIGHT_LIGHT 300")] + public const int TTF_FONT_WEIGHT_LIGHT = 300; - [NativeTypeName("#define TTF_HINTING_NONE 3")] - public const int TTF_HINTING_NONE = 3; + [NativeTypeName("#define TTF_FONT_WEIGHT_NORMAL 400")] + public const int TTF_FONT_WEIGHT_NORMAL = 400; - [NativeTypeName("#define TTF_HINTING_LIGHT_SUBPIXEL 4")] - public const int TTF_HINTING_LIGHT_SUBPIXEL = 4; + [NativeTypeName("#define TTF_FONT_WEIGHT_MEDIUM 500")] + public const int TTF_FONT_WEIGHT_MEDIUM = 500; - [NativeTypeName("#define TTF_SUBSTRING_TEXT_START 0x00000001")] - public const int TTF_SUBSTRING_TEXT_START = 0x00000001; + [NativeTypeName("#define TTF_FONT_WEIGHT_SEMI_BOLD 600")] + public const int TTF_FONT_WEIGHT_SEMI_BOLD = 600; - [NativeTypeName("#define TTF_SUBSTRING_LINE_START 0x00000002")] - public const int TTF_SUBSTRING_LINE_START = 0x00000002; + [NativeTypeName("#define TTF_FONT_WEIGHT_BOLD 700")] + public const int TTF_FONT_WEIGHT_BOLD = 700; - [NativeTypeName("#define TTF_SUBSTRING_LINE_END 0x00000004")] - public const int TTF_SUBSTRING_LINE_END = 0x00000004; + [NativeTypeName("#define TTF_FONT_WEIGHT_EXTRA_BOLD 800")] + public const int TTF_FONT_WEIGHT_EXTRA_BOLD = 800; - [NativeTypeName("#define TTF_SUBSTRING_TEXT_END 0x00000008")] - public const int TTF_SUBSTRING_TEXT_END = 0x00000008; + [NativeTypeName("#define TTF_FONT_WEIGHT_BLACK 900")] + public const int TTF_FONT_WEIGHT_BLACK = 900; + + [NativeTypeName("#define TTF_FONT_WEIGHT_EXTRA_BLACK 950")] + public const int TTF_FONT_WEIGHT_EXTRA_BLACK = 950; + + [NativeTypeName("#define TTF_PROP_RENDERER_TEXT_ENGINE_RENDERER_POINTER \"SDL_ttf.renderer_text_engine.create.renderer\"")] + public static ReadOnlySpan TTF_PROP_RENDERER_TEXT_ENGINE_RENDERER_POINTER => "SDL_ttf.renderer_text_engine.create.renderer"u8; + + [NativeTypeName("#define TTF_PROP_RENDERER_TEXT_ENGINE_ATLAS_TEXTURE_SIZE_NUMBER \"SDL_ttf.renderer_text_engine.create.atlas_texture_size\"")] + public static ReadOnlySpan TTF_PROP_RENDERER_TEXT_ENGINE_ATLAS_TEXTURE_SIZE_NUMBER => "SDL_ttf.renderer_text_engine.create.atlas_texture_size"u8; + + [NativeTypeName("#define TTF_PROP_GPU_TEXT_ENGINE_DEVICE_POINTER \"SDL_ttf.gpu_text_engine.create.device\"")] + public static ReadOnlySpan TTF_PROP_GPU_TEXT_ENGINE_DEVICE_POINTER => "SDL_ttf.gpu_text_engine.create.device"u8; + + [NativeTypeName("#define TTF_PROP_GPU_TEXT_ENGINE_ATLAS_TEXTURE_SIZE_NUMBER \"SDL_ttf.gpu_text_engine.create.atlas_texture_size\"")] + public static ReadOnlySpan TTF_PROP_GPU_TEXT_ENGINE_ATLAS_TEXTURE_SIZE_NUMBER => "SDL_ttf.gpu_text_engine.create.atlas_texture_size"u8; + + [NativeTypeName("#define TTF_SUBSTRING_DIRECTION_MASK 0x000000FF")] + public const int TTF_SUBSTRING_DIRECTION_MASK = 0x000000FF; + + [NativeTypeName("#define TTF_SUBSTRING_TEXT_START 0x00000100")] + public const int TTF_SUBSTRING_TEXT_START = 0x00000100; + + [NativeTypeName("#define TTF_SUBSTRING_LINE_START 0x00000200")] + public const int TTF_SUBSTRING_LINE_START = 0x00000200; + + [NativeTypeName("#define TTF_SUBSTRING_LINE_END 0x00000400")] + public const int TTF_SUBSTRING_LINE_END = 0x00000400; + + [NativeTypeName("#define TTF_SUBSTRING_TEXT_END 0x00000800")] + public const int TTF_SUBSTRING_TEXT_END = 0x00000800; } } diff --git a/SDL3_ttf-CS/SDL3_ttf/SDL_ttf.cs b/SDL3_ttf-CS/SDL3_ttf/SDL_ttf.cs index 57f2d55..dd5278d 100644 --- a/SDL3_ttf-CS/SDL3_ttf/SDL_ttf.cs +++ b/SDL3_ttf-CS/SDL3_ttf/SDL_ttf.cs @@ -20,6 +20,7 @@ namespace SDL [Typedef] public enum TTF_SubStringFlags : UInt32 { + TTF_SUBSTRING_DIRECTION_MASK = SDL3_ttf.TTF_SUBSTRING_DIRECTION_MASK, 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,