Initial commit
This commit is contained in:
21
src/infrastructure/node.zig
Normal file
21
src/infrastructure/node.zig
Normal file
@@ -0,0 +1,21 @@
|
||||
const rl = @import("raylib");
|
||||
|
||||
const c = @import("../constants.zig");
|
||||
|
||||
pub const Node = struct {
|
||||
id: usize,
|
||||
pos: rl.Vector2,
|
||||
|
||||
pub fn init(new_id: usize, new_pos: rl.Vector2) Node {
|
||||
return .{
|
||||
.id = new_id,
|
||||
.pos = new_pos,
|
||||
};
|
||||
}
|
||||
|
||||
pub fn draw(self: *const Node, direct_colour: ?rl.Color) void {
|
||||
const colour = if (direct_colour) |clr| clr else c.NODE_COLOUR;
|
||||
|
||||
rl.drawCircleV(self.pos, c.NODE_RADIUS, colour);
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user