From b951f4de71d47d17a22265b1ea336e67fedeba7a Mon Sep 17 00:00:00 2001 From: Julien Dessaux Date: Sun, 14 Aug 2022 14:33:29 +0200 Subject: Wrote initial game objects --- src/game.zig | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 src/game.zig (limited to 'src/game.zig') diff --git a/src/game.zig b/src/game.zig new file mode 100644 index 0000000..fc64001 --- /dev/null +++ b/src/game.zig @@ -0,0 +1,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); + } +}; -- cgit v1.2.3