Skip to main content

GLFWApplication Class

An Application implementation for glfw-based environments. More...

Declaration

class helios::ext::glfw::app::GLFWApplication { ... }

Base class

classApplication

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

voidinit () 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...

voidsetCurrent (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...

GLFWRAIIGuardglfwRaiiGuard_

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()

helios::ext::glfw::app::GLFWApplication::GLFWApplication (std::unique_ptr< helios::rendering::RenderingDevice > renderingDevice, std::unique_ptr< helios::input::InputManager > inputManager, std::unique_ptr< helios::event::EventManager > eventManager)
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()

helios::ext::glfw::window::GLFWWindow & helios::ext::glfw::app::GLFWApplication::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.

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.

See Also

https://www.glfw.org/docs/latest/group__window.html#ga0e2637a4161afb283f5300c7f94785c9

Returns

A ref to the window created.

Definition at line 83 of file GLFWApplication.ixx.

createWindow()

helios::ext::glfw::window::GLFWWindow & helios::ext::glfw::app::GLFWApplication::createWindow (std::unique_ptr< helios::rendering::RenderTarget > renderTarget, const helios::window::WindowConfig & cfg)
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()

helios::window::Window * helios::ext::glfw::app::GLFWApplication::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()

void helios::ext::glfw::app::GLFWApplication::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()

void helios::ext::glfw::app::GLFWApplication::setCurrent (helios::window::Window & win)
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_

helios::window::Window* helios::ext::glfw::app::GLFWApplication::current_ = nullptr

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.

39 helios::window::Window* current_ = nullptr;

glfwRaiiGuard_

GLFWRAIIGuard helios::ext::glfw::app::GLFWApplication::glfwRaiiGuard_

RAII Guard for glfw initialization and termination.

Definition at line 44 of file GLFWApplication.ixx.

44 GLFWRAIIGuard glfwRaiiGuard_;

The documentation for this class was generated from the following file:


Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.15.0.