diff --git a/CMakeLists.txt b/CMakeLists.txt index c8722ba..7580598 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -164,6 +164,7 @@ function(give_options target) -Wdouble-promotion -Wconversion -Wno-sign-conversion -Werror=vla + -Wno-missing-field-initializers $<$:-Wcast-align=strict>) target_compile_options(${target} PRIVATE diff --git a/apps/testgame/game.c b/apps/testgame/game.c index 59f2ef5..6ba4617 100644 --- a/apps/testgame/game.c +++ b/apps/testgame/game.c @@ -20,8 +20,6 @@ void game_tick(void) { state->scene = title_scene(state); } - struct state *state = ctx.udata; - input_add_action(&ctx.input, "debug_dump_atlases"); input_bind_action_scancode(&ctx.input, "debug_dump_atlases", SDL_SCANCODE_HOME); diff --git a/apps/testgame/scenes/ingame.c b/apps/testgame/scenes/ingame.c index a4686be..c8afdb8 100644 --- a/apps/testgame/scenes/ingame.c +++ b/apps/testgame/scenes/ingame.c @@ -59,7 +59,7 @@ static void ingame_tick(struct state *state) { m_set(rect, ((t_frect){ 256, 256, 48, 48 })), m_opt(color, ((t_color){ 255, 255, 255, 255 })), m_opt(stretch, false ), - m_opt(texture_origin, ((t_fvec2){ ctx.tick_count % 48, ctx.tick_count % 48 }))); + m_opt(texture_origin, ((t_fvec2){ (float)(ctx.tick_count % 48), (float)(ctx.tick_count % 48) }))); m_sprite(m_set(path, "/assets/light.png"), m_set(rect, ((t_frect){ 48, 64, 64, 64 })), diff --git a/apps/testgame/scenes/title.c b/apps/testgame/scenes/title.c index 5807e13..8d616b5 100644 --- a/apps/testgame/scenes/title.c +++ b/apps/testgame/scenes/title.c @@ -18,13 +18,13 @@ static void title_tick(struct state *state) { m_sprite("/assets/title.png", ((t_frect) { - (RENDER_BASE_WIDTH / 2) - (320 / 2), 64, 320, 128 })); + ((float)RENDER_BASE_WIDTH / 2) - ((float)320 / 2), 64, 320, 128 })); /* draw the tick count as an example of dynamic text */ - size_t text_str_len = snprintf(NULL, 0, "%lld", state->ctx->tick_count) + 1; + size_t text_str_len = snprintf(NULL, 0, "%lu", state->ctx->tick_count) + 1; char *text_str = cmalloc(text_str_len); - snprintf(text_str, text_str_len, "%lld", state->ctx->tick_count); + snprintf(text_str, text_str_len, "%lu", state->ctx->tick_count); const char *font = "fonts/kenney-pixel.ttf"; int text_h = 32; diff --git a/townengine/game_object/twn_linux_game_object_c.h b/townengine/game_object/twn_linux_game_object_c.h index dab0712..1aa77ed 100644 --- a/townengine/game_object/twn_linux_game_object_c.h +++ b/townengine/game_object/twn_linux_game_object_c.h @@ -37,6 +37,9 @@ static void load_game_object(void) { goto ERR_OPENING_SO; } +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wpedantic" + game_tick_callback = (void (*)(void))dlsym(new_handle, "game_tick"); if (!game_tick_callback) { CRY("Hot Reload Error", "game_tick_callback() symbol wasn't found"); @@ -49,6 +52,8 @@ static void load_game_object(void) { goto ERR_GETTING_PROC; } +#pragma GCC diagnostic pop + handle = new_handle; if (ctx.tick_count != 0) diff --git a/townengine/game_object/twn_win32_game_object_c.h b/townengine/game_object/twn_win32_game_object_c.h index 32006e0..7814f24 100644 --- a/townengine/game_object/twn_win32_game_object_c.h +++ b/townengine/game_object/twn_win32_game_object_c.h @@ -29,6 +29,9 @@ static void load_game_object(void) { goto ERR_OPENING_SO; } +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wpedantic" + game_tick_callback = (void (*)(void))GetProcAddress(new_handle, "game_tick"); if (!game_tick_callback) { CRY("Hot Reload Error", "game_tick_callback() symbol wasn't found"); @@ -41,6 +44,8 @@ static void load_game_object(void) { goto ERR_GETTING_PROC; } +#pragma GCC diagnostic pop + handle = new_handle; if (ctx.tick_count != 0) diff --git a/townengine/input/input.c b/townengine/input/input.c index 96d46cf..9b45e11 100644 --- a/townengine/input/input.c +++ b/townengine/input/input.c @@ -303,12 +303,14 @@ t_fvec2 input_get_action_position(struct input_state *input, char *action_name) void input_set_mouse_captured(struct input_state *input, bool enabled) { + (void)input; /* TODO: returns -1 if not supported, but like... do we care? */ SDL_SetRelativeMouseMode(enabled); } bool input_is_mouse_captured(struct input_state *input) { + (void)input; return SDL_GetRelativeMouseMode(); }