added App::is_running() getter

This commit is contained in:
Noel Berry 2022-02-12 23:14:35 -08:00
parent 9beb7eff58
commit 8add71003c
3 changed files with 11 additions and 3 deletions

View File

@ -66,6 +66,9 @@ namespace Blah
// Runs the application
bool run(const Config* config);
// Checks if the Application is running yet
bool is_running();
// Exits the application.
// This only signals for the application to close, it will not stop
// until the current update and render calls are finished.

View File

@ -147,6 +147,11 @@ bool App::run(const Config* c)
return true;
}
bool App::is_running()
{
return app_is_running;
}
void App::Internal::iterate()
{
// update at a fixed timerate

View File

@ -13,7 +13,7 @@ void Log::info(const char* format, ...)
vsnprintf(msg, sizeof(char) * max_length, format, ap);
va_end(ap);
if (App::config().on_log)
if (App::is_running() && App::config().on_log)
{
App::config().on_log(msg, Category::Info);
}
@ -31,7 +31,7 @@ void Log::warn(const char* format, ...)
vsnprintf(msg, sizeof(char) * max_length, format, ap);
va_end(ap);
if (App::config().on_log)
if (App::is_running() && App::config().on_log)
{
App::config().on_log(msg, Category::Warning);
}
@ -49,7 +49,7 @@ void Log::error(const char* format, ...)
vsnprintf(msg, sizeof(char) * max_length, format, ap);
va_end(ap);
if (App::config().on_log)
if (App::is_running() && App::config().on_log)
{
App::config().on_log(msg, Category::Error);
}