Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Add IsMinimizedEXT and IsMaximizedEXT #508

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions src/FNAPlatform/FNAPlatform.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
16 changes: 16 additions & 0 deletions src/FNAPlatform/FNAWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 10 additions & 0 deletions src/FNAPlatform/SDL2_FNAPlatform.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
10 changes: 10 additions & 0 deletions src/FNAPlatform/SDL3_FNAPlatform.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
28 changes: 28 additions & 0 deletions src/GameWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,34 @@ public virtual bool IsBorderlessEXT
}
}

/// <summary>
/// Determines whether the window is minimized.
/// </summary>
/// <exception cref="System.NotImplementedException">
/// Thrown when trying to use this property on an unsupported platform.
/// </exception>
public virtual bool IsMinimizedEXT
{
get
{
return false;
}
}

/// <summary>
/// Determines whether the window is maximized.
/// </summary>
/// <exception cref="System.NotImplementedException">
/// Thrown when trying to use this property on an unsupported platform.
/// </exception>
public virtual bool IsMaximizedEXT
{
get
{
return false;
}
}

#endregion

#region Private Variables
Expand Down