feat: initial commit
This commit is contained in:
27
src/main.zig
Normal file
27
src/main.zig
Normal file
@@ -0,0 +1,27 @@
|
||||
const std = @import("std");
|
||||
const rl = @import("raylib");
|
||||
|
||||
pub fn main() anyerror!void {
|
||||
const alloc = std.heap.page_allocator;
|
||||
|
||||
const screenWidth = 800;
|
||||
const screenHeight = 450;
|
||||
|
||||
rl.initWindow(screenWidth, screenHeight, "Snake");
|
||||
defer rl.closeWindow();
|
||||
|
||||
rl.setTargetFPS(100);
|
||||
|
||||
while (!rl.windowShouldClose()) {
|
||||
rl.beginDrawing();
|
||||
defer rl.endDrawing();
|
||||
|
||||
rl.clearBackground(.white);
|
||||
|
||||
const info = try std.fmt.allocPrintZ(alloc, "FPS: {}\n", .{rl.getFPS()});
|
||||
|
||||
rl.drawText("Congrats! You created your first window!", 190, 200, 20, .light_gray);
|
||||
rl.drawText(info, 0, 0, 20, .light_gray);
|
||||
rl.drawRectangle(10, 10, 10, 10, .black);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user