From ca6c6a711c6dc0ee533d2601479bbf0c63ea3619 Mon Sep 17 00:00:00 2001 From: veclavtalica Date: Mon, 7 Oct 2024 00:00:36 +0300 Subject: [PATCH] remove unused SDL2/SDL.h and physfs.h from twn_util.h, explicit usage of SDL in apps, move to Scancode enum in apps --- apps/lua/game.c | 2 ++ apps/platformer/game.c | 21 ++++++++++----------- apps/platformer/scenes/ingame.c | 2 ++ apps/platformer/scenes/title.c | 2 ++ apps/scenery/game.c | 22 +++++++++++----------- apps/scenery/scenes/ingame.c | 3 +++ apps/scenery/scenes/title.c | 1 + include/twn_util.h | 3 --- 8 files changed, 31 insertions(+), 25 deletions(-) diff --git a/apps/lua/game.c b/apps/lua/game.c index 5136cc6..5f35919 100644 --- a/apps/lua/game.c +++ b/apps/lua/game.c @@ -1,6 +1,8 @@ #include "twn_game_api.h" #include "state.h" +#include + #include #include #include diff --git a/apps/platformer/game.c b/apps/platformer/game.c index f7fd7e0..e756ee1 100644 --- a/apps/platformer/game.c +++ b/apps/platformer/game.c @@ -4,7 +4,6 @@ #include "twn_game_api.h" -#include #include #include #include @@ -21,34 +20,34 @@ void game_tick(void) { } input_add_action(&ctx.input, "debug_toggle"); - input_bind_action_scancode(&ctx.input, "debug_toggle", SDL_SCANCODE_BACKSPACE); + input_bind_action_scancode(&ctx.input, "debug_toggle", SCANCODE_BACKSPACE); input_add_action(&ctx.input, "debug_dump_atlases"); - input_bind_action_scancode(&ctx.input, "debug_dump_atlases", SDL_SCANCODE_HOME); + input_bind_action_scancode(&ctx.input, "debug_dump_atlases", SCANCODE_HOME); input_add_action(&ctx.input, "player_left"); - input_bind_action_scancode(&ctx.input, "player_left", SDL_SCANCODE_A); + input_bind_action_scancode(&ctx.input, "player_left", SCANCODE_A); input_add_action(&ctx.input, "player_right"); - input_bind_action_scancode(&ctx.input, "player_right", SDL_SCANCODE_D); + input_bind_action_scancode(&ctx.input, "player_right", SCANCODE_D); input_add_action(&ctx.input, "player_forward"); - input_bind_action_scancode(&ctx.input, "player_forward", SDL_SCANCODE_W); + input_bind_action_scancode(&ctx.input, "player_forward", SCANCODE_W); input_add_action(&ctx.input, "player_backward"); - input_bind_action_scancode(&ctx.input, "player_backward", SDL_SCANCODE_S); + input_bind_action_scancode(&ctx.input, "player_backward", SCANCODE_S); input_add_action(&ctx.input, "player_jump"); - input_bind_action_scancode(&ctx.input, "player_jump", SDL_SCANCODE_SPACE); + input_bind_action_scancode(&ctx.input, "player_jump", SCANCODE_SPACE); input_add_action(&ctx.input, "player_run"); - input_bind_action_scancode(&ctx.input, "player_run", SDL_SCANCODE_LSHIFT); + input_bind_action_scancode(&ctx.input, "player_run", SCANCODE_LSHIFT); input_add_action(&ctx.input, "ui_accept"); - input_bind_action_scancode(&ctx.input, "ui_accept", SDL_SCANCODE_RETURN); + input_bind_action_scancode(&ctx.input, "ui_accept", SCANCODE_RETURN); input_add_action(&ctx.input, "mouse_capture_toggle"); - input_bind_action_scancode(&ctx.input, "mouse_capture_toggle", SDL_SCANCODE_ESCAPE); + input_bind_action_scancode(&ctx.input, "mouse_capture_toggle", SCANCODE_ESCAPE); } State *state = ctx.udata; diff --git a/apps/platformer/scenes/ingame.c b/apps/platformer/scenes/ingame.c index 4fe2279..5d6a369 100644 --- a/apps/platformer/scenes/ingame.c +++ b/apps/platformer/scenes/ingame.c @@ -4,6 +4,8 @@ #include "twn_game_api.h" +#include + static void ingame_tick(State *state) { SceneIngame *scn = (SceneIngame *)state->scene; diff --git a/apps/platformer/scenes/title.c b/apps/platformer/scenes/title.c index 25e3b3a..eafe6e0 100644 --- a/apps/platformer/scenes/title.c +++ b/apps/platformer/scenes/title.c @@ -5,6 +5,8 @@ #include "twn_game_api.h" +#include + #include diff --git a/apps/scenery/game.c b/apps/scenery/game.c index f7fd7e0..cdfcc6c 100644 --- a/apps/scenery/game.c +++ b/apps/scenery/game.c @@ -4,10 +4,10 @@ #include "twn_game_api.h" -#include #include #include #include +#include void game_tick(void) { @@ -21,34 +21,34 @@ void game_tick(void) { } input_add_action(&ctx.input, "debug_toggle"); - input_bind_action_scancode(&ctx.input, "debug_toggle", SDL_SCANCODE_BACKSPACE); + input_bind_action_scancode(&ctx.input, "debug_toggle", SCANCODE_BACKSPACE); input_add_action(&ctx.input, "debug_dump_atlases"); - input_bind_action_scancode(&ctx.input, "debug_dump_atlases", SDL_SCANCODE_HOME); + input_bind_action_scancode(&ctx.input, "debug_dump_atlases", SCANCODE_HOME); input_add_action(&ctx.input, "player_left"); - input_bind_action_scancode(&ctx.input, "player_left", SDL_SCANCODE_A); + input_bind_action_scancode(&ctx.input, "player_left", SCANCODE_A); input_add_action(&ctx.input, "player_right"); - input_bind_action_scancode(&ctx.input, "player_right", SDL_SCANCODE_D); + input_bind_action_scancode(&ctx.input, "player_right", SCANCODE_D); input_add_action(&ctx.input, "player_forward"); - input_bind_action_scancode(&ctx.input, "player_forward", SDL_SCANCODE_W); + input_bind_action_scancode(&ctx.input, "player_forward", SCANCODE_W); input_add_action(&ctx.input, "player_backward"); - input_bind_action_scancode(&ctx.input, "player_backward", SDL_SCANCODE_S); + input_bind_action_scancode(&ctx.input, "player_backward", SCANCODE_S); input_add_action(&ctx.input, "player_jump"); - input_bind_action_scancode(&ctx.input, "player_jump", SDL_SCANCODE_SPACE); + input_bind_action_scancode(&ctx.input, "player_jump", SCANCODE_SPACE); input_add_action(&ctx.input, "player_run"); - input_bind_action_scancode(&ctx.input, "player_run", SDL_SCANCODE_LSHIFT); + input_bind_action_scancode(&ctx.input, "player_run", SCANCODE_LSHIFT); input_add_action(&ctx.input, "ui_accept"); - input_bind_action_scancode(&ctx.input, "ui_accept", SDL_SCANCODE_RETURN); + input_bind_action_scancode(&ctx.input, "ui_accept", SCANCODE_RETURN); input_add_action(&ctx.input, "mouse_capture_toggle"); - input_bind_action_scancode(&ctx.input, "mouse_capture_toggle", SDL_SCANCODE_ESCAPE); + input_bind_action_scancode(&ctx.input, "mouse_capture_toggle", SCANCODE_ESCAPE); } State *state = ctx.udata; diff --git a/apps/scenery/scenes/ingame.c b/apps/scenery/scenes/ingame.c index 37cab09..572ffcc 100644 --- a/apps/scenery/scenes/ingame.c +++ b/apps/scenery/scenes/ingame.c @@ -6,6 +6,9 @@ #define STB_PERLIN_IMPLEMENTATION #include +#include + +#include static void ingame_tick(State *state) { diff --git a/apps/scenery/scenes/title.c b/apps/scenery/scenes/title.c index 7014b07..843dd63 100644 --- a/apps/scenery/scenes/title.c +++ b/apps/scenery/scenes/title.c @@ -4,6 +4,7 @@ #include "twn_game_api.h" #include +#include static void title_tick(State *state) { diff --git a/include/twn_util.h b/include/twn_util.h index d92e192..fbab247 100644 --- a/include/twn_util.h +++ b/include/twn_util.h @@ -4,9 +4,6 @@ #include "twn_vec.h" #include "twn_engine_api.h" -#include -#include - #include #include