aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulien Dessaux2022-09-26 21:02:13 +0200
committerJulien Dessaux2022-09-26 21:02:13 +0200
commitd6a8aead1d7c4524324eed38928f78f52560707b (patch)
tree1ef962bd5f832271823debd42d4780cce688d3a7
parentCommitted forgotten file necessary for gamepad inputs (diff)
downloadgrenade-brothers-d6a8aead1d7c4524324eed38928f78f52560707b.tar.gz
grenade-brothers-d6a8aead1d7c4524324eed38928f78f52560707b.tar.bz2
grenade-brothers-d6a8aead1d7c4524324eed38928f78f52560707b.zip
Display scores
-rw-r--r--src/brothers.zig8
1 files changed, 8 insertions, 0 deletions
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;