diff --git a/src/FNAPlatform/FNAPlatform.cs b/src/FNAPlatform/FNAPlatform.cs index c17454bd..e63e03ec 100644 --- a/src/FNAPlatform/FNAPlatform.cs +++ b/src/FNAPlatform/FNAPlatform.cs @@ -113,6 +113,8 @@ static FNAPlatform() SetWindowResizable = SDL3_FNAPlatform.SetWindowResizable; GetWindowBorderless = SDL3_FNAPlatform.GetWindowBorderless; SetWindowBorderless = SDL3_FNAPlatform.SetWindowBorderless; + GetWindowMinimized = SDL3_FNAPlatform.GetWindowMinimized; + GetWindowMaximized = SDL3_FNAPlatform.GetWindowMaximized; SetWindowTitle = SDL3_FNAPlatform.SetWindowTitle; IsScreenKeyboardShown = SDL3_FNAPlatform.IsScreenKeyboardShown; RegisterGame = SDL3_FNAPlatform.RegisterGame; @@ -168,6 +170,8 @@ static FNAPlatform() SetWindowResizable = SDL2_FNAPlatform.SetWindowResizable; GetWindowBorderless = SDL2_FNAPlatform.GetWindowBorderless; SetWindowBorderless = SDL2_FNAPlatform.SetWindowBorderless; + GetWindowMinimized = SDL2_FNAPlatform.GetWindowMinimized; + GetWindowMaximized = SDL2_FNAPlatform.GetWindowMaximized; SetWindowTitle = SDL2_FNAPlatform.SetWindowTitle; IsScreenKeyboardShown = SDL2_FNAPlatform.IsScreenKeyboardShown; RegisterGame = SDL2_FNAPlatform.RegisterGame; @@ -302,8 +306,10 @@ ref string resultDeviceName public delegate void SetWindowResizableFunc(IntPtr window, bool resizable); public static readonly SetWindowResizableFunc SetWindowResizable; - public delegate bool GetWindowBorderlessFunc(IntPtr window); - public static readonly GetWindowBorderlessFunc GetWindowBorderless; + public delegate bool GetWindowBoolFunc(IntPtr window); + public static readonly GetWindowBoolFunc GetWindowBorderless, + GetWindowMinimized, + GetWindowMaximized; public delegate void SetWindowBorderlessFunc(IntPtr window, bool borderless); public static readonly SetWindowBorderlessFunc SetWindowBorderless; diff --git a/src/FNAPlatform/FNAWindow.cs b/src/FNAPlatform/FNAWindow.cs index 88c465f2..c1f7ee67 100644 --- a/src/FNAPlatform/FNAWindow.cs +++ b/src/FNAPlatform/FNAWindow.cs @@ -76,6 +76,22 @@ public override bool IsBorderlessEXT } } + public override bool IsMinimizedEXT + { + get + { + return FNAPlatform.GetWindowMinimized(window); + } + } + + public override bool IsMaximizedEXT + { + get + { + return FNAPlatform.GetWindowMaximized(window); + } + } + public override string ScreenDeviceName { get diff --git a/src/FNAPlatform/SDL2_FNAPlatform.cs b/src/FNAPlatform/SDL2_FNAPlatform.cs index 623610b2..2008d2ae 100644 --- a/src/FNAPlatform/SDL2_FNAPlatform.cs +++ b/src/FNAPlatform/SDL2_FNAPlatform.cs @@ -729,6 +729,16 @@ public static bool GetWindowBorderless(IntPtr window) return ((SDL.SDL_GetWindowFlags(window) & (uint) SDL.SDL_WindowFlags.SDL_WINDOW_BORDERLESS) != 0); } + public static bool GetWindowMinimized(IntPtr window) + { + return ((SDL.SDL_GetWindowFlags(window) & (uint) SDL.SDL_WindowFlags.SDL_WINDOW_MINIMIZED) != 0); + } + + public static bool GetWindowMaximized(IntPtr window) + { + return ((SDL.SDL_GetWindowFlags(window) & (uint) SDL.SDL_WindowFlags.SDL_WINDOW_MAXIMIZED) != 0); + } + public static void SetWindowBorderless(IntPtr window, bool borderless) { SDL.SDL_SetWindowBordered( diff --git a/src/FNAPlatform/SDL3_FNAPlatform.cs b/src/FNAPlatform/SDL3_FNAPlatform.cs index 1e764bdb..7fb05002 100644 --- a/src/FNAPlatform/SDL3_FNAPlatform.cs +++ b/src/FNAPlatform/SDL3_FNAPlatform.cs @@ -625,6 +625,16 @@ public static bool GetWindowBorderless(IntPtr window) return ((SDL.SDL_GetWindowFlags(window) & SDL.SDL_WindowFlags.SDL_WINDOW_BORDERLESS) != 0); } + public static bool GetWindowMinimized(IntPtr window) + { + return ((SDL.SDL_GetWindowFlags(window) & SDL.SDL_WindowFlags.SDL_WINDOW_MINIMIZED) != 0); + } + + public static bool GetWindowMaximized(IntPtr window) + { + return ((SDL.SDL_GetWindowFlags(window) & SDL.SDL_WindowFlags.SDL_WINDOW_MAXIMIZED) != 0); + } + public static void SetWindowBorderless(IntPtr window, bool borderless) { SDL.SDL_SetWindowBordered( diff --git a/src/GameWindow.cs b/src/GameWindow.cs index b292dc58..3339796a 100644 --- a/src/GameWindow.cs +++ b/src/GameWindow.cs @@ -82,6 +82,34 @@ public virtual bool IsBorderlessEXT } } + /// + /// Determines whether the window is minimized. + /// + /// + /// Thrown when trying to use this property on an unsupported platform. + /// + public virtual bool IsMinimizedEXT + { + get + { + return false; + } + } + + /// + /// Determines whether the window is maximized. + /// + /// + /// Thrown when trying to use this property on an unsupported platform. + /// + public virtual bool IsMaximizedEXT + { + get + { + return false; + } + } + #endregion #region Private Variables