mirror of
https://github.com/Kiritow/MiniEngine.git
synced 2024-03-22 13:11:22 +08:00
Add LogSystem
This commit is contained in:
parent
813de57b40
commit
32f91125e9
|
@ -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);
|
||||
|
|
10
MiniEngine.h
10
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:
|
||||
|
|
Loading…
Reference in New Issue
Block a user