diff --git a/MiniEngine.cpp b/MiniEngine.cpp index a2b4010..00fcafa 100644 --- a/MiniEngine.cpp +++ b/MiniEngine.cpp @@ -573,7 +573,7 @@ namespace MiniEngine font.reset(temp, TTF_CloseFont); return 0; } - + bool Font::isReady() { return (font.get() != nullptr); @@ -635,6 +635,54 @@ namespace MiniEngine return rnd.render(surf); } + void LogSystem::d(const char* fmt,...) + { + va_list ap; + va_start(ap,fmt); + SDL_LogMessageV(SDL_LOG_CATEGORY_APPLICATION,SDL_LOG_PRIORITY_DEBUG,fmt,ap); + va_end(ap); + } + + void LogSystem::v(const char* fmt,...) + { + va_list ap; + va_start(ap,fmt); + SDL_LogMessageV(SDL_LOG_CATEGORY_APPLICATION,SDL_LOG_PRIORITY_VERBOSE,fmt,ap); + va_end(ap); + } + + void LogSystem::e(const char* fmt,...) + { + va_list ap; + va_start(ap,fmt); + SDL_LogMessageV(SDL_LOG_CATEGORY_APPLICATION,SDL_LOG_PRIORITY_ERROR,fmt,ap); + va_end(ap); + } + + void LogSystem::i(const char* fmt,...) + { + va_list ap; + va_start(ap,fmt); + SDL_LogMessageV(SDL_LOG_CATEGORY_APPLICATION,SDL_LOG_PRIORITY_INFO,fmt,ap); + va_end(ap); + } + + void LogSystem::w(const char* fmt,...) + { + va_list ap; + va_start(ap,fmt); + SDL_LogMessageV(SDL_LOG_CATEGORY_APPLICATION,SDL_LOG_PRIORITY_WARN,fmt,ap); + va_end(ap); + } + + void LogSystem::critical(const char* fmt,...) + { + va_list ap; + va_start(ap,fmt); + SDL_LogMessageV(SDL_LOG_CATEGORY_APPLICATION,SDL_LOG_PRIORITY_CRITICAL,fmt,ap); + va_end(ap); + } + int SDLSystem::SDLInit() { return SDL_Init(SDL_INIT_EVERYTHING); diff --git a/MiniEngine.h b/MiniEngine.h index c296c30..fec9a0c 100644 --- a/MiniEngine.h +++ b/MiniEngine.h @@ -236,6 +236,16 @@ namespace MiniEngine enum class Platform { Unknown,Windows,MacOS,Linux,iOS,Android }; enum class PowerState { Unknown,OnBattery,NoBattery,Charging,Charged }; + class LogSystem + { + static void v(const char* fmt,...);/// Verbose + static void d(const char* fmt,...);/// Debug + static void i(const char* fmt,...);/// Information + static void w(const char* fmt,...);/// Warning + static void e(const char* fmt,...);/// Error + static void critical(const char* fmt,...);/// Critical + }; + class SDLSystem { public: