Main interface with the component system. More...
Public Member Functions | |
~MainSystem () | |
Renderer * | getRenderer () 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) |
Main interface with the component system.
Used to initialize or shuts all of its sub parts, also used for framing or running.
nkGraphics::MainSystem::~MainSystem | ( | ) |
Destructor.
Renderer* nkGraphics::MainSystem::getRenderer | ( | ) | const |
bool nkGraphics::MainSystem::isInitialized | ( | ) | const |
bool nkGraphics::MainSystem::getHasRunToContinue | ( | ) | const |
void nkGraphics::MainSystem::setHasRunToContinue | ( | bool | value | ) |
Sets whether the run should proceed. Can be used to halt the run.
value | If the rendering should be stopped (true) or not (false). |
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.
config | The configuration to use during initialization. |
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.
context | The context to run with. |
loopCallback | A potential callback to call at each loop iteration. |
void nkGraphics::MainSystem::shutdown | ( | ) |
Shuts down the component. This frees all memory linked to it and ensure a clean leave.
bool nkGraphics::MainSystem::frame | ( | RenderContext * | context | ) |
Frames the component, once. This will update input, and render, only once.
context | The context to render for. |
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.
context | The context to tick for. |