From f96d521af265386aa815e0c041793f2ffc6c7843 Mon Sep 17 00:00:00 2001 From: veclavtalica Date: Sun, 13 Oct 2024 18:14:36 +0300 Subject: [PATCH] CMakeLists.txt: don't precompile stb_ds.h, precompile SDL.h --- CMakeLists.txt | 2 +- src/rendering/twn_gl_15_rendering.c | 1 + src/rendering/twn_text.c | 2 +- src/twn_util.c | 3 ++- 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 28a51ac..69112f8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -133,7 +133,7 @@ set_target_properties(${TWN_TARGET} PROPERTIES # precompile commonly used not-so-small headers target_precompile_headers(${TWN_TARGET} PRIVATE $<$>:third-party/glad/include/glad/glad.h> - third-party/stb/stb_ds.h) + ${SDL2_INCLUDE_DIR}/SDL.h) function(give_options_without_warnings target) diff --git a/src/rendering/twn_gl_15_rendering.c b/src/rendering/twn_gl_15_rendering.c index 5b8c2b1..82ebc2d 100644 --- a/src/rendering/twn_gl_15_rendering.c +++ b/src/rendering/twn_gl_15_rendering.c @@ -5,6 +5,7 @@ #include "twn_text_c.h" #include +#include /* interleaved vertex array data */ diff --git a/src/rendering/twn_text.c b/src/rendering/twn_text.c index 478ad96..7a634e3 100644 --- a/src/rendering/twn_text.c +++ b/src/rendering/twn_text.c @@ -5,7 +5,7 @@ #include "twn_engine_context_c.h" #include - +#include #define ASCII_START 32 #define ASCII_END 128 diff --git a/src/twn_util.c b/src/twn_util.c index 17f459e..49fdef2 100644 --- a/src/twn_util.c +++ b/src/twn_util.c @@ -125,7 +125,6 @@ int clampi(int i, int min, int max) { } - int64_t file_to_bytes(const char *path, unsigned char **buf_out) { SDL_RWops *handle = PHYSFSRWOPS_openRead(path); @@ -272,10 +271,12 @@ void tick_timer(int *value) { *value = MAX(*value - 1, 0); } + void tick_ftimer(float *value) { *value = MAX(*value - ((float)ctx.delta_time / (float)ctx.clocks_per_second), 0.0f); } + bool repeat_ftimer(float *value, float at) { *value -= (float)ctx.delta_time / (float)ctx.clocks_per_second; if (*value < 0.0f) {