From 95bac6db00bc89ff3f628ab42736fffbc4e64ea7 Mon Sep 17 00:00:00 2001 From: Delyan Angelov Date: Mon, 12 May 2025 10:36:48 +0300 Subject: [PATCH] examples: show the number of pushes in sokoban too --- examples/sokoban/sokoban.v | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/examples/sokoban/sokoban.v b/examples/sokoban/sokoban.v index 2568d08e75..6320de6cec 100644 --- a/examples/sokoban/sokoban.v +++ b/examples/sokoban/sokoban.v @@ -29,6 +29,7 @@ mut: titles []string levels []string moves int + pushes int ctx &gg.Context = unsafe { nil } // id_box int @@ -129,6 +130,7 @@ fn (mut g Game) move_player(dir Direction) { } } g.boxes[target_box_index] = target_after + g.pushes++ } g.player = target g.moves++ @@ -232,8 +234,9 @@ fn (g &Game) draw_frame(_ voidptr) { } } g.ctx.draw_rect_filled(0, 0, ws.width, 40, gx.black) - g.ctx.draw_text(5, 0, 'Level: ${g.level + 1:02}', color: gx.green, size: 40) + g.ctx.draw_text(30, 0, 'Level: ${g.level + 1:02}', color: gx.green, size: 40) g.ctx.draw_text(ws.width - 225, 0, 'Moves: ${g.moves:04}', color: gx.green, size: 40) + g.ctx.draw_text(ws.width / 2 - 110, 0, 'Pushes: ${g.pushes:04}', color: gx.green, size: 40) g.ctx.end() }