API Documentation
Public Member Functions | List of all members
nkGraphics::MainSystem Class Referencefinal

Main interface with the component system. More...

Inheritance diagram for nkGraphics::MainSystem:

Public Member Functions

 ~MainSystem ()
 
RenderergetRenderer () const
 
bool isInitialized () const
 
bool getHasRunToContinue () const
 
void setHasRunToContinue (bool value)
 
bool initialize (const Configuration &config=Configuration())
 
void run (RenderContext *context, std::function< void()> loopCallback=[]() {})
 
void shutdown ()
 
bool frame (RenderContext *context)
 
void tickForNewFrame (RenderContext *context)
 

Detailed Description

Main interface with the component system.

Used to initialize or shuts all of its sub parts, also used for framing or running.

Constructor & Destructor Documentation

◆ ~MainSystem()

nkGraphics::MainSystem::~MainSystem ( )

Destructor.

Member Function Documentation

◆ getRenderer()

Renderer* nkGraphics::MainSystem::getRenderer ( ) const
Returns
The renderer used by the system.

◆ isInitialized()

bool nkGraphics::MainSystem::isInitialized ( ) const
Returns
Whether the system is initialized (true) or not (false).

◆ getHasRunToContinue()

bool nkGraphics::MainSystem::getHasRunToContinue ( ) const
Returns
Whether the system has its running flag activated (true) or not (false). When initializing, the flag starts at true.

◆ setHasRunToContinue()

void nkGraphics::MainSystem::setHasRunToContinue ( bool  value)

Sets whether the run should proceed. Can be used to halt the run.

Parameters
valueIf the rendering should be stopped (true) or not (false).

◆ initialize()

bool nkGraphics::MainSystem::initialize ( const Configuration config = Configuration())

Initializes the component and all of its sub part. This implies launching the graphic system and initializing the renderer.

Parameters
configThe configuration to use during initialization.
Returns
If the initialization was a success (true) or not (false).

◆ run()

void nkGraphics::MainSystem::run ( RenderContext context,
std::function< void()>  loopCallback = []() {} 
)

Runs the component. This means entering an internal running loop. This loop can be sufficient for most use cases. It ticks inputs and rendering for a given context, before calling the potential callback provided. For more complex usage (multi windowing for instance), it is recommended to manually frame in a custom rendering loop.

Parameters
contextThe context to run with.
loopCallbackA potential callback to call at each loop iteration.

◆ shutdown()

void nkGraphics::MainSystem::shutdown ( )

Shuts down the component. This frees all memory linked to it and ensure a clean leave.

◆ frame()

bool nkGraphics::MainSystem::frame ( RenderContext context)

Frames the component, once. This will update input, and render, only once.

Parameters
contextThe context to render for.
Returns
If the rendering was a success (true), or not (false).

◆ tickForNewFrame()

void nkGraphics::MainSystem::tickForNewFrame ( RenderContext context)

Ticks the engine for a new frame, without rendering. This implies setting everything up for a clean rendering for a context, and checking how async work is going. Called automatically by a frame() call.

Parameters
contextThe context to tick for.

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