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] 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,