#include <Application.hpp>
The main Application class
Definition at line 43 of file Application.hpp.
◆ Application() [1/3]
Application::Application |
( |
const char * | applicationName | ) |
|
|
explicitprotectednoexcept |
Creates a new application instance
- Parameters
-
applicationName | The name of your application |
Definition at line 49 of file Application.cpp.
◆ Application() [2/3]
Kale::Application::Application |
( |
const Application & | other | ) |
|
|
delete |
◆ Application() [3/3]
◆ addNodeCleanupFunction()
static void Kale::Application::addNodeCleanupFunction |
( |
std::function< void()> | func | ) |
|
|
inlinestatic |
Adds a node cleanup function to the list of methods to be called when cleaning up nodes Node cleanups are a one time process called prior to the application closing. It is done after application's onEnd
- Parameters
-
func | The function to be called |
Definition at line 233 of file Application.hpp.
◆ addNodeSetupFunction()
static void Kale::Application::addNodeSetupFunction |
( |
std::function< void()> | func | ) |
|
|
inlinestatic |
Adds a node setup function to the list of methods to be called when setting up nodes Node setups are a one time process, called before any scene is loaded and after application's on begin
- Parameters
-
func | The function to be called |
Definition at line 224 of file Application.hpp.
◆ getAssetFolderPath()
std::string Application::getAssetFolderPath |
( |
| ) |
const |
Gets the path to the assets folder
- Returns
- The path to the assets folder
Definition at line 119 of file Application.cpp.
◆ getNumUpdateThreads()
size_t Application::getNumUpdateThreads |
( |
| ) |
const |
|
noexcept |
Gets the number of threads currently being used to update
- Returns
- The number of threads used for updating
Definition at line 93 of file Application.cpp.
◆ getPresentedScene() [1/2]
std::shared_ptr< const Scene > Application::getPresentedScene |
( |
| ) |
const |
|
noexcept |
Gets the currently presented scene
- Returns
- The currently presented scene pointer
Definition at line 85 of file Application.cpp.
◆ getPresentedScene() [2/2]
std::shared_ptr< Scene > Application::getPresentedScene |
( |
| ) |
|
|
noexcept |
Gets the currently presented scene
- Returns
- The currently presented scene pointer
Definition at line 70 of file Application.cpp.
◆ getWindow() [1/2]
const Window & Application::getWindow |
( |
| ) |
const |
|
noexcept |
Gets the window
- Returns
- a pointer to the window
Gets the window
Definition at line 77 of file Application.cpp.
◆ getWindow() [2/2]
Window & Application::getWindow |
( |
| ) |
|
|
noexcept |
Gets the window
- Returns
- a pointer to the window
Gets the window
Definition at line 62 of file Application.cpp.
◆ int::main()
Kale::Application::int::main |
( |
| ) |
|
|
protected |
◆ onBegin()
virtual void Kale::Application::onBegin |
( |
| ) |
|
|
inlineprotectedvirtual |
Called when the application begins, just before the window is run.
Definition at line 137 of file Application.hpp.
◆ onEnd()
virtual void Kale::Application::onEnd |
( |
| ) |
|
|
inlineprotectedvirtual |
Called just before the application is ended
Definition at line 142 of file Application.hpp.
◆ operator=() [1/2]
void Kale::Application::operator= |
( |
Application && | other | ) |
|
|
delete |
◆ operator=() [2/2]
void Kale::Application::operator= |
( |
const Application & | other | ) |
|
|
delete |
◆ presentScene()
void Application::presentScene |
( |
const std::shared_ptr< Scene > & | scene | ) |
|
Presents a given scene
- Parameters
-
scene | The scene to present |
Definition at line 101 of file Application.cpp.
◆ run()
void Application::run |
( |
| ) |
|
|
protectednoexcept |
◆ runTaskOnMainThread()
void Application::runTaskOnMainThread |
( |
std::function< void()> | task | ) |
|
Runs a given task on the main thread prior to rendering on any given frame, Can be called on any thread
- Note
- Do not use reference based lambdas if anything referenced is at risk of being destroyed.
- Parameters
-
task | A method which carries out any necessary task |
Definition at line 110 of file Application.cpp.
◆ synchronizeUpdate()
void Application::synchronizeUpdate |
( |
| ) |
|
|
private |
◆ update()
void Application::update |
( |
size_t | threadNum | ) |
|
|
privatenoexcept |
Handles updating the application in a separate thread
- Parameters
-
threadNum | the index of this thread, ranged 0 - numUpdateThreads |
Definition at line 144 of file Application.cpp.
◆ applicationName
const std::string Kale::Application::applicationName |
The name of the application the engine is being used for
Definition at line 162 of file Application.hpp.
◆ deltaTime
float Kale::Application::deltaTime |
|
private |
The time taken to update and render each frame, set at the end of every render
Definition at line 104 of file Application.hpp.
◆ nodeCleanupFuncs
std::vector< std::function< void()> > Application::nodeCleanupFuncs = { PathNode::cleanup } |
|
staticprivate |
A vector of cleanup functions required for individual nodes
Definition at line 54 of file Application.hpp.
◆ nodeSetupFuncs
std::vector< std::function< void()> > Application::nodeSetupFuncs = { PathNode::setup } |
|
staticprivate |
A vector of setup functions required for individual nodes
Definition at line 49 of file Application.hpp.
◆ numThreadsUpdated
size_t Kale::Application::numThreadsUpdated |
|
private |
◆ presentedScene
std::shared_ptr<Scene> Kale::Application::presentedScene |
|
private |
◆ renderingFinished
bool Kale::Application::renderingFinished |
|
private |
◆ renderSyncCondVar
std::condition_variable Kale::Application::renderSyncCondVar |
|
private |
◆ sceneToPresent
std::shared_ptr<Scene> Kale::Application::sceneToPresent |
|
private |
◆ taskManagerMutex
std::mutex Kale::Application::taskManagerMutex |
|
private |
Used for synchronizing access to tasks across threads
Definition at line 74 of file Application.hpp.
◆ tasks
std::queue<std::function<void()> > Kale::Application::tasks |
|
private |
◆ threadSyncCondVar
std::condition_variable Kale::Application::threadSyncCondVar |
|
private |
◆ threadSyncMutex
std::mutex Kale::Application::threadSyncMutex |
|
private |
◆ updateThreads
std::list<std::thread> Kale::Application::updateThreads |
|
private |
◆ updatingFinished
bool Kale::Application::updatingFinished |
|
private |
◆ window
Window Kale::Application::window |
|
protected |
The main window used for rendering for this application instance
Definition at line 132 of file Application.hpp.
The documentation for this class was generated from the following files: