Draw the placeholder fruggball

This commit is contained in:
2026-05-07 11:16:48 +02:00
parent e11ac4b05c
commit 570bb84ff1

View File

@ -1,8 +1,25 @@
const std = @import("std"); const std = @import("std");
const rl = @import("raylib"); const rl = @import("raylib");
const Vec3 = rl.Vector3;
const Frug = struct { const Frug = struct {
pos: rl.Vec3, pos: Vec3,
radius: f32 = 24,
pub fn draw(self: @This()) void {
rl.drawCircle(
@intFromFloat(self.pos.x),
@intFromFloat(self.pos.y),
self.radius,
rl.Color.green,
);
}
pub fn init() Frug {
return Frug {
.pos = .{ .x = 200, .y = 400, .z = 10 },
.radius = 24,
};
}
}; };
@ -11,21 +28,23 @@ pub fn main(init: std.process.Init) anyerror!void {
try std.Io.File.stdout().writeStreamingAll(io, "FRUGG!\n"); try std.Io.File.stdout().writeStreamingAll(io, "FRUGG!\n");
const screenWidth = 800; const screenWidth = 800;
const screenHeight = 450; const screenHeight = 600;
rl.initWindow(screenWidth, screenHeight, "Zig Frugger"); rl.initWindow(screenWidth, screenHeight, "Zig Frugger");
defer rl.closeWindow(); defer rl.closeWindow();
rl.setTargetFPS(60); rl.setTargetFPS(60);
//-------------------------------------------------------------------------------------- const frug = Frug.init();
// Main game loop
while (!rl.windowShouldClose()) { while (!rl.windowShouldClose()) {
rl.beginDrawing(); rl.beginDrawing();
defer rl.endDrawing(); defer rl.endDrawing();
rl.clearBackground(.white); rl.clearBackground(.white);
rl.drawText("FRUGG!", 190, 200, 40, .green); frug.draw();
rl.drawText("FRUGG!", 100, 100, 40, .green);
} }
} }