feat: implement resetting

This commit is contained in:
2023-03-10 02:27:31 -06:00
parent bd872ee1c0
commit f8477714ae
7 changed files with 51 additions and 9 deletions

View File

@@ -251,7 +251,7 @@ pub const FrameBuffer = struct {
layers: [2][]u8,
buf: []u8,
current: u1,
current: u1 = 0,
allocator: Allocator,
@@ -266,12 +266,16 @@ pub const FrameBuffer = struct {
// Front and Back Framebuffers
.layers = [_][]u8{ buf[0..][0..len], buf[len..][0..len] },
.buf = buf,
.current = 0,
.allocator = allocator,
};
}
pub fn reset(self: *Self) void {
std.mem.set(u8, self.buf, 0);
self.current = 0;
}
pub fn deinit(self: *Self) void {
self.allocator.free(self.buf);
self.* = undefined;