Application Class
Class providing the entry point for a helios application. More...
Declaration
Derived Classes
| class | GLFWApplication |
|
An Application implementation for glfw-based environments. More... | |
Public Constructors Index
| Application (std::unique_ptr< helios::rendering::RenderingDevice > renderingDevice, std::unique_ptr< helios::input::InputManager > inputManager, std::unique_ptr< helios::event::EventManager > eventManager) | |
|
Creates a new application instance. More... | |
Public Destructor Index
| ~Application ()=default | |
Public Member Functions Index
| void | addController (std::unique_ptr< helios::app::controller::Controller > controller) noexcept |
|
Registers a new controller with this application. More... | |
| helios::window::Window & | createWindow (std::unique_ptr< helios::rendering::RenderTarget > renderTarget, const helios::window::WindowConfig &cfg)=0 |
|
Creates the container for the native window and performs all necessary steps to properly initialize it. More... | |
| void | init () |
|
Initializes the application. More... | |
| void | setCurrent (helios::window::Window &win)=0 |
|
Sets the application's active window. More... | |
| bool | hasWindow (const helios::window::Window &win) const noexcept |
|
Returns true if the specified window is owned by this application, otherwise false. More... | |
| helios::window::Window * | current () const noexcept=0 |
|
Returns the currently focused window, or nullptr if none exists or no window is being treated as current. More... | |
| helios::input::InputManager & | inputManager () const |
|
Returns the input manager owned by this application. More... | |
| helios::rendering::RenderingDevice & | renderingDevice () const |
|
Returns the rendering device owned by this application. More... | |
| helios::event::EventManager & | eventManager () const |
|
Returns the event manager owned by this application. More... | |
Protected Member Attributes Index
| bool | initialized_ = false |
|
Flag indicating whether the application has been initialized. More... | |
| std::unique_ptr< helios::rendering::RenderingDevice > | renderingDevice_ |
|
The rendering device owned by this application. More... | |
| std::unique_ptr< input::InputManager > | inputManager_ |
|
The input manager owned by this application. More... | |
| std::unique_ptr< event::EventManager > | eventManager_ |
|
The event manager owned by this application. More... | |
| std::list< std::unique_ptr< helios::window::Window > > | windowList_ |
|
A list containing all windows managed by this application. More... | |
| std::vector< std::unique_ptr< helios::app::controller::Controller > > | controllers_ |
|
Collection of controllers registered with this application. More... | |
Protected Static Attributes Index
| static const helios::util::log::Logger & | logger_ = helios::util::log::LogManager::loggerForScope(HELIOS_LOG_SCOPE) |
|
Shared logger instance for all Application objects. More... | |
Description
Class providing the entry point for a helios application.
`Application` serves as the central hub for the helios framework, offering convenient access and management for key subsystems such as the EventManager, the InputManager and the RenderingDevice.
It also allows for the registration of `helios.app.controller.Controller`s, which can provide specialized logic and management for the various subsystems and related events.
Definition at line 40 of file Application.ixx.
Public Constructors
Application()
| inline explicit |
Creates a new application instance.
The application will take ownership of the specified constructor arguments.
- Parameters
-
renderingDevice Unique rendering device owned by the application.
inputManager Unique input manager instance.
eventManager Unique event manager instance.
Definition at line 98 of file Application.ixx.
References eventManager, eventManager_, inputManager, inputManager_, renderingDevice and renderingDevice_.
Referenced by helios::ext::glfw::app::GLFWApplication::GLFWApplication.
Public Destructor
~Application()
| virtual default |
- Todo
-
free resource allocations from renderingDevice, window and InputManager
Definition at line 84 of file Application.ixx.
Public Member Functions
addController()
| inline noexcept |
Registers a new controller with this application.
Makes sure that the controller subscribes to the event manager's dispatcher of this application. The application receives ownership of the specified controller.
- Parameters
-
controller Unique pointer to the controller to add.
Definition at line 121 of file Application.ixx.
References controllers_, eventManager_, initialized_ and logger_.
createWindow()
| nodiscard |
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 145 of file Application.ixx.
current()
| nodiscard noexcept |
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 208 of file Application.ixx.
eventManager()
| inline nodiscard |
Returns the event manager owned by this application.
- Returns
Reference to the event manager instance.
Definition at line 234 of file Application.ixx.
Reference eventManager_.
Referenced by Application and helios::ext::glfw::app::GLFWApplication::GLFWApplication.
hasWindow()
| inline nodiscard noexcept |
Returns true if the specified window is owned by this application, otherwise false.
- Parameters
-
win The window to look up in this application's window list.
- Returns
True if the window is owned by this application, otherwise false.
Definition at line 192 of file Application.ixx.
Reference windowList_.
Referenced by helios::ext::glfw::app::GLFWApplication::setCurrent.
init()
| inline 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 156 of file Application.ixx.
References controllers_, eventManager_, initialized_ and logger_.
inputManager()
| inline nodiscard |
Returns the input manager owned by this application.
- Returns
Reference to the input manager instance.
Definition at line 216 of file Application.ixx.
References inputManager and inputManager_.
Referenced by Application, helios::ext::glfw::app::GLFWApplication::GLFWApplication and inputManager.
renderingDevice()
| inline nodiscard |
Returns the rendering device owned by this application.
- Returns
Reference to the rendering device instance.
Definition at line 225 of file Application.ixx.
Reference renderingDevice_.
Referenced by Application and helios::ext::glfw::app::GLFWApplication::GLFWApplication.
setCurrent()
|
Sets the application's active window.
Advises the input manager to poll this window's events.
- Parameters
-
win Reference to the window that becomes the current active window.
Definition at line 181 of file Application.ixx.
Protected Member Attributes
controllers_
| protected |
Collection of controllers registered with this application.
Definition at line 76 of file Application.ixx.
Referenced by addController and init.
eventManager_
| protected |
The event manager owned by this application.
Definition at line 66 of file Application.ixx.
Referenced by addController, Application, eventManager and init.
initialized_
| protected |
Flag indicating whether the application has been initialized.
Definition at line 51 of file Application.ixx.
Referenced by addController and init.
inputManager_
| protected |
The input manager owned by this application.
Definition at line 61 of file Application.ixx.
Referenced by Application, inputManager and helios::ext::glfw::app::GLFWApplication::setCurrent.
renderingDevice_
| protected |
The rendering device owned by this application.
Definition at line 56 of file Application.ixx.
Referenced by Application, helios::ext::glfw::app::GLFWApplication::createWindow and renderingDevice.
windowList_
| protected |
A list containing all windows managed by this application.
Definition at line 71 of file Application.ixx.
Referenced by helios::ext::glfw::app::GLFWApplication::createWindow and hasWindow.
Protected Static Attributes
logger_
| protected static |
Shared logger instance for all Application objects.
Definition at line 46 of file Application.ixx.
Referenced by addController, helios::ext::glfw::app::GLFWApplication::createWindow, helios::ext::glfw::app::GLFWApplication::createWindow, init and helios::ext::glfw::app::GLFWApplication::setCurrent.
The documentation for this class was generated from the following file:
Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.15.0.