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:
parent
4dbbea186e
commit
a378960088
9 changed files with 219 additions and 71 deletions
|
|
@ -28,7 +28,12 @@ pub fn main() anyerror!void {
|
|||
|
||||
spacing += @as(i32, @intFromFloat(buildings[i].width));
|
||||
|
||||
buildColors[i] = rl.Color.init(@as(u8, @intCast(rl.getRandomValue(200, 240))), @as(u8, @intCast(rl.getRandomValue(200, 240))), @as(u8, @intCast(rl.getRandomValue(200, 250))), 255);
|
||||
buildColors[i] = rl.Color.init(
|
||||
@as(u8, @intCast(rl.getRandomValue(200, 240))),
|
||||
@as(u8, @intCast(rl.getRandomValue(200, 240))),
|
||||
@as(u8, @intCast(rl.getRandomValue(200, 250))),
|
||||
255,
|
||||
);
|
||||
}
|
||||
|
||||
var camera = rl.Camera2D{
|
||||
|
|
@ -97,8 +102,20 @@ pub fn main() anyerror!void {
|
|||
|
||||
rl.drawRectangleRec(player, rl.Color.red);
|
||||
|
||||
rl.drawLine(@as(i32, @intFromFloat(camera.target.x)), -screenHeight * 10, @as(i32, @intFromFloat(camera.target.x)), screenHeight * 10, rl.Color.green);
|
||||
rl.drawLine(-screenWidth * 10, @as(i32, @intFromFloat(camera.target.y)), screenWidth * 10, @as(i32, @intFromFloat(camera.target.y)), rl.Color.green);
|
||||
rl.drawLine(
|
||||
@as(i32, @intFromFloat(camera.target.x)),
|
||||
-screenHeight * 10,
|
||||
@as(i32, @intFromFloat(camera.target.x)),
|
||||
screenHeight * 10,
|
||||
rl.Color.green,
|
||||
);
|
||||
rl.drawLine(
|
||||
-screenWidth * 10,
|
||||
@as(i32, @intFromFloat(camera.target.y)),
|
||||
screenWidth * 10,
|
||||
@as(i32, @intFromFloat(camera.target.y)),
|
||||
rl.Color.green,
|
||||
);
|
||||
}
|
||||
|
||||
rl.drawText("SCREEN AREA", 640, 10, 20, rl.Color.red);
|
||||
|
|
|
|||
|
|
@ -27,8 +27,17 @@ pub fn main() anyerror!void {
|
|||
|
||||
for (0..heights.len) |i| {
|
||||
heights[i] = @as(f32, @floatFromInt(rl.getRandomValue(1, 12)));
|
||||
positions[i] = rl.Vector3.init(@as(f32, @floatFromInt(rl.getRandomValue(-15, 15))), heights[i] / 2.0, @as(f32, @floatFromInt(rl.getRandomValue(-15, 15))));
|
||||
colors[i] = rl.Color.init(@as(u8, @intCast(rl.getRandomValue(20, 255))), @as(u8, @intCast(rl.getRandomValue(10, 55))), 30, 255);
|
||||
positions[i] = rl.Vector3.init(
|
||||
@as(f32, @floatFromInt(rl.getRandomValue(-15, 15))),
|
||||
heights[i] / 2.0,
|
||||
@as(f32, @floatFromInt(rl.getRandomValue(-15, 15))),
|
||||
);
|
||||
colors[i] = rl.Color.init(
|
||||
@as(u8, @intCast(rl.getRandomValue(20, 255))),
|
||||
@as(u8, @intCast(rl.getRandomValue(10, 55))),
|
||||
30,
|
||||
255,
|
||||
);
|
||||
}
|
||||
|
||||
rl.setTargetFPS(60); // Set our game to run at 60 frames-per-second
|
||||
|
|
|
|||
|
|
@ -36,7 +36,13 @@ pub fn main() anyerror!void {
|
|||
|
||||
rl.drawText("Use mouse wheel to move the cube up and down!", 10, 10, 20, rl.Color.gray);
|
||||
|
||||
rl.drawText(rl.textFormat("Box position Y: %03i", .{@as(i32, @intFromFloat(boxPositionY))}), 10, 40, 20, rl.Color.light_gray);
|
||||
rl.drawText(
|
||||
rl.textFormat("Box position Y: %03i", .{@as(i32, @intFromFloat(boxPositionY))}),
|
||||
10,
|
||||
40,
|
||||
20,
|
||||
rl.Color.light_gray,
|
||||
);
|
||||
//----------------------------------------------------------------------------------
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -69,7 +69,13 @@ pub fn main() anyerror!void {
|
|||
|
||||
// Draw circle and touch index number
|
||||
rl.drawCircleV(touchPosition, 34, rl.Color.orange);
|
||||
rl.drawText(rl.textFormat("%d", .{i}), @as(i32, @intFromFloat(touchPosition.x)) - 10, @as(i32, @intFromFloat(touchPosition.y)) - 70, 40, rl.Color.black);
|
||||
rl.drawText(
|
||||
rl.textFormat("%d", .{i}),
|
||||
@as(i32, @intFromFloat(touchPosition.x)) - 10,
|
||||
@as(i32, @intFromFloat(touchPosition.y)) - 70,
|
||||
40,
|
||||
rl.Color.black,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue