#include "ingame.h" #include "title.h" #include "scene.h" #include "twn_game_api.h" #include "twn_vec.h" #include static void ingame_tick(State *state) { SceneIngame *scn = (SceneIngame *)state->scene; input_action("player_left", CONTROL_A); input_action("player_right", CONTROL_D); input_action("player_forward", CONTROL_W); input_action("player_backward", CONTROL_S); input_action("player_jump", CONTROL_SPACE); input_action("player_run", CONTROL_LSHIFT); world_drawdef(scn->world); player_calc(scn->player); } static void ingame_end(State *state) { SceneIngame *scn = (SceneIngame *)state->scene; player_destroy(scn->player); world_destroy(scn->world); free(state->scene); } Scene *ingame_scene(State *state) { (void)state; SceneIngame *new_scene = ccalloc(1, sizeof *new_scene); new_scene->base.tick = ingame_tick; new_scene->base.end = ingame_end; new_scene->world = world_create(); new_scene->player = player_create(new_scene->world); return (Scene *)new_scene; }