From ae9571d27050515131105067db06f7466cc99c2e Mon Sep 17 00:00:00 2001 From: Sven Balzer <4653051+Kyuusokuna@users.noreply.github.com> Date: Wed, 15 Apr 2026 13:29:47 +0200 Subject: [PATCH] replace log.c/h with SDL_Log* --- CMakeLists.txt | 1 - src/log.cpp | 25 ------------------------- src/log.h | 7 ------- src/main.cpp | 7 ++++--- 4 files changed, 4 insertions(+), 36 deletions(-) delete mode 100644 src/log.cpp delete mode 100644 src/log.h diff --git a/CMakeLists.txt b/CMakeLists.txt index a944ae5..b511c95 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -64,7 +64,6 @@ option(TRACY_ONLY_LOCALHOST "" ON) add_subdirectory(libs/tracy) add_executable(mikemon - src/log.cpp src/smol-atlas.cpp src/change_directory.c src/shaders/shaders.c diff --git a/src/log.cpp b/src/log.cpp deleted file mode 100644 index b9d46dc..0000000 --- a/src/log.cpp +++ /dev/null @@ -1,25 +0,0 @@ -#include "log.h" -#include -#include - -void _log(const char* function_name, const char* format, ...) { - printf("[%s] ", function_name); - - va_list args; - va_start(args, format); - vprintf(format, args); - va_end(args); - - printf("\n"); -} - -void _log_error(const char* function_name, const char* format, ...) { - printf("[%s]ERROR: ", function_name); - - va_list args; - va_start(args, format); - vprintf(format, args); - va_end(args); - - printf("\n"); -} diff --git a/src/log.h b/src/log.h deleted file mode 100644 index f47130b..0000000 --- a/src/log.h +++ /dev/null @@ -1,7 +0,0 @@ -#pragma once - -#define log(...) _log(__FUNCTION__, __VA_ARGS__) -#define log_error(...) _log_error(__FUNCTION__, __VA_ARGS__) - -void _log(const char* function_name, const char* format, ...); -void _log_error(const char* function_name, const char* format, ...); \ No newline at end of file diff --git a/src/main.cpp b/src/main.cpp index fb82bbe..f9fea9a 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -15,7 +15,6 @@ #include #include "defer.h" -#include "log.h" #include "stb_image.h" #include "change_directory.h" @@ -100,6 +99,8 @@ static SDL_DateTime calendar_time; static vec2 mouse_pos; +#define log_error(...) SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, __VA_ARGS__) + float remap(float in_a, float in_b, float out_a, float out_b, float v) { return mix(out_a, out_b, (v - in_a) / (in_b - in_a)); } @@ -389,7 +390,7 @@ static bool save_map(Map map) { return false; }; - log("Saved map file."); + SDL_Log("Saved map file."); return true; } @@ -457,7 +458,7 @@ static bool load_map(const char *name, Map *result) { return 1; } - log("Loaded map file."); + SDL_Log("Loaded map file."); return true; }