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

@ -87,7 +87,7 @@ pub fn main() anyerror!void {
rl.beginDrawing();
defer rl.endDrawing();
rl.clearBackground(rl.Color.ray_white);
rl.clearBackground(.ray_white);
// We only draw a white full-screen rectangle,
// frame is generated in shader using raymarching
@ -100,7 +100,7 @@ pub fn main() anyerror!void {
0,
rl.getScreenWidth(),
rl.getScreenHeight(),
rl.Color.white,
.white,
);
}
@ -109,7 +109,7 @@ pub fn main() anyerror!void {
rl.getScreenWidth() - 280,
rl.getScreenHeight() - 20,
10,
rl.Color.black,
.black,
);
//----------------------------------------------------------------------------------
}

View file

@ -15,7 +15,7 @@ pub fn main() anyerror!void {
rl.initWindow(screenWidth, screenHeight, "raylib [shaders] example - Apply an outline to a texture");
defer rl.closeWindow(); // Close window and OpenGL context
const texture: rl.Texture = try rl.Texture.init("resources/textures/fudesumi.png");
const texture: rl.Texture = try .init("resources/textures/fudesumi.png");
defer rl.unloadTexture(texture);
const shdrOutline: rl.Shader = try rl.loadShader(null, "resources/shaders/glsl330/outline.fs");
@ -76,7 +76,7 @@ pub fn main() anyerror!void {
rl.beginDrawing();
defer rl.endDrawing();
rl.clearBackground(rl.Color.ray_white);
rl.clearBackground(.ray_white);
{
rl.beginShaderMode(shdrOutline);
@ -85,18 +85,18 @@ pub fn main() anyerror!void {
texture.draw(
@divFloor(rl.getScreenWidth(), 2) - @divFloor(texture.width, 2),
-30,
rl.Color.white,
.white,
);
}
rl.drawText("Shader-based\ntexture\noutline", 10, 10, 20, rl.Color.gray);
rl.drawText("Shader-based\ntexture\noutline", 10, 10, 20, .gray);
rl.drawText(
rl.textFormat("Outline size: %i px", .{@as(i32, @intFromFloat(outlineSize))}),
10,
120,
20,
rl.Color.maroon,
.maroon,
);
rl.drawFPS(710, 10);