yet another api rework, removal of integer types in public api, optionals at the end, some cleaning
This commit is contained in:
@@ -11,35 +11,15 @@
|
||||
static void ingame_tick(State *state) {
|
||||
SceneIngame *scn = (SceneIngame *)state->scene;
|
||||
|
||||
input_bind_action_control("player_left", CONTROL_A);
|
||||
input_bind_action_control("player_right", CONTROL_D);
|
||||
input_bind_action_control("player_forward", CONTROL_W);
|
||||
input_bind_action_control("player_backward", CONTROL_S);
|
||||
input_bind_action_control("player_jump", CONTROL_SPACE);
|
||||
input_bind_action_control("player_run", CONTROL_LSHIFT);
|
||||
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);
|
||||
|
||||
const Vec3 right = m_vec_norm(m_vec_cross(scn->cam.target, scn->cam.up));
|
||||
const float speed = 0.04f; /* TODO: put this in a better place */
|
||||
if (input_is_action_pressed("player_left"))
|
||||
scn->cam.pos = vec3_sub(scn->cam.pos, m_vec_scale(right, speed));
|
||||
|
||||
if (input_is_action_pressed("player_right"))
|
||||
scn->cam.pos = vec3_add(scn->cam.pos, m_vec_scale(right, speed));
|
||||
|
||||
if (input_is_action_pressed("player_forward"))
|
||||
scn->cam.pos = vec3_add(scn->cam.pos, m_vec_scale(scn->cam.target, speed));
|
||||
|
||||
if (input_is_action_pressed("player_backward"))
|
||||
scn->cam.pos = vec3_sub(scn->cam.pos, m_vec_scale(scn->cam.target, speed));
|
||||
|
||||
if (input_is_action_pressed("player_jump"))
|
||||
scn->cam.pos.y += speed;
|
||||
|
||||
if (input_is_action_pressed("player_run"))
|
||||
scn->cam.pos.y -= speed;
|
||||
}
|
||||
|
||||
|
||||
@@ -61,7 +41,5 @@ Scene *ingame_scene(State *state) {
|
||||
new_scene->world = world_create();
|
||||
new_scene->player = player_create(new_scene->world);
|
||||
|
||||
new_scene->cam = (Camera){ .pos = { 32, 0, 1 }, .up = { 0, 1, 0 }, .fov = (float)M_PI_2 };
|
||||
|
||||
return (Scene *)new_scene;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user