From 358efb8d543fa46f9eb5f2aaba8a5009afc73a39 Mon Sep 17 00:00:00 2001 From: RogueMacro <51059464+RogueMacro@users.noreply.github.com> Date: Tue, 16 Feb 2021 16:03:23 +0100 Subject: [PATCH 1/4] Add correct parameter types to SDL.CreateWindowAndRenderer() --- BeefLibs/SDL2/src/SDL2.bf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/BeefLibs/SDL2/src/SDL2.bf b/BeefLibs/SDL2/src/SDL2.bf index dda59478..50fed290 100644 --- a/BeefLibs/SDL2/src/SDL2.bf +++ b/BeefLibs/SDL2/src/SDL2.bf @@ -657,8 +657,8 @@ namespace SDL2 [LinkName("SDL_CreateWindowAndRenderer")] public static extern int CreateWindowAndRenderer( - WindowPos width, - WindowPos height, + int32 width, + int32 height, WindowFlags window_flags, out Window* window, out Renderer* renderer From dfdfe094cd57a51e24f7df7c862808d707deb2df Mon Sep 17 00:00:00 2001 From: RogueMacro <51059464+RogueMacro@users.noreply.github.com> Date: Wed, 17 Feb 2021 21:22:44 +0100 Subject: [PATCH 2/4] Fix parameter type in SDLTTF.RenderText_Solid() --- BeefLibs/SDL2/src/SDL2_ttf.bf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/BeefLibs/SDL2/src/SDL2_ttf.bf b/BeefLibs/SDL2/src/SDL2_ttf.bf index 557be93f..699f45fd 100644 --- a/BeefLibs/SDL2/src/SDL2_ttf.bf +++ b/BeefLibs/SDL2/src/SDL2_ttf.bf @@ -190,7 +190,7 @@ namespace SDL2 [LinkName("TTF_RenderText_Solid")] public static extern SDL.Surface* RenderText_Solid( Font* font, - char8 text, + char8* text, SDL.Color fg ); @@ -315,4 +315,4 @@ namespace SDL2 int index ); } -} \ No newline at end of file +} From 45dd528c7bb071dc037d8a9b36bbb537e2a1f70d Mon Sep 17 00:00:00 2001 From: RogueMacro <51059464+RogueMacro@users.noreply.github.com> Date: Sat, 20 Feb 2021 21:56:16 +0100 Subject: [PATCH 3/4] Fix incorrect link name for SimpleMessageBox --- BeefLibs/SDL2/src/SDL2.bf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BeefLibs/SDL2/src/SDL2.bf b/BeefLibs/SDL2/src/SDL2.bf index 50fed290..87ef42e9 100644 --- a/BeefLibs/SDL2/src/SDL2.bf +++ b/BeefLibs/SDL2/src/SDL2.bf @@ -444,7 +444,7 @@ namespace SDL2 [LinkName("SDL_ShowMessageBox")] public static extern int32 ShowMessageBox(ref MessageBoxData messageboxdata, out int32 buttonid); - [LinkName("ShowSimpleMessageBox")] + [LinkName("SDL_ShowSimpleMessageBox")] public static extern int SimpleMessageBox( MessageBoxFlags flags, char8* title, From a273d514c56f113fa17defaa06d24dcc949cde7d Mon Sep 17 00:00:00 2001 From: RogueMacro <51059464+RogueMacro@users.noreply.github.com> Date: Sun, 21 Feb 2021 19:20:29 +0100 Subject: [PATCH 4/4] Deprecate CreateWindowAndRenderer() and add WindowPos helpers --- BeefLibs/SDL2/src/SDL2.bf | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/BeefLibs/SDL2/src/SDL2.bf b/BeefLibs/SDL2/src/SDL2.bf index 87ef42e9..2d4427d8 100644 --- a/BeefLibs/SDL2/src/SDL2.bf +++ b/BeefLibs/SDL2/src/SDL2.bf @@ -630,6 +630,26 @@ namespace SDL2 public const WindowPos Undefined = 0x1FFF0000; public const WindowPos Centered = 0x2FFF0000; } + + public static int WindowPosUndefinedDisplay(int X) + { + return ((.) WindowPos.Undefined | X); + } + + public static bool WindowPosIsUndefined(int X) + { + return (X & 0xFFFF0000) == (.) WindowPos.Undefined; + } + + public static int WindowPosCenteredDisplay(int X) + { + return ((.) WindowPos.Centered | X); + } + + public static bool WindowPosIsCentered(int X) + { + return (X & 0xFFFF0000) == (.) WindowPos.Centered; + } [CRepr] public struct SDL_DisplayMode @@ -655,6 +675,15 @@ namespace SDL2 WindowFlags flags ); + [LinkName("SDL_CreateWindowAndRenderer"), Obsolete("This method uses WindowPos as width and height parameter types. Use other method that uses int32 instead.", false)] + public static extern int CreateWindowAndRenderer( + WindowPos width, + WindowPos height, + WindowFlags window_flags, + out Window* window, + out Renderer* renderer + ); + [LinkName("SDL_CreateWindowAndRenderer")] public static extern int CreateWindowAndRenderer( int32 width,