replace log.c/h with SDL_Log*
This commit is contained in:
parent
ba39a0e5eb
commit
ae9571d270
@ -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
|
||||
|
||||
25
src/log.cpp
25
src/log.cpp
@ -1,25 +0,0 @@
|
||||
#include "log.h"
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
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");
|
||||
}
|
||||
@ -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, ...);
|
||||
@ -15,7 +15,6 @@
|
||||
#include <glm/gtc/type_ptr.hpp>
|
||||
|
||||
#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;
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user