Guillaume 1.0.0
Guillaume.
Loading...
Searching...
No Matches
Application< RendererType > Class Template Reference

Entry point of the application. More...

#include <application.hpp>

Public Member Functions

 Application (void)
 Constructs an Application object.
 
 ~Application (void)=default
 Destroys the Application object.
 
std::shared_ptr< RendererType > getRenderer (void) const
 Gets the renderer.
 
std::shared_ptr< ContainergetRoot (void) const
 Gets the root container.
 
void setRoot (std::shared_ptr< Container > root)
 Sets the root container.
 
void run (void)
 Runs the application.
 
void update (void)
 Updates the application state.
 
void stop (void)
 Stop the application run loop (if managed externally).
 

Protected Member Functions

void drawTree (const std::shared_ptr< Component > &component)
 Recursively draw the component tree using the renderer.
 

Detailed Description

template<typename RendererType>
class Application< RendererType >

Entry point of the application.

The Application class holds the root component and manages the global lifecycle.

Member Function Documentation

◆ drawTree()

template<typename RendererType >
void Application< RendererType >::drawTree ( const std::shared_ptr< Component > &  component)
inlineprotected

Recursively draw the component tree using the renderer.

This walks the component hierarchy starting from the given component, draws all primitives in each component, and then recurses to children.

Parameters
componentThe starting component to draw

◆ getRenderer()

template<typename RendererType >
std::shared_ptr< RendererType > Application< RendererType >::getRenderer ( void  ) const
inline

Gets the renderer.

Returns
std::shared_ptr<RendererType> The renderer

◆ getRoot()

template<typename RendererType >
std::shared_ptr< Container > Application< RendererType >::getRoot ( void  ) const
inline

Gets the root container.

Returns
std::shared_ptr<Container> The root container

◆ run()

template<typename RendererType >
void Application< RendererType >::run ( void  )
inline

Runs the application.

This method starts the application lifecycle and performs a frame of the main loop using the renderer: clear, render, draw, and present. If you need continuous rendering, call this method in your own loop or extend it to manage events and timing.

◆ setRoot()

template<typename RendererType >
void Application< RendererType >::setRoot ( std::shared_ptr< Container root)
inline

Sets the root container.

Parameters
rootThe new root container

◆ update()

template<typename RendererType >
void Application< RendererType >::update ( void  )
inline

Updates the application state.

This method is called to update the application and trigger re-rendering.


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