So I was doing a visual programming language editor (at least started) and encountered a weird bug, for some reasons the compiler won't understand that a variable i use has a member function:
here the part of the main.zig:
const contextMenu = ContextMenu{};
...
try camera.setColor(Color.black);
try camera.clear();
try camera.setColor(BG_COLOR);
try camera.draw(.Line, bgRects);
try contextMenu.draw(&camera);
camera.present();
here the contextMenu.zig:
pub usingnamespace struct {
const ContextMenu = @This();
x: i32 = 0,
y: i32 = 0,
w: i32 = 0,
h: i32 = 0,
shown: bool = false,
pub fn draw(self: *const ContextMenu, camera: *const Camera) !void {
try camera.drawScreen(.Fill, .{
.x = self.x,
.y = self.y - self.h,
.w = self.w,
.h = self.h,
});
}
};
while my camera works well :/ help pwease ;(