Class Window
Defined in File Window.hpp
Class Documentation
-
class Window
Game window singleton.
Public Types
Public Functions
-
void Open(const std::string &title, glm::uvec2 size, bool visible, Mode mode)
Open the window.
- Parameters:
title – Initial window title
size – Initial window size
visible – Initial window visibility
mode – Initial window mode
- Throws:
BadInitStateException – If the window is already open
BadValueException – If the title string is empty
BadValueException – If one of the size components is zero
BadValueException – If the window is to be invisible and not in Windowed mode
-
void HandleOSEvents()
Handle events from the operating system.
- Throws:
BadInitStateException – If the window is not open
-
void Show()
Make the window visible.
- Throws:
BadInitStateException – If the window is not open
BadStateException – If the window is already visible
-
void Hide()
Hide the window.
- Throws:
BadInitStateException – If the window is not open
BadStateException – If the window is already hidden
-
void SetTitle(const std::string &newTitle)
Change the window title.
- Parameters:
newTitle – The new window title
- Throws:
BadInitStateException – If the window is not open
BadValueException – If the title string is empty
-
void Resize(const glm::uvec2 &newSize)
Change the window size.
- Parameters:
newSize – The new window size
- Throws:
BadInitStateException – If the window is not open
BadValueException – If one of the size components is zero
-
void SetMode(Mode newMode)
Change the window mode.
- Parameters:
newMode – The new window mode
- Throws:
BadInitStateException – If the window is not open
BadStateException – If the window is invisible
-
bool IsVisible() const
Check if the window is visible.
- Returns:
Whether the window is visible, or false if the window is not open
-
bool IsMinimized() const
Check if the window is minimized.
Warning
This will always return false on Wayland when the window is open, since Wayland clients can’t know their minimization state
- Returns:
Whether the window is minimized, or true if the window is not open
-
const std::string GetTitle() const
Check the window title.
- Returns:
The window title, or an empty string if the window is not open
-
const glm::uvec2 GetSize() const
Check the window size.
- Returns:
The window size, or {0, 0} if the window is not open
-
const glm::uvec2 GetContentAreaSize() const
Check the pixel size of the content area.
- Returns:
The content area size, or {0, 0} if the window is not open
-
Mode GetMode() const
Check the window mode.
- Returns:
The window mode, or Mode::Windowed if the window is not open
Public Static Functions
-
static Window &Get()
Get the instance and create one if there isn’t one.
- Returns:
The instance
-
void Open(const std::string &title, glm::uvec2 size, bool visible, Mode mode)