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

Inits the Application. Any bootstrapping necessary for this application should be done here and provide an idiomatic entry point for any API using this Application. More...

helios::ext::glfw::window::GLFWWindow &createWindow (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. More...

helios::ext::glfw::window::GLFWWindow &createWindow (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. Makes sure that `glfwContextCurrent` is called for setting a current context for glfw and subsequent glfw-operations. It also re-registers `glfwSetFramebufferSizeCallback` with the callback function of the Window. More...

helios::window::Window *current () const noexcept override

Returns the currently focused window, or nullptr if none exists / 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 27 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
inputManager
eventManager

Definition at line 49 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 (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.

Parameters
cfg

The `GLFWWindowConfig` used for initializing the window.

Returns

A ref to the window created.

Definition at line 74 of file GLFWApplication.ixx.

createWindow()

helios::ext::glfw::window::GLFWWindow & helios::ext::glfw::app::GLFWApplication::createWindow (const helios::window::WindowConfig & cfg)
virtual

Creates the container for the native window and performs all necessary steps to properly initialize it.

Parameters
cfg
Returns

Window

Exceptions
std::invalid_argument

if the configuration was invalid

Definition at line 80 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 / no window is being treated as current().

Returns

Window

Definition at line 103 of file GLFWApplication.ixx.

init()

void helios::ext::glfw::app::GLFWApplication::init ()
virtual

Inits the Application. Any bootstrapping necessary for this application should be done here and provide an idiomatic entry point for any API using this Application.

This method makes sure that the controllers are initialized and subscribe to this Application's EventManager's dispatcher.

Returns

void

Exceptions
std::runtime_error

if the Application was already initialized.

Definition at line 58 of file GLFWApplication.ixx.

setCurrent()

void helios::ext::glfw::app::GLFWApplication::setCurrent (helios::window::Window & win)
virtual

Sets the current Window for this Application. Makes sure that `glfwContextCurrent` is called for setting a current context for glfw and subsequent glfw-operations. It also re-registers `glfwSetFramebufferSizeCallback` with the callback function of the Window.

Parameters
win

A ref to the window to set as current.

Exceptions
if

the specified Window is not a GLFWWindow or if the window is not owned by this application.

Todo

the window should be signaled that it's now current window, for setting the frameBufferSizeCallback and calling glfwMakeContextCurrent.

Definition at line 98 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 34 of file GLFWApplication.ixx.

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

glfwRaiiGuard_

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

RAII Guard for glfw initialization and termination.

Definition at line 39 of file GLFWApplication.ixx.

39 GLFWRAIIGuard glfwRaiiGuard_;

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


Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.15.0.