diff --git a/build.zig b/build.zig index 59af6a6..132a3d8 100644 --- a/build.zig +++ b/build.zig @@ -11,7 +11,7 @@ pub fn build(b: *Builder) void { // between Debug, ReleaseSafe, ReleaseFast, and ReleaseSmall. const mode = b.standardReleaseOptions(); - const exe = b.addExecutable("zigraylib", "src/main.zig"); + const exe = b.addExecutable("kble", "src/main.zig"); exe.setTarget(target); exe.setBuildMode(mode); exe.install(); diff --git a/src/level.zig b/src/level.zig index 6d96326..f536a67 100644 --- a/src/level.zig +++ b/src/level.zig @@ -10,6 +10,8 @@ width: u16, height: u16, buffer: []cell_t, +/// Create structure and allocate required memory. The `buffer` array size will +/// be equal to `width` times `height`. pub fn init(allocator: *std.mem.Allocator, width: u16, height: u16) !Self { var level = Self{ .width = width, @@ -20,6 +22,7 @@ pub fn init(allocator: *std.mem.Allocator, width: u16, height: u16) !Self { return level; } +/// Free the level buffer. pub fn deinit(self: *Self, allocator: *std.mem.Allocator) void { allocator.free(self.buffer); } diff --git a/src/vec2.zig b/src/vec2.zig index 088edf0..27e4788 100644 --- a/src/vec2.zig +++ b/src/vec2.zig @@ -7,6 +7,7 @@ const Self = @This(); x: i32, y: i32, +/// Create a vector with `x` and `y` values. pub fn init(x: i32, y: i32) Self { return Self { .x = x, @@ -14,6 +15,7 @@ pub fn init(x: i32, y: i32) Self { }; } +/// Return the sum of `self` and `other`. pub fn add(self: Self, other: Self) Self { return Self { .x = self.x + other.x, @@ -21,6 +23,7 @@ pub fn add(self: Self, other: Self) Self { }; } +/// Return the difference between `self` and `other`. pub fn sub(self: Self, other: Self) Self { return Self { .x = self.x - other.x,