examples: Use decl literals (#221)

This commit is contained in:
Mike Will 2025-03-12 16:21:15 -04:00 committed by GitHub
parent 03ec79ef85
commit d4fc514d54
Failed to generate hash of commit
37 changed files with 323 additions and 323 deletions

View file

@ -26,33 +26,33 @@ pub fn main() anyerror!void {
rl.beginDrawing();
defer rl.endDrawing();
rl.clearBackground(rl.Color.ray_white);
rl.clearBackground(.ray_white);
rl.drawText("some basic shapes available on raylib", 20, 20, 20, rl.Color.dark_gray);
rl.drawText("some basic shapes available on raylib", 20, 20, 20, .dark_gray);
// Circle shapes and lines
rl.drawCircle(screenWidth / 5, 120, 35, rl.Color.dark_blue);
rl.drawCircleGradient(screenWidth / 5, 220, 60, rl.Color.green, rl.Color.sky_blue);
rl.drawCircleLines(screenWidth / 5, 340, 80, rl.Color.dark_blue);
rl.drawCircle(screenWidth / 5, 120, 35, .dark_blue);
rl.drawCircleGradient(screenWidth / 5, 220, 60, .green, .sky_blue);
rl.drawCircleLines(screenWidth / 5, 340, 80, .dark_blue);
// Rectangle shapes and lines
rl.drawRectangle(screenWidth / 4 * 2 - 60, 100, 120, 60, rl.Color.red);
rl.drawRectangleGradientH(screenWidth / 4 * 2 - 90, 170, 180, 130, rl.Color.maroon, rl.Color.gold);
rl.drawRectangleLines(screenWidth / 4 * 2 - 40, 320, 80, 60, rl.Color.orange); // NOTE: Uses QUADS internally, not lines
rl.drawRectangle(screenWidth / 4 * 2 - 60, 100, 120, 60, .red);
rl.drawRectangleGradientH(screenWidth / 4 * 2 - 90, 170, 180, 130, .maroon, .gold);
rl.drawRectangleLines(screenWidth / 4 * 2 - 40, 320, 80, 60, .orange); // NOTE: Uses QUADS internally, not lines
// Triangle shapes and lines
rl.drawTriangle((rl.Vector2){ .x = (screenWidth / 4.0 * 3.0), .y = 80.0 }, (rl.Vector2){ .x = (screenWidth / 4.0 * 3.0 - 60.0), .y = 150.0 }, (rl.Vector2){ .x = (screenWidth / 4.0 * 3.0 + 60.0), .y = 150.0 }, rl.Color.violet);
rl.drawTriangle(.{ .x = (screenWidth / 4.0 * 3.0), .y = 80.0 }, .{ .x = (screenWidth / 4.0 * 3.0 - 60.0), .y = 150.0 }, .{ .x = (screenWidth / 4.0 * 3.0 + 60.0), .y = 150.0 }, .violet);
rl.drawTriangleLines((rl.Vector2){ .x = (screenWidth / 4.0 * 3.0), .y = 160.0 }, (rl.Vector2){ .x = (screenWidth / 4.0 * 3.0 - 20.0), .y = 230.0 }, (rl.Vector2){ .x = (screenWidth / 4.0 * 3.0 + 20.0), .y = 230.0 }, rl.Color.dark_blue);
rl.drawTriangleLines(.{ .x = (screenWidth / 4.0 * 3.0), .y = 160.0 }, .{ .x = (screenWidth / 4.0 * 3.0 - 20.0), .y = 230.0 }, .{ .x = (screenWidth / 4.0 * 3.0 + 20.0), .y = 230.0 }, .dark_blue);
// Polygon shapes and lines
rl.drawPoly((rl.Vector2){ .x = (screenWidth / 4.0 * 3), .y = 330 }, 6, 80, rotation, rl.Color.brown);
rl.drawPolyLines((rl.Vector2){ .x = (screenWidth / 4.0 * 3), .y = 330 }, 6, 90, rotation, rl.Color.brown);
rl.drawPolyLinesEx((rl.Vector2){ .x = (screenWidth / 4.0 * 3), .y = 330 }, 6, 85, rotation, 6, rl.Color.beige);
rl.drawPoly(.{ .x = (screenWidth / 4.0 * 3), .y = 330 }, 6, 80, rotation, .brown);
rl.drawPolyLines(.{ .x = (screenWidth / 4.0 * 3), .y = 330 }, 6, 90, rotation, .brown);
rl.drawPolyLinesEx(.{ .x = (screenWidth / 4.0 * 3), .y = 330 }, 6, 85, rotation, 6, .beige);
// NOTE: We draw all LINES based shapes together to optimize internal drawing,
// this way, all LINES are rendered in a single draw pass
rl.drawLine(18, 42, screenWidth - 18, 42, rl.Color.black);
rl.drawLine(18, 42, screenWidth - 18, 42, .black);
//----------------------------------------------------------------------------------
}
}

View file

@ -53,14 +53,14 @@ pub fn main() anyerror!void {
rl.beginDrawing();
defer rl.endDrawing();
rl.clearBackground(rl.Color.ray_white);
rl.clearBackground(.ray_white);
rl.drawCircleV(ballPosition, ballRadius, rl.Color.maroon);
rl.drawText("PRESS SPACE to PAUSE BALL MOVEMENT", 10, rl.getScreenHeight() - 25, 20, rl.Color.light_gray);
rl.drawCircleV(ballPosition, ballRadius, .maroon);
rl.drawText("PRESS SPACE to PAUSE BALL MOVEMENT", 10, rl.getScreenHeight() - 25, 20, .light_gray);
// On pause, we draw a blinking message
if (pause and @mod(@divFloor(framesCounter, 30), 2) == 0) {
rl.drawText("PAUSED", 350, 200, 30, rl.Color.gray);
rl.drawText("PAUSED", 350, 200, 30, .gray);
}
rl.drawFPS(10, 10);

View file

@ -1,8 +1,8 @@
const rl = @import("raylib");
fn boxFmt(colliding: bool) rl.Color {
if (colliding) return rl.Color.red;
return rl.Color.black;
if (colliding) return .red;
return .black;
}
pub fn main() anyerror!void {
@ -83,12 +83,12 @@ pub fn main() anyerror!void {
rl.drawRectangle(0, 0, screenWidth, screenUpperLimit, boxFmt(collision));
rl.drawRectangleRec(boxA, rl.Color.gold);
rl.drawRectangleRec(boxB, rl.Color.blue);
rl.drawRectangleRec(boxA, .gold);
rl.drawRectangleRec(boxB, .blue);
if (collision) {
// Draw collision area
rl.drawRectangleRec(boxCollision, rl.Color.lime);
rl.drawRectangleRec(boxCollision, .lime);
// Draw collision message
rl.drawText(
@ -96,19 +96,19 @@ pub fn main() anyerror!void {
@divFloor(rl.getScreenWidth(), @as(i32, 2)) - @divFloor(rl.measureText("COLLISION!", 20), @as(i32, 2)),
screenUpperLimit / 2 - 10,
20,
rl.Color.black,
.black,
);
// Draw collision area
rl.drawText(rl.textFormat("Collision Area: %i", .{@as(i32, @intFromFloat(boxCollision.width * boxCollision.height))}), @divFloor(rl.getScreenWidth(), 2) - 100, screenUpperLimit + 10, 20, rl.Color.black);
rl.drawText(rl.textFormat("Collision Area: %i", .{@as(i32, @intFromFloat(boxCollision.width * boxCollision.height))}), @divFloor(rl.getScreenWidth(), 2) - 100, screenUpperLimit + 10, 20, .black);
}
// Draw help instructions
rl.drawText("Press SPACE to PAUSE/RESUME", 20, screenHeight - 35, 20, rl.Color.light_gray);
rl.drawText("Press SPACE to PAUSE/RESUME", 20, screenHeight - 35, 20, .light_gray);
rl.drawFPS(10, 10);
rl.clearBackground(rl.Color.ray_white);
rl.clearBackground(.ray_white);
//----------------------------------------------------------------------------------
}
}

View file

@ -20,27 +20,27 @@ pub fn main() anyerror!void {
defer rl.closeWindow(); // Close window and OpenGL context
const colors = [maxColorCount]rl.Color{
rl.Color.dark_gray,
rl.Color.maroon,
rl.Color.orange,
rl.Color.dark_green,
rl.Color.dark_blue,
rl.Color.dark_purple,
rl.Color.dark_brown,
rl.Color.gray,
rl.Color.red,
rl.Color.gold,
rl.Color.lime,
rl.Color.blue,
rl.Color.violet,
rl.Color.brown,
rl.Color.light_gray,
rl.Color.pink,
rl.Color.yellow,
rl.Color.green,
rl.Color.sky_blue,
rl.Color.purple,
rl.Color.beige,
.dark_gray,
.maroon,
.orange,
.dark_green,
.dark_blue,
.dark_purple,
.dark_brown,
.gray,
.red,
.gold,
.lime,
.blue,
.violet,
.brown,
.light_gray,
.pink,
.yellow,
.green,
.sky_blue,
.purple,
.beige,
};
const colorNames = [maxColorCount][:0]const u8{
@ -105,18 +105,18 @@ pub fn main() anyerror!void {
rl.beginDrawing();
defer rl.endDrawing();
rl.clearBackground(rl.Color.ray_white);
rl.clearBackground(.ray_white);
rl.drawText("raylib colors palette", 28, 42, 20, rl.Color.black);
rl.drawText("press SPACE to see all colors", rl.getScreenWidth() - 180, rl.getScreenHeight() - 40, 10, rl.Color.gray);
rl.drawText("raylib colors palette", 28, 42, 20, .black);
rl.drawText("press SPACE to see all colors", rl.getScreenWidth() - 180, rl.getScreenHeight() - 40, 10, .gray);
i = 0;
while (i < maxColorCount) : (i += 1) {
rl.drawRectangleRec(colorsRecs[i], rl.fade(colors[i], getAlpha(colorState[i])));
rl.drawRectangleRec(colorsRecs[i], .fade(colors[i], getAlpha(colorState[i])));
if (rl.isKeyDown(.space) or colorState[i]) {
rl.drawRectangle(@intFromFloat(colorsRecs[i].x), @as(i32, @intFromFloat(colorsRecs[i].y)) + @as(i32, @intFromFloat(colorsRecs[i].height)) - 26, @as(i32, @intFromFloat(colorsRecs[i].width)), 20, rl.Color.black);
rl.drawRectangleLinesEx(colorsRecs[i], 6, rl.fade(rl.Color.black, 0.3));
rl.drawRectangle(@intFromFloat(colorsRecs[i].x), @as(i32, @intFromFloat(colorsRecs[i].y)) + @as(i32, @intFromFloat(colorsRecs[i].height)) - 26, @as(i32, @intFromFloat(colorsRecs[i].width)), 20, .black);
rl.drawRectangleLinesEx(colorsRecs[i], 6, .fade(.black, 0.3));
rl.drawText(colorNames[i], @as(i32, @intFromFloat(colorsRecs[i].x)) + @as(i32, @intFromFloat(colorsRecs[i].width)) - rl.measureText(colorNames[i], 10) - 12, @as(i32, @intFromFloat(colorsRecs[i].y)) + @as(i32, @intFromFloat(colorsRecs[i].height)) - 20, 10, colors[i]);
}

View file

@ -9,8 +9,8 @@ fn labelFmt(segments: f32, minSegments: f32) [*c]const u8 {
}
fn colorFmt(segments: f32, minSegments: f32) rl.Color {
if (segments >= minSegments) return rl.Color.maroon;
return rl.Color.dark_gray;
if (segments >= minSegments) return .maroon;
return .dark_gray;
}
pub fn main() anyerror!void {
@ -45,13 +45,13 @@ pub fn main() anyerror!void {
rl.beginDrawing();
defer rl.endDrawing();
rl.clearBackground(rl.Color.ray_white);
rl.clearBackground(.ray_white);
rl.drawLine(500, 0, 500, rl.getScreenHeight(), rl.fade(rl.Color.light_gray, 0.6));
rl.drawRectangle(500, 0, rl.getScreenWidth() - 500, rl.getScreenHeight(), rl.fade(rl.Color.light_gray, 0.3));
rl.drawLine(500, 0, 500, rl.getScreenHeight(), .fade(.light_gray, 0.6));
rl.drawRectangle(500, 0, rl.getScreenWidth() - 500, rl.getScreenHeight(), .fade(.light_gray, 0.3));
rl.drawCircleSector(center, outerRadius, startAngle, endAngle, @as(i32, @intFromFloat(segments)), rl.fade(rl.Color.maroon, 0.3));
rl.drawCircleSectorLines(center, outerRadius, startAngle, endAngle, @as(i32, @intFromFloat(segments)), rl.fade(rl.Color.maroon, 0.6));
rl.drawCircleSector(center, outerRadius, startAngle, endAngle, @as(i32, @intFromFloat(segments)), .fade(.maroon, 0.3));
rl.drawCircleSectorLines(center, outerRadius, startAngle, endAngle, @as(i32, @intFromFloat(segments)), .fade(.maroon, 0.6));
// Draw GUI controls
_ = rgui.guiSliderBar(rl.Rectangle{ .x = 600, .y = 40, .width = 120, .height = 20 }, "StartAngle", rl.textFormat("%.2", .{startAngle}), &startAngle, 0, 720);

View file

@ -7,8 +7,8 @@ fn labelFmt(segments: f32) [*c]const u8 {
}
fn colorFmt(segments: f32) rl.Color {
if (segments >= 4) return rl.Color.maroon;
return rl.Color.dark_gray;
if (segments >= 4) return .maroon;
return .dark_gray;
}
pub fn main() anyerror!void {
@ -45,14 +45,14 @@ pub fn main() anyerror!void {
rl.beginDrawing();
defer rl.endDrawing();
rl.clearBackground(rl.Color.ray_white);
rl.clearBackground(.ray_white);
rl.drawLine(560, 0, 560, rl.getScreenHeight(), rl.fade(rl.Color.light_gray, 0.6));
rl.drawRectangle(560, 0, rl.getScreenWidth() - 500, rl.getScreenHeight(), rl.fade(rl.Color.light_gray, 0.3));
rl.drawLine(560, 0, 560, rl.getScreenHeight(), .fade(.light_gray, 0.6));
rl.drawRectangle(560, 0, rl.getScreenWidth() - 500, rl.getScreenHeight(), .fade(.light_gray, 0.3));
if (drawRect) rl.drawRectangleRec(rec, rl.fade(rl.Color.gold, 0.6));
if (drawRoundedRect) rl.drawRectangleRounded(rec, roundness, @as(i32, @intFromFloat(segments)), rl.fade(rl.Color.maroon, 0.2));
if (drawRoundedLines) rl.drawRectangleRoundedLinesEx(rec, roundness, @as(i32, @intFromFloat(segments)), lineThick, rl.fade(rl.Color.maroon, 0.4));
if (drawRect) rl.drawRectangleRec(rec, .fade(.gold, 0.6));
if (drawRoundedRect) rl.drawRectangleRounded(rec, roundness, @as(i32, @intFromFloat(segments)), .fade(.maroon, 0.2));
if (drawRoundedLines) rl.drawRectangleRoundedLinesEx(rec, roundness, @as(i32, @intFromFloat(segments)), lineThick, .fade(.maroon, 0.4));
// Draw GUI controls
_ = rgui.guiSliderBar(rl.Rectangle{ .x = 640, .y = 40, .width = 105, .height = 20 }, "Width", rl.textFormat("%.2", .{width}), &width, 0, @as(f32, @floatFromInt(rl.getScreenWidth() - 300)));

View file

@ -9,8 +9,8 @@ fn labelFmt(segments: f32, minSegments: f32) [*c]const u8 {
}
fn colorFmt(segments: f32, minSegments: f32) rl.Color {
if (segments >= minSegments) return rl.Color.maroon;
return rl.Color.dark_gray;
if (segments >= minSegments) return .maroon;
return .dark_gray;
}
pub fn main() anyerror!void {
@ -50,14 +50,14 @@ pub fn main() anyerror!void {
rl.beginDrawing();
defer rl.endDrawing();
rl.clearBackground(rl.Color.ray_white);
rl.clearBackground(.ray_white);
rl.drawLine(500, 0, 500, rl.getScreenHeight(), rl.fade(rl.Color.light_gray, 0.6));
rl.drawRectangle(500, 0, rl.getScreenWidth() - 500, rl.getScreenHeight(), rl.fade(rl.Color.light_gray, 0.3));
rl.drawLine(500, 0, 500, rl.getScreenHeight(), .fade(.light_gray, 0.6));
rl.drawRectangle(500, 0, rl.getScreenWidth() - 500, rl.getScreenHeight(), .fade(.light_gray, 0.3));
if (drawRing) rl.drawRing(center, innerRadius, outerRadius, startAngle, endAngle, @intFromFloat(segments), rl.fade(rl.Color.maroon, 0.3));
if (drawRingLines) rl.drawRingLines(center, innerRadius, outerRadius, startAngle, endAngle, @intFromFloat(segments), rl.fade(rl.Color.black, 0.4));
if (drawCircleLines) rl.drawCircleSectorLines(center, outerRadius, startAngle, endAngle, @intFromFloat(segments), rl.fade(rl.Color.black, 0.4));
if (drawRing) rl.drawRing(center, innerRadius, outerRadius, startAngle, endAngle, @intFromFloat(segments), .fade(.maroon, 0.3));
if (drawRingLines) rl.drawRingLines(center, innerRadius, outerRadius, startAngle, endAngle, @intFromFloat(segments), .fade(.black, 0.4));
if (drawCircleLines) rl.drawCircleSectorLines(center, outerRadius, startAngle, endAngle, @intFromFloat(segments), .fade(.black, 0.4));
// Draw GUI controls
//------------------------------------------------------------------------------

View file

@ -69,17 +69,17 @@ pub fn main() anyerror!void {
rl.beginDrawing();
defer rl.endDrawing();
rl.drawCircleV(scleraLeftPosition, scleraRadius, rl.Color.light_gray);
rl.drawCircleV(irisLeftPosition, irisRadius, rl.Color.brown);
rl.drawCircleV(irisLeftPosition, 10, rl.Color.black);
rl.drawCircleV(scleraLeftPosition, scleraRadius, .light_gray);
rl.drawCircleV(irisLeftPosition, irisRadius, .brown);
rl.drawCircleV(irisLeftPosition, 10, .black);
rl.drawCircleV(scleraRightPosition, scleraRadius, rl.Color.light_gray);
rl.drawCircleV(irisRightPosition, irisRadius, rl.Color.dark_green);
rl.drawCircleV(irisRightPosition, 10, rl.Color.black);
rl.drawCircleV(scleraRightPosition, scleraRadius, .light_gray);
rl.drawCircleV(irisRightPosition, irisRadius, .dark_green);
rl.drawCircleV(irisRightPosition, 10, .black);
rl.drawFPS(10, 10);
rl.clearBackground(rl.Color.ray_white);
rl.clearBackground(.ray_white);
//----------------------------------------------------------------------------------
}
}

View file

@ -6,8 +6,8 @@ fn collisionFmt(isColliding: bool) f32 {
}
fn movingFmt(isMoving: bool) rl.Color {
if (isMoving) return rl.Color.red;
return rl.Color.blue;
if (isMoving) return .red;
return .blue;
}
pub fn main() anyerror!void {
@ -60,12 +60,12 @@ pub fn main() anyerror!void {
rl.beginDrawing();
defer rl.endDrawing();
rl.clearBackground(rl.Color.ray_white);
rl.clearBackground(.ray_white);
rl.drawText("MOVE START-END POINTS WITH MOUSE", 15, 20, 20, rl.Color.gray);
rl.drawText("MOVE START-END POINTS WITH MOUSE", 15, 20, 20, .gray);
// Draw line Cubic Bezier, in-out interpolation (easing), no control points
rl.drawLineBezier(startPoint, endPoint, 4.0, rl.Color.blue);
rl.drawLineBezier(startPoint, endPoint, 4.0, .blue);
// Draw start-end spline circles with some details
rl.drawCircleV(startPoint, collisionFmt(rl.checkCollisionPointCircle(mouse, startPoint, 10.0)), movingFmt(moveStartPoint));

View file

@ -28,13 +28,13 @@ pub fn main() anyerror!void {
rl.beginDrawing();
defer rl.endDrawing();
rl.clearBackground(rl.Color.ray_white);
rl.clearBackground(.ray_white);
rl.drawRectangle(screenWidth / 2 - 128, screenHeight / 2 - 128, 256, 256, raylib_zig);
rl.drawRectangle(screenWidth / 2 - 112, screenHeight / 2 - 112, 224, 224, rl.Color.ray_white);
rl.drawRectangle(screenWidth / 2 - 112, screenHeight / 2 - 112, 224, 224, .ray_white);
rl.drawText("raylib-zig", screenWidth / 2 - 96, screenHeight / 2 + 57, 41, raylib_zig);
rl.drawText("this is NOT a texture!", 350, 370, 10, rl.Color.gray);
rl.drawText("this is NOT a texture!", 350, 370, 10, .gray);
//----------------------------------------------------------------------------------
}
}

View file

@ -90,37 +90,37 @@ pub fn main() anyerror!void {
rl.beginDrawing();
defer rl.endDrawing();
rl.clearBackground(rl.Color.ray_white);
rl.clearBackground(.ray_white);
if (state == 0) {
if (@mod(framesCounter, @as(u8, 15)) == 0) rl.drawRectangle(logoPositionX, logoPositionY, 16, 16, rl.Color.black);
if (@mod(framesCounter, @as(u8, 15)) == 0) rl.drawRectangle(logoPositionX, logoPositionY, 16, 16, .black);
} else if (state == 1) {
rl.drawRectangle(logoPositionX, logoPositionY, topSideRecWidth, 16, rl.Color.black);
rl.drawRectangle(logoPositionX, logoPositionY, 16, leftSideRecHeight, rl.Color.black);
rl.drawRectangle(logoPositionX, logoPositionY, topSideRecWidth, 16, .black);
rl.drawRectangle(logoPositionX, logoPositionY, 16, leftSideRecHeight, .black);
} else if (state == 2) {
rl.drawRectangle(logoPositionX, logoPositionY, topSideRecWidth, 16, rl.Color.black);
rl.drawRectangle(logoPositionX, logoPositionY, 16, leftSideRecHeight, rl.Color.black);
rl.drawRectangle(logoPositionX, logoPositionY, topSideRecWidth, 16, .black);
rl.drawRectangle(logoPositionX, logoPositionY, 16, leftSideRecHeight, .black);
rl.drawRectangle(logoPositionX + 240, logoPositionY, 16, rightSideRecHeight, rl.Color.black);
rl.drawRectangle(logoPositionX, logoPositionY + 240, bottomSideRecWidth, 16, rl.Color.black);
rl.drawRectangle(logoPositionX + 240, logoPositionY, 16, rightSideRecHeight, .black);
rl.drawRectangle(logoPositionX, logoPositionY + 240, bottomSideRecWidth, 16, .black);
} else if (state == 3) {
rl.drawRectangle(logoPositionX, logoPositionY, topSideRecWidth, 16, rl.fade(rl.Color.black, alpha));
rl.drawRectangle(logoPositionX, logoPositionY + 16, 16, leftSideRecHeight - 32, rl.fade(rl.Color.black, alpha));
rl.drawRectangle(logoPositionX, logoPositionY, topSideRecWidth, 16, .fade(.black, alpha));
rl.drawRectangle(logoPositionX, logoPositionY + 16, 16, leftSideRecHeight - 32, .fade(.black, alpha));
rl.drawRectangle(logoPositionX + 240, logoPositionY + 16, 16, rightSideRecHeight - 32, rl.fade(rl.Color.black, alpha));
rl.drawRectangle(logoPositionX, logoPositionY + 240, bottomSideRecWidth, 16, rl.fade(rl.Color.black, alpha));
rl.drawRectangle(logoPositionX + 240, logoPositionY + 16, 16, rightSideRecHeight - 32, .fade(.black, alpha));
rl.drawRectangle(logoPositionX, logoPositionY + 240, bottomSideRecWidth, 16, .fade(.black, alpha));
rl.drawRectangle(
(@divFloor(rl.getScreenWidth(), @as(i32, 2))) - 112,
(@divFloor(rl.getScreenHeight(), @as(i32, 2))) - 112,
224,
224,
rl.fade(rl.Color.ray_white, alpha),
.fade(.ray_white, alpha),
);
rl.drawText(rl.textSubtext("raylib", 0, lettersCount), @divFloor(rl.getScreenWidth(), @as(i32, 2)) - 44, @divFloor(rl.getScreenHeight(), @as(i32, 2)) + 48, 50, rl.fade(rl.Color.black, alpha));
rl.drawText(rl.textSubtext("raylib", 0, lettersCount), @divFloor(rl.getScreenWidth(), @as(i32, 2)) - 44, @divFloor(rl.getScreenHeight(), @as(i32, 2)) + 48, 50, .fade(.black, alpha));
} else if (state == 4) {
rl.drawText("[R] REPLAY", 340, 200, 20, rl.Color.gray);
rl.drawText("[R] REPLAY", 340, 200, 20, .gray);
}
//----------------------------------------------------------------------------------

View file

@ -68,15 +68,15 @@ pub fn main() anyerror!void {
rl.beginDrawing();
defer rl.endDrawing();
rl.clearBackground(rl.Color.ray_white);
rl.clearBackground(.ray_white);
rl.drawText("Scale rectangle dragging from bottom-right corner!", 10, 10, 20, rl.Color.gray);
rl.drawText("Scale rectangle dragging from bottom-right corner!", 10, 10, 20, .gray);
rl.drawRectangleRec(rec, rl.fade(rl.Color.green, 0.5));
rl.drawRectangleRec(rec, .fade(.green, 0.5));
if (mouseScaleReady) {
rl.drawRectangleLinesEx(rec, 1, rl.Color.red);
rl.drawTriangle(rl.Vector2{ .x = rec.x + rec.width - mouseScaleMarkSize, .y = rec.y + rec.height }, rl.Vector2{ .x = rec.x + rec.width, .y = rec.y + rec.height }, rl.Vector2{ .x = rec.x + rec.width, .y = rec.y + rec.height - mouseScaleMarkSize }, rl.Color.red);
rl.drawRectangleLinesEx(rec, 1, .red);
rl.drawTriangle(rl.Vector2{ .x = rec.x + rec.width - mouseScaleMarkSize, .y = rec.y + rec.height }, rl.Vector2{ .x = rec.x + rec.width, .y = rec.y + rec.height }, rl.Vector2{ .x = rec.x + rec.width, .y = rec.y + rec.height - mouseScaleMarkSize }, .red);
}
//----------------------------------------------------------------------------------
}