aboutsummaryrefslogtreecommitdiff
path: root/src/game.zig
blob: fc6400126a1d240cbbf0b91776d75597030c037f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
const std = @import("std");
const spoon = @import("spoon");

const brothers = @import("brothers.zig");
const playfield = @import("playfield.zig");

pub const Game = struct {
    brothers: [2]brothers.Brother = undefined,
    character: ?brothers.Side = undefined,
    pub fn draw(self: Game, rc: *spoon.Term.RenderContext) !void {
        try playfield.draw(rc);
        try self.brothers[0].draw(rc);
        try self.brothers[1].draw(rc);
    }
    pub fn reset(self: *Game) void {
        self.resetRound();
    }
    pub fn resetRound(self: *Game) void {
        self.brothers[0].reset(brothers.Side.left);
        self.brothers[1].reset(brothers.Side.right);
    }
};