The snake must grow.

This commit is contained in:
2025-12-12 18:28:10 +01:00
parent 2a0e5779cb
commit ddeb82fdc8
10 changed files with 85 additions and 41 deletions

View File

@@ -80,6 +80,10 @@ static void state_tick(Presentation_State *state) {
game_session_update(session, delta_time);
{ // TEMP: SS
if(IsKeyPressed(KEY_TAB)) {
ctx->debug_render_match_state = !ctx->debug_render_match_state;
}
if(IsKeyPressed(KEY_ESCAPE)) {
presentation_state_machine_go_to(&presentation_state_main_menu);
}
@@ -196,7 +200,7 @@ static void state_render(Presentation_State *state) {
},
(Rectangle) { // Destination.
pres_x + origin.x,
pres_y + origin.y + ENTITY_PRESENTATION_Y_OFFSET - (sin(GetTime() * sin_frequency)) * sin_amplitude,
pres_y + origin.y + ENTITY_PRESENTATION_Y_OFFSET - (sin((GetTime() + (float)(entity->child_index) / 4.0) * sin_frequency)) * sin_amplitude,
GRID_CELL_SIZE,
GRID_CELL_SIZE
},
@@ -245,11 +249,11 @@ static void state_render(Presentation_State *state) {
// TODO: SS - Switch on 'sim_world->match_state'.
{ // TEMP: SS - Render match state.
if(ctx->debug_render_match_state) {
char buf[512];
snprintf(&buf[0], sizeof(buf), "Match-state: %i. Tick: %lu.", sim_world->match_state, sim_world->tick);
DrawText(buf, 32, 32, 12, RED);
DrawText(buf, 16, 16, 8, RED);
}
}
EndMode2D();