aboutsummaryrefslogtreecommitdiff
path: root/src/game.zig
diff options
context:
space:
mode:
authorJulien Dessaux2022-08-14 14:33:29 +0200
committerJulien Dessaux2022-08-14 14:33:29 +0200
commitb951f4de71d47d17a22265b1ea336e67fedeba7a (patch)
treee224c99bf1311ee7ac6efcecbfbb366b581c844b /src/game.zig
parentAdded lib spoon submodule (diff)
downloadgrenade-brothers-b951f4de71d47d17a22265b1ea336e67fedeba7a.tar.gz
grenade-brothers-b951f4de71d47d17a22265b1ea336e67fedeba7a.tar.bz2
grenade-brothers-b951f4de71d47d17a22265b1ea336e67fedeba7a.zip
Wrote initial game objects
Diffstat (limited to '')
-rw-r--r--src/game.zig22
1 files changed, 22 insertions, 0 deletions
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);
+ }
+};