diff --git a/include/blah/app.h b/include/blah/app.h index cb2d292..142528a 100644 --- a/include/blah/app.h +++ b/include/blah/app.h @@ -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. diff --git a/src/app.cpp b/src/app.cpp index 4831737..5e86512 100644 --- a/src/app.cpp +++ b/src/app.cpp @@ -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 diff --git a/src/common.cpp b/src/common.cpp index 05b1769..768d5ea 100644 --- a/src/common.cpp +++ b/src/common.cpp @@ -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); }