Window Class
Abstract base class representing a generic window. More...
Declaration
Derived Classes
| class | GLFWWindow |
|
An OpenGL focused window implementation using GLFW. More... | |
Public Constructors Index
| Window (const Window &)=delete | |
| Window (Window &&) noexcept=default | |
| Window (std::unique_ptr< helios::rendering::RenderTarget > renderTarget, const WindowConfig &cfg) | |
|
Constructs a new Window based on the provided configuration. More... | |
Public Destructor Index
| ~Window ()=default | |
Public Operators Index
| Window & | operator= (const Window &)=delete |
| Window & | operator= (Window &&) noexcept=default |
| bool | operator== (const Window &win) const noexcept |
|
Compares two window instances for equality. More... | |
Public Member Functions Index
| bool | shouldClose () const =0 |
|
Checks if the window has received a close request. More... | |
| void | setShouldClose (bool close)=0 |
|
Sets the close flag of this window. More... | |
| const util::Guid & | guid () const noexcept |
|
Returns the unique guid for this window instance. More... | |
| bool | show () noexcept=0 |
|
Shows the underlying native window. More... | |
| void | swapBuffers () const noexcept=0 |
|
Instructs the rendering system to swap the front and back buffers. More... | |
| void | pollEvents () const noexcept=0 |
|
Poll this window for native window events. More... | |
| int | width () const noexcept |
|
Returns the current width of this window. More... | |
| int | height () const noexcept |
|
Returns the current height of this window. More... | |
| helios::rendering::RenderTarget & | renderTarget () const noexcept |
|
Returns the RenderTarget associated with this Window. More... | |
| std::shared_ptr< helios::rendering::Viewport > | addViewport (std::shared_ptr< helios::rendering::Viewport > viewport) const |
|
Adds the viewport to the underlying RenderTarget of this Window. More... | |
| std::vector< helios::rendering::ViewportSnapshot > | viewportSnapshots () |
|
Returns snapshots of all viewports with assigned IDs. More... | |
Protected Member Attributes Index
| int | width_ |
|
The current width of the window. More... | |
| int | height_ |
|
The current height of the window. More... | |
| std::string | title_ |
|
The title of the window. More... | |
| int | aspectRatioNumer_ = 0 |
|
Aspect ratio numerator. More... | |
| int | aspectRatioDenom_ = 0 |
|
Aspect ratio denominator. More... | |
| std::unique_ptr< helios::rendering::RenderTarget > | renderTarget_ |
|
The default render target for this Window. The default RenderTarget represents the default framebuffer, e.g. the "0" FBO in OpenGL. More... | |
Private Member Attributes Index
| util::Guid | guid_ |
|
Unique identifier for this window instance. More... | |
Protected Static Attributes Index
| static const helios::util::log::Logger & | logger_ = helios::util::log::LogManager::loggerForScope(HELIOS_LOG_SCOPE) |
Description
Abstract base class representing a generic window.
This class provides a common interface for window management without depending on the underlying native window implementation.
A Window can be uniquely identified via its Guid.
Definition at line 34 of file Window.ixx.
Public Constructors
Window()
| delete |
Definition at line 88 of file Window.ixx.
Reference Window.
Referenced by helios::ext::glfw::window::GLFWWindow::GLFWWindow, operator=, operator=, operator==, Window, Window and Window.
Window()
| noexcept default |
Definition at line 92 of file Window.ixx.
Reference Window.
Window()
| inline explicit |
Constructs a new Window based on the provided configuration.
Initializes basic properties such as width, height and the viewport of the window.
- Parameters
-
renderTarget The RenderTarget for this window. Ownership is transferred.
cfg A const ref to the window configuration used for this instance.
- Exceptions
-
std::invalid_argument if renderTarget is a nullptr.
Definition at line 106 of file Window.ixx.
References aspectRatioDenom_, aspectRatioNumer_, height, height_, renderTarget, renderTarget_, title_, width, width_ and Window.
Public Destructor
~Window()
| virtual default |
Definition at line 85 of file Window.ixx.
Public Operators
operator=()
| delete |
Definition at line 89 of file Window.ixx.
Reference Window.
operator=()
| noexcept default |
Definition at line 93 of file Window.ixx.
Reference Window.
operator==()
| inline noexcept virtual |
Compares two window instances for equality.
Two windows are considered equal if their GUIDs are equal.
- Parameters
-
win The window to compare with this window.
- Returns
true if both windows are equal, otherwise false.
Definition at line 255 of file Window.ixx.
Reference Window.
Public Member Functions
addViewport()
| inline |
Adds the viewport to the underlying RenderTarget of this Window.
- Parameters
-
viewport The Viewport instance to add to the RenderTarget owned by this Window.
- Returns
The Viewport added to the Window's RenderTarget as a shared pointer.
Definition at line 224 of file Window.ixx.
Reference renderTarget_.
guid()
| inline nodiscard noexcept |
Returns the unique guid for this window instance.
- Returns
A const reference to the Guid of this window.
Definition at line 153 of file Window.ixx.
Referenced by helios::ext::glfw::app::GLFWApplication::setCurrent.
height()
| inline nodiscard noexcept |
pollEvents()
| noexcept |
Poll this window for native window events.
This method processes pending events from the native window system. Implementing APIs should call this method at regular intervals, e.g. once per frame.
Definition at line 185 of file Window.ixx.
Reference pollEvents.
Referenced by pollEvents.
renderTarget()
| inline nodiscard noexcept |
Returns the RenderTarget associated with this Window.
- Returns
A reference to the RenderTarget of this window.
Definition at line 213 of file Window.ixx.
Reference renderTarget_.
Referenced by helios::ext::glfw::window::GLFWWindow::GLFWWindow and Window.
setShouldClose()
|
Sets the close flag of this window.
- Parameters
-
close True to indicate this window should be closed, false otherwise.
- See Also
Definition at line 145 of file Window.ixx.
shouldClose()
| nodiscard |
Checks if the window has received a close request.
Implementing APIs should consider this flag at regular intervals (e.g. each frame) to determine whether this window should be closed.
- Returns
true if the window should be closed, otherwise false.
- See Also
Definition at line 134 of file Window.ixx.
show()
| noexcept |
Shows the underlying native window.
Derived classes must implement the platform-specific logic to show this window.
- Returns
true if showing the window succeeded, otherwise false.
Definition at line 166 of file Window.ixx.
swapBuffers()
| noexcept |
Instructs the rendering system to swap the front and back buffers.
Makes the back buffer's content visible on the screen. Derived classes must implement the platform-specific buffer mechanism.
Definition at line 175 of file Window.ixx.
Reference swapBuffers.
Referenced by swapBuffers.
viewportSnapshots()
| inline nodiscard |
Returns snapshots of all viewports with assigned IDs.
Collects immutable ViewportSnapshot objects from all viewports that have a valid ViewportId. Useful for passing viewport state to systems that need frame-consistent viewport data.
- Returns
A vector of ViewportSnapshot objects.
Definition at line 237 of file Window.ixx.
Reference renderTarget_.
width()
| inline nodiscard noexcept |
Protected Member Attributes
aspectRatioDenom_
| protected |
Aspect ratio denominator.
Aspect ratio is enforced only when BOTH aspectRatioNumer and aspectRatioDenom are non-zero.
Definition at line 76 of file Window.ixx.
Referenced by helios::ext::glfw::window::GLFWWindow::show and Window.
aspectRatioNumer_
| protected |
Aspect ratio numerator.
Aspect ratio is enforced only when BOTH aspectRatioNumer and aspectRatioDenom are non-zero.
Definition at line 69 of file Window.ixx.
Referenced by helios::ext::glfw::window::GLFWWindow::show and Window.
height_
| protected |
The current height of the window.
Definition at line 57 of file Window.ixx.
Referenced by height, helios::ext::glfw::window::GLFWWindow::show and Window.
renderTarget_
| protected |
The default render target for this Window. The default RenderTarget represents the default framebuffer, e.g. the "0" FBO in OpenGL.
Definition at line 82 of file Window.ixx.
Referenced by addViewport, renderTarget, viewportSnapshots and Window.
title_
| protected |
The title of the window.
Definition at line 62 of file Window.ixx.
Referenced by helios::ext::glfw::window::GLFWWindow::show and Window.
width_
| protected |
The current width of the window.
Definition at line 52 of file Window.ixx.
Referenced by helios::ext::glfw::window::GLFWWindow::show, width and Window.
Private Member Attributes
guid_
|
Unique identifier for this window instance.
Definition at line 40 of file Window.ixx.
Protected Static Attributes
logger_
| protected static |
The logger used with this Window instance.
Definition at line 47 of file Window.ixx.
Referenced by helios::ext::glfw::window::GLFWWindow::show.
The documentation for this class was generated from the following file:
Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.15.0.