this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

feat: display hex coords in axial

+9 -2
+9 -2
src/main.zig
··· 5 5 const screen_offset_x: f32 = 400.0; // center of 800px screen 6 6 const screen_offset_y: f32 = 225.0; // center of 450px screen 7 7 8 - fn draw_hex(hex: lib.hex.HexCell) void { 8 + fn draw_hex(hex: lib.hex.HexCell) !void { 9 9 var corners: [6]lib.hex.Point = undefined; 10 10 for (0..6) |i| { 11 11 const corner = lib.hex.calculate_hex_corners(hex.center, hex.outer_radius, i); ··· 23 23 24 24 rl.drawLine(start_x, start_y, end_x, end_y, .black); 25 25 } 26 + 27 + const center_x: i32 = @intFromFloat(@round(hex.center.x + screen_offset_x - 10)); 28 + const center_y: i32 = @intFromFloat(@round(hex.center.y + screen_offset_y - 6)); 29 + 30 + var buf: [64]u8 = undefined; 31 + const text = try std.fmt.bufPrintZ(&buf, "{d} {d}", .{ hex.cubic.q, hex.cubic.r }); 32 + rl.drawText(text, center_x, center_y, 12, .black); 26 33 } 27 34 28 35 pub fn main() !void { ··· 86 93 rl.clearBackground(.white); 87 94 88 95 for (grid.items) |cell| { 89 - draw_hex(cell); 96 + try draw_hex(cell); 90 97 } 91 98 } 92 99 }