LZY_Log takes variable argument list

This commit is contained in:
KikooDX 2022-04-12 11:48:42 +02:00
parent f2911ceebd
commit cefa79506f
1 changed files with 12 additions and 5 deletions

View File

@ -108,7 +108,7 @@ int LZY_PollEvent(LZY_Event *);
void LZY_CycleEvents(void);
int LZY_KeyDown(unsigned int key);
int LZY_ShouldQuit(void);
void LZY_Log(const char *msg);
void LZY_Log(const char *fmt, ...);
const char *LZY_GetError(void);
#ifdef __cplusplus
@ -469,8 +469,8 @@ int LZY_ShouldQuit(void) {
return should_quit;
}
void LZY_Log(const char *msg) {
LZY_UNUSED(msg);
void LZY_Log(const char *fmt, ...) {
LZY_UNUSED(fmt);
}
const char *LZY_GetError(void) {
@ -1050,8 +1050,15 @@ int LZY_ShouldQuit(void) {
return should_quit;
}
void LZY_Log(const char *msg) {
SDL_Log("%s", msg);
void LZY_Log(const char *fmt, ...) {
char buf[2048] = {0};
va_list args;
va_start(args, fmt);
vsnprintf(buf, sizeof(buf) - 1, fmt, args);
va_end(args);
SDL_Log("%s", buf);
}
const char *LZY_GetError(void) {