diff options
Diffstat (limited to 'src/context.zig')
| -rw-r--r-- | src/context.zig | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/context.zig b/src/context.zig index f3e88f2..0bffbd4 100644 --- a/src/context.zig +++ b/src/context.zig @@ -1,6 +1,7 @@ const std = @import("std"); const rl = @cImport(@cInclude("raylib.h")); const root = @import("root.zig"); +const Animation = @import("Animation.zig"); pub var camera: rl.Camera2D = undefined; pub var grid: []root.MyRect = undefined; @@ -9,7 +10,6 @@ pub const Grid = struct { buffer: std.MultiArrayList(root.Hex), cursor: usize, size: usize, - const Self = @This(); const GridError = error{ OutOfBounds, @@ -30,14 +30,14 @@ pub const Grid = struct { } // should only be used when standing up the buffer, afterwards should use q, r indexing - pub fn initPush(self: *Self, hex: root.Hex) GridError!void { + pub fn initPush(self: *Grid, hex: root.Hex) GridError!void { if (self.cursor >= self.size * 2) { return GridError.OutOfBounds; } self.buffer.insertAssumeCapacity(self.cursor, hex); } - pub fn set(self: *Self, hex: root.Hex) GridError!void { + pub fn set(self: *Grid, hex: root.Hex) GridError!void { const idx = hex.qr[1] * self.size + hex.qr[0]; if (idx >= self.size * 2) { return GridError.OutOfBounds; @@ -50,5 +50,13 @@ pub var hex_grid: Grid = undefined; pub var hovered_coords: root.HexCoord = root.HexCoord{ .q = 0, .r = 0 }; pub var hovered_handle: ?usize = null; +pub const Dude = struct { + world_coords: rl.Vector2, + hex_coords: root.HexCoord, + target_coords: root.HexCoord, + animation: Animation, +}; +pub var main_dude: Dude = undefined; + var Gpa = std.heap.GeneralPurposeAllocator(.{}){}; pub var gpa: std.mem.Allocator = Gpa.allocator(); |
