diff options
author | Julien Dessaux | 2022-08-14 14:33:29 +0200 |
---|---|---|
committer | Julien Dessaux | 2022-08-14 14:33:29 +0200 |
commit | b951f4de71d47d17a22265b1ea336e67fedeba7a (patch) | |
tree | e224c99bf1311ee7ac6efcecbfbb366b581c844b /src/playfield.zig | |
parent | Added lib spoon submodule (diff) | |
download | grenade-brothers-b951f4de71d47d17a22265b1ea336e67fedeba7a.tar.gz grenade-brothers-b951f4de71d47d17a22265b1ea336e67fedeba7a.tar.bz2 grenade-brothers-b951f4de71d47d17a22265b1ea336e67fedeba7a.zip |
Wrote initial game objects
Diffstat (limited to '')
-rw-r--r-- | src/playfield.zig | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/src/playfield.zig b/src/playfield.zig new file mode 100644 index 0000000..3878323 --- /dev/null +++ b/src/playfield.zig @@ -0,0 +1,38 @@ +const std = @import("std"); +const spoon = @import("spoon"); + +pub fn draw(rc: *spoon.Term.RenderContext) !void { + var iter = std.mem.split(u8, field, "\n"); + var y: usize = 0; + while (iter.next()) |line| : (y += 1) { + try rc.moveCursorTo(y, 0); + _ = try rc.buffer.writer().write(line); + } +} + +const field = + \\████████████████████████████████████████████████████████████████████████████████ + \\█ ██ █ + \\████████████████████████████████████████████████████████████████████████████████ + \\█ █ + \\█ █ + \\█ █ + \\█ █ + \\█ █ + \\█ █ + \\█ █ + \\█ █ + \\█ █ + \\█ █ + \\█ ██ █ + \\█ ██ █ + \\█ ██ █ + \\█ ██ █ + \\█ ██ █ + \\█ ██ █ + \\█ ██ █ + \\█ ██ █ + \\█ ██ █ + \\█ ██ █ + \\████████████████████████████████████████████████████████████████████████████████ +; |