mirror of
https://github.com/Not-Nik/raylib-zig.git
synced 2025-09-09 20:17:28 +00:00
Update example casts
This commit is contained in:
parent
9e908b3925
commit
d07552a064
@ -93,8 +93,8 @@ pub fn main() anyerror!void {
|
|||||||
|
|
||||||
rl.drawRectangleRec(player, rl.Color.red);
|
rl.drawRectangleRec(player, rl.Color.red);
|
||||||
|
|
||||||
rl.drawLine(@floatToInt(c_int, camera.target.x), -screenHeight * 10, @floatToInt(c_int, camera.target.x), screenHeight * 10, rl.Color.green);
|
rl.drawLine(@floatToInt(i32, camera.target.x), -screenHeight * 10, @floatToInt(i32, camera.target.x), screenHeight * 10, rl.Color.green);
|
||||||
rl.drawLine(-screenWidth * 10, @floatToInt(c_int, camera.target.y), screenWidth * 10, @floatToInt(c_int, camera.target.y), rl.Color.green);
|
rl.drawLine(-screenWidth * 10, @floatToInt(i32, camera.target.y), screenWidth * 10, @floatToInt(i32, camera.target.y), rl.Color.green);
|
||||||
|
|
||||||
camera.end();
|
camera.end();
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@ pub fn main() anyerror!void {
|
|||||||
|
|
||||||
rl.clearBackground(rl.Color.ray_white);
|
rl.clearBackground(rl.Color.ray_white);
|
||||||
|
|
||||||
rl.drawCircle(@floatToInt(c_int, ballPosition.x), @floatToInt(c_int, ballPosition.y), 50, ballColor);
|
rl.drawCircle(@floatToInt(i32, ballPosition.x), @floatToInt(i32, ballPosition.y), 50, ballColor);
|
||||||
//DrawCircleV(ballPosition, 40, ballColor);
|
//DrawCircleV(ballPosition, 40, ballColor);
|
||||||
|
|
||||||
rl.drawText("move ball with mouse and click mouse button to change color", 10, 10, 20, rl.Color.dark_gray);
|
rl.drawText("move ball with mouse and click mouse button to change color", 10, 10, 20, rl.Color.dark_gray);
|
||||||
|
@ -29,7 +29,7 @@ pub fn main() anyerror!void {
|
|||||||
|
|
||||||
rl.clearBackground(rl.Color.white);
|
rl.clearBackground(rl.Color.white);
|
||||||
|
|
||||||
rl.drawRectangle(screenWidth / 2 - 40, @floatToInt(c_int, boxPositionY), 80, 80, rl.Color.maroon);
|
rl.drawRectangle(screenWidth / 2 - 40, @floatToInt(i32, boxPositionY), 80, 80, rl.Color.maroon);
|
||||||
|
|
||||||
rl.drawText("Use mouse wheel to move the cube up and down!", 10, 10, 20, rl.Color.gray);
|
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", .{@floatToInt(c_int, boxPositionY)}), 10, 40, 20, rl.Color.light_gray);
|
//rl.drawText(rl.textFormat("Box position Y: %03i", .{@floatToInt(c_int, boxPositionY)}), 10, 40, 20, rl.Color.light_gray);
|
||||||
|
@ -19,7 +19,7 @@ pub fn main() anyerror!void {
|
|||||||
const scarfy: rl.Texture = rl.Texture.init("resources/textures/scarfy.png"); // Texture loading
|
const scarfy: rl.Texture = rl.Texture.init("resources/textures/scarfy.png"); // Texture loading
|
||||||
|
|
||||||
const position = rl.Vector2.init(350.0, 280.0);
|
const position = rl.Vector2.init(350.0, 280.0);
|
||||||
var frameRec = rl.Rectangle{ .x = 0.0, .y = 0.0, .width = @intToFloat(f32, @divFloor(scarfy.width, 6)), .height = @intToFloat(f32, scarfy.height) };
|
var frameRec = rl.Rectangle.init(0, 0, @intToFloat(f32, @divFloor(scarfy.width, 6)), @intToFloat(f32, scarfy.height));
|
||||||
var currentFrame: u8 = 0;
|
var currentFrame: u8 = 0;
|
||||||
|
|
||||||
var framesCounter: u8 = 0;
|
var framesCounter: u8 = 0;
|
||||||
@ -74,9 +74,9 @@ pub fn main() anyerror!void {
|
|||||||
|
|
||||||
for ([_]u32{0} ** MAX_FRAME_SPEED) |_, i| {
|
for ([_]u32{0} ** MAX_FRAME_SPEED) |_, i| {
|
||||||
if (i < framesSpeed) {
|
if (i < framesSpeed) {
|
||||||
rl.drawRectangle(250 + 21 * @intCast(c_int, i), 205, 20, 20, rl.Color.red);
|
rl.drawRectangle(250 + 21 * @intCast(i32, i), 205, 20, 20, rl.Color.red);
|
||||||
}
|
}
|
||||||
rl.drawRectangleLines(250 + 21 * @intCast(c_int, i), 205, 20, 20, rl.Color.maroon);
|
rl.drawRectangleLines(250 + 21 * @intCast(i32, i), 205, 20, 20, rl.Color.maroon);
|
||||||
}
|
}
|
||||||
|
|
||||||
scarfy.drawRec(frameRec, position, rl.Color.white); // Draw part of the texture
|
scarfy.drawRec(frameRec, position, rl.Color.white); // Draw part of the texture
|
||||||
|
Loading…
x
Reference in New Issue
Block a user