GLFWApplication Class
An Application implementation for glfw-based environments. More...
Declaration
Base class
| class | Application |
|
Class providing the entry point for a helios application. More... | |
Public Constructors Index
| GLFWApplication (std::unique_ptr< helios::rendering::RenderingDevice > renderingDevice, std::unique_ptr< helios::input::InputManager > inputManager, std::unique_ptr< helios::event::EventManager > eventManager) | |
|
Constructs a new `GLFWApplication` instance. More... | |
Public Member Functions Index
| void | init () override |
|
Initializes the application. More... | |
| helios::ext::glfw::window::GLFWWindow & | createWindow (std::unique_ptr< helios::rendering::RenderTarget > renderTarget, const helios::ext::glfw::window::GLFWWindowConfig &cfg) |
|
Creates a new GLFWWindow and add it to this Application's windows collection. The Application takes ownership of the window. More... | |
| helios::ext::glfw::window::GLFWWindow & | createWindow (std::unique_ptr< helios::rendering::RenderTarget > renderTarget, const helios::window::WindowConfig &cfg) override |
|
Creates the container for the native window and performs all necessary steps to properly initialize it. More... | |
| void | setCurrent (helios::window::Window &win) override |
|
Sets the current window for this application. More... | |
| helios::window::Window * | current () const noexcept override |
|
Returns the currently focused window, or nullptr if none exists or no window is being treated as current. More... | |
Private Member Attributes Index
| helios::window::Window * | current_ = nullptr |
|
A pointer to the currently active window of the Application, or `nullptr` if there is no currently active window. More... | |
| GLFWRAIIGuard | glfwRaiiGuard_ |
|
RAII Guard for glfw initialization and termination. More... | |
Description
An Application implementation for glfw-based environments.
This application owns a `GLFWRAIIGuard`.
Definition at line 32 of file GLFWApplication.ixx.
Public Constructors
GLFWApplication()
| explicit |
Constructs a new `GLFWApplication` instance.
- Parameters
-
renderingDevice Unique rendering device owned by the application.
inputManager Unique input manager instance.
eventManager Unique event manager instance.
Definition at line 54 of file GLFWApplication.ixx.
References helios::app::Application::eventManager, helios::app::Application::inputManager and helios::app::Application::renderingDevice.
Public Member Functions
createWindow()
|
Creates a new GLFWWindow and add it to this Application's windows collection. The Application takes ownership of the window.
Delegates to Window::show() for showing the window and initializes the associated rendering device if necessary, e.g. for glfw an additional `glfwMakeContextCurrent()` is called so the rendering device can be safely initialized, then immediately passes a `nullptr` to the `glfwMakeContextCurrent()` to force calling APIs to explicitly call setCurrent() on the constructed window. The render target size is synced to the current framebuffer dimensions reported by `glfwGetFramebufferSize()`.
- Returns
Reference to the created window instance.
- Returns
A ref to the window created.
Definition at line 83 of file GLFWApplication.ixx.
createWindow()
| virtual |
Creates the container for the native window and performs all necessary steps to properly initialize it.
- Parameters
-
renderTarget Render target that wraps the framebuffer used by the window.
cfg Window configuration defining properties such as title, dimensions, and hints.
- Returns
Reference to the created window instance.
- Exceptions
-
std::invalid_argument If the configuration was invalid.
Definition at line 92 of file GLFWApplication.ixx.
current()
| nodiscard noexcept virtual |
Returns the currently focused window, or nullptr if none exists or no window is being treated as current.
- Returns
Pointer to the current window, or nullptr if none is active.
Definition at line 114 of file GLFWApplication.ixx.
init()
| virtual |
Initializes the application.
Performs any bootstrapping necessary for this application and provides an idiomatic entry point for APIs using this application. This method ensures that all controllers are initialized and subscribe to this application's event manager dispatcher.
- Exceptions
-
std::runtime_error If the application was already initialized.
Definition at line 63 of file GLFWApplication.ixx.
setCurrent()
| virtual |
Sets the current window for this application.
Ensures `glfwMakeContextCurrent()` is called to bind the correct context for subsequent glfw operations and re-registers the framebuffer size callback on the targeted window.
- Parameters
-
win Reference to the window that becomes the current context owner.
- Exceptions
-
std::invalid_argument If `win` is not a `GLFWWindow` or not owned by this application.
Definition at line 109 of file GLFWApplication.ixx.
Private Member Attributes
current_
|
A pointer to the currently active window of the Application, or `nullptr` if there is no currently active window.
Definition at line 39 of file GLFWApplication.ixx.
glfwRaiiGuard_
|
RAII Guard for glfw initialization and termination.
Definition at line 44 of file GLFWApplication.ixx.
The documentation for this class was generated from the following file:
Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.15.0.