This commit is contained in:
veclavtalica 2025-01-30 05:10:38 +03:00
parent 74d7190c62
commit 7074e7499a
5 changed files with 13 additions and 5 deletions

View File

@ -210,7 +210,7 @@ function(give_options_without_warnings target)
target_compile_definitions(${target} PRIVATE target_compile_definitions(${target} PRIVATE
$<$<BOOL:${TWN_FEATURE_DYNLIB_GAME}>:TWN_FEATURE_DYNLIB_GAME> $<$<BOOL:${TWN_FEATURE_DYNLIB_GAME}>:TWN_FEATURE_DYNLIB_GAME>
$<$<BOOL:${LINUX}>:_GNU_SOURCE>) _GNU_SOURCE)
endfunction() endfunction()

View File

@ -415,7 +415,7 @@ void render(void) {
void draw_camera(Vec3 position, Vec3 direction, Vec3 up, float fov, float zoom) { void draw_camera(Vec3 position, Vec3 direction, Vec3 up, float fov, float zoom) {
bool const orthographic = fabsf(0.0f - fov) < 0.00001f; bool const orthographic = fabsf(0.0f - fov) < 0.00001f;
if (!orthographic && fov >= M_PIf) if (!orthographic && fov >= (float)(M_PI))
log_warn("Invalid fov given (%f)", (double)fov); log_warn("Invalid fov given (%f)", (double)fov);
Camera const camera = { Camera const camera = {
@ -447,7 +447,7 @@ DrawCameraFromPrincipalAxesResult draw_camera_from_principal_axes(Vec3 position,
float zoom) float zoom)
{ {
bool const orthographic = fabsf(0.0f - fov) < 0.00001f; bool const orthographic = fabsf(0.0f - fov) < 0.00001f;
if (!orthographic && fov >= M_PIf) if (!orthographic && fov >= (float)(M_PI))
log_warn("Invalid fov given (%f)", (double)fov); log_warn("Invalid fov given (%f)", (double)fov);
(void)roll; (void)roll;

View File

@ -29,6 +29,8 @@ static void filewatch_callback(dmon_watch_id watch_id,
const char* oldfilepath, const char* oldfilepath,
void* user) void* user)
{ {
(void)watch_id; (void)rootdir; (void)filepath; (void)oldfilepath;
enum FilewatchAction faction; enum FilewatchAction faction;
switch (action) { switch (action) {
@ -41,6 +43,7 @@ static void filewatch_callback(dmon_watch_id watch_id,
case DMON_ACTION_MODIFY: case DMON_ACTION_MODIFY:
faction = FILEWATCH_ACTION_FILE_MODIFIED; faction = FILEWATCH_ACTION_FILE_MODIFIED;
break; break;
case DMON_ACTION_MOVE:
default: default:
return; return;
} }
@ -74,6 +77,8 @@ bool filewatch_add_directory(char const *dir, FileatchCallback callback) {
}; };
arrpush(filewatch_directories, w); arrpush(filewatch_directories, w);
dmon_watch(dir, filewatch_callback, DMON_WATCHFLAGS_RECURSIVE, (void *)(intptr_t)(arrlen(filewatch_directories) - 1)); dmon_watch(dir, filewatch_callback, DMON_WATCHFLAGS_RECURSIVE, (void *)(intptr_t)(arrlen(filewatch_directories) - 1));
return true;
} }
@ -91,6 +96,8 @@ bool filewatch_add_file(char const *filepath, FileatchCallback callback) {
}; };
arrpush(filewatch_files, f); arrpush(filewatch_files, f);
dmon_watch("./", filewatch_callback, 0, (void *)(intptr_t)(-arrlen(filewatch_files))); dmon_watch("./", filewatch_callback, 0, (void *)(intptr_t)(-arrlen(filewatch_files)));
return true;
} }

View File

@ -2,6 +2,7 @@
#include "twn_engine_context_c.h" #include "twn_engine_context_c.h"
#include <SDL2/SDL.h> #include <SDL2/SDL.h>
#include <stdlib.h>
static SDL_TimerID sanity_timer; static SDL_TimerID sanity_timer;
@ -19,7 +20,7 @@ static uint32_t sanity_timer_handler(uint32_t interval, void *data) {
/* TODO: figure out the most portable way to do it */ /* TODO: figure out the most portable way to do it */
/* TODO: different type of behavior is possible, especially for debugging */ /* TODO: different type of behavior is possible, especially for debugging */
quick_exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }

View File

@ -2,7 +2,7 @@
#define TWN_TIMER_H #define TWN_TIMER_H
#include <stdbool.h> #include <stdbool.h>
#include <stdbit.h> #include <stdint.h>
bool start_sanity_timer(uint32_t milliseconds_to_expire); bool start_sanity_timer(uint32_t milliseconds_to_expire);
bool end_sanity_timer(void); bool end_sanity_timer(void);