From d6a8aead1d7c4524324eed38928f78f52560707b Mon Sep 17 00:00:00 2001 From: Julien Dessaux Date: Mon, 26 Sep 2022 21:02:13 +0200 Subject: Display scores --- src/brothers.zig | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/brothers.zig b/src/brothers.zig index e68cb0f..f13b5ce 100644 --- a/src/brothers.zig +++ b/src/brothers.zig @@ -34,6 +34,14 @@ pub const Brother = struct { var y = @floatToInt(u8, std.math.round(self.y)); w4.DRAW_COLORS.* = 0x30; w4.blit(&brother, self.x, y - brother_height, brother_width, brother_height, brother_flags); + var buf: [3]u8 = undefined; + w4.DRAW_COLORS.* = 0x32; + _ = std.fmt.formatIntBuf(&buf, self.score, 10, .lower, .{ .width = 3 }); + if (self.side == .left) { + w4.text(buf[0..], 0, 0); + } else { + w4.text(buf[0..], 136, 0); + } } pub fn reset(self: *Brother, side: utils.side) void { self.side = side; -- cgit v1.2.3