remove unused SDL2/SDL.h and physfs.h from twn_util.h, explicit usage of SDL in apps, move to Scancode enum in apps
This commit is contained in:
		| @@ -1,6 +1,8 @@ | ||||
| #include "twn_game_api.h" | ||||
| #include "state.h" | ||||
|  | ||||
| #include <SDL2/SDL.h> | ||||
|  | ||||
| #include <lua.h> | ||||
| #include <lualib.h> | ||||
| #include <lauxlib.h> | ||||
|   | ||||
| @@ -4,7 +4,6 @@ | ||||
|  | ||||
| #include "twn_game_api.h" | ||||
|  | ||||
| #include <SDL_scancode.h> | ||||
| #include <stdio.h> | ||||
| #include <malloc.h> | ||||
| #include <stdint.h> | ||||
| @@ -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; | ||||
|   | ||||
| @@ -4,6 +4,8 @@ | ||||
|  | ||||
| #include "twn_game_api.h" | ||||
|  | ||||
| #include <SDL2/SDL.h> | ||||
|  | ||||
|  | ||||
| static void ingame_tick(State *state) { | ||||
|     SceneIngame *scn = (SceneIngame *)state->scene; | ||||
|   | ||||
| @@ -5,6 +5,8 @@ | ||||
|  | ||||
| #include "twn_game_api.h" | ||||
|  | ||||
| #include <SDL2/SDL.h> | ||||
|  | ||||
| #include <stdio.h> | ||||
|  | ||||
|  | ||||
|   | ||||
| @@ -4,10 +4,10 @@ | ||||
|  | ||||
| #include "twn_game_api.h" | ||||
|  | ||||
| #include <SDL_scancode.h> | ||||
| #include <stdio.h> | ||||
| #include <malloc.h> | ||||
| #include <stdint.h> | ||||
| #include <stdlib.h> | ||||
|  | ||||
|  | ||||
| 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; | ||||
|   | ||||
| @@ -6,6 +6,9 @@ | ||||
|  | ||||
| #define STB_PERLIN_IMPLEMENTATION | ||||
| #include <stb_perlin.h> | ||||
| #include <SDL2/SDL.h> | ||||
|  | ||||
| #include <stdlib.h> | ||||
|  | ||||
|  | ||||
| static void ingame_tick(State *state) { | ||||
|   | ||||
| @@ -4,6 +4,7 @@ | ||||
| #include "twn_game_api.h" | ||||
|  | ||||
| #include <stdio.h> | ||||
| #include <stdlib.h> | ||||
|  | ||||
|  | ||||
| static void title_tick(State *state) { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user