make frugburp LOL

This commit is contained in:
2026-05-07 17:53:08 +02:00
parent f0afbd813f
commit 8cf52dafd1
2 changed files with 15 additions and 8 deletions

BIN
resources/burp.mp3 Normal file

Binary file not shown.

View File

@ -2,27 +2,26 @@ const std = @import("std");
const rl = @import("raylib");
const Vec3 = rl.Vector3;
const Vec2 = rl.Vector2;
const Frug = struct {
pos: Vec3,
radius: f32 = 24,
pub fn draw(self: @This()) void {
rl.drawCircle(
@intFromFloat(self.pos.x),
@intFromFloat(self.pos.y),
rl.drawCircleV(
Vec2.init(self.pos.x, self.pos.y),
self.radius,
.green,
);
}
pub fn init() Frug {
return Frug {
return Frug{
.pos = .{ .x = 200, .y = 400, .z = 10 },
.radius = 24,
};
}
};
pub fn main(init: std.process.Init) anyerror!void {
const io = init.io;
try std.Io.File.stdout().writeStreamingAll(io, "FRUGG!\n");
@ -33,6 +32,12 @@ pub fn main(init: std.process.Init) anyerror!void {
rl.initWindow(screenWidth, screenHeight, "Zig Frugger");
defer rl.closeWindow();
rl.initAudioDevice();
defer rl.closeAudioDevice();
const frugBurp = try rl.loadSound("resources/burp.mp3");
defer rl.unloadSound(frugBurp);
rl.setTargetFPS(60);
const frug = Frug.init();
@ -41,7 +46,9 @@ pub fn main(init: std.process.Init) anyerror!void {
rl.beginDrawing();
defer rl.endDrawing();
rl.clearBackground(.white);
if (rl.isKeyPressed(.space)) rl.playSound(frugBurp);
rl.clearBackground(.sky_blue);
frug.draw();