working camera

This commit is contained in:
2024-07-30 18:05:05 +03:00
parent 4a924cb2a9
commit ea29f2c5f0
4 changed files with 60 additions and 27 deletions

View File

@ -11,14 +11,14 @@ static void ingame_tick(struct state *state) {
world_drawdef(scn->world);
player_calc(scn->player);
static t_camera cam = { .pos = { 0 }, .target = { 0, 0, -1 }, .up = { 0, -1, 0 }, .fov = (float)M_PI_2 };
static t_camera cam = { .pos = { 0, 0, 1 }, .target = { 0, 0, -1 }, .up = { 0, 1, 0 }, .fov = (float)M_PI_2 };
if (input_is_action_pressed(&ctx.input, "player_left"))
cam.pos.x -= 0.01f;
if (input_is_action_pressed(&ctx.input, "player_right"))
cam.pos.x += 0.01f;
if (input_is_action_pressed(&ctx.input, "player_jump"))
cam.pos.z -= 0.01f;
cam.pos.z += 0.01f;
m_sprite(m_set(path, "/assets/light.png"),
m_set(rect, ((t_frect){ 48, 64, 64, 64 })),