Clean up build.zig and examples

This commit affects the build.zig and examples files. It reformats the
code to meet a 120 column limit. It also adjusts comments so that
there is a space after the comment symbol '//' and the grammar in the
comments has been fixed.
This commit is contained in:
vent 2023-09-11 16:04:32 +01:00
parent 4dbbea186e
commit a378960088
9 changed files with 219 additions and 71 deletions

View file

@ -21,7 +21,12 @@ pub fn main() anyerror!void {
defer rl.unloadTexture(scarfy); // Texture unloading
const position = rl.Vector2.init(350.0, 280.0);
var frameRec = rl.Rectangle.init(0, 0, @as(f32, @floatFromInt(@divFloor(scarfy.width, 6))), @as(f32, @floatFromInt(scarfy.height)));
var frameRec = rl.Rectangle.init(
0,
0,
@as(f32, @floatFromInt(@divFloor(scarfy.width, 6))),
@as(f32, @floatFromInt(scarfy.height)),
);
var currentFrame: u8 = 0;
var framesCounter: u8 = 0;
@ -69,7 +74,13 @@ pub fn main() anyerror!void {
rl.drawTexture(scarfy, 15, 40, rl.Color.white);
rl.drawRectangleLines(15, 40, scarfy.width, scarfy.height, rl.Color.lime);
rl.drawRectangleLines(15 + @as(i32, @intFromFloat(frameRec.x)), 40 + @as(i32, @intFromFloat(frameRec.y)), @as(i32, @intFromFloat(frameRec.width)), @as(i32, @intFromFloat(frameRec.height)), rl.Color.red);
rl.drawRectangleLines(
15 + @as(i32, @intFromFloat(frameRec.x)),
40 + @as(i32, @intFromFloat(frameRec.y)),
@as(i32, @intFromFloat(frameRec.width)),
@as(i32, @intFromFloat(frameRec.height)),
rl.Color.red,
);
rl.drawText("FRAME SPEED: ", 165, 210, 10, rl.Color.dark_gray);
rl.drawText(rl.textFormat("%02i FPS", .{framesSpeed}), 575, 210, 10, rl.Color.dark_gray);
@ -84,7 +95,13 @@ pub fn main() anyerror!void {
scarfy.drawRec(frameRec, position, rl.Color.white); // Draw part of the texture
rl.drawText("(c) Scarfy sprite by Eiden Marsal", screenWidth - 200, screenHeight - 20, 10, rl.Color.gray);
rl.drawText(
"(c) Scarfy sprite by Eiden Marsal",
screenWidth - 200,
screenHeight - 20,
10,
rl.Color.gray,
);
//----------------------------------------------------------------------------------
}
}