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

@ -35,15 +35,15 @@ pub fn main() anyerror!void {
rl.beginDrawing();
defer rl.endDrawing();
rl.clearBackground(rl.Color.white);
rl.clearBackground(.white);
rl.drawText(rl.textFormat("Score: %08i", .{score}), 200, 80, 20, rl.Color.red);
rl.drawText(rl.textFormat("Score: %08i", .{score}), 200, 80, 20, .red);
rl.drawText(rl.textFormat("HiScore: %08i", .{hiscore}), 200, 120, 20, rl.Color.green);
rl.drawText(rl.textFormat("HiScore: %08i", .{hiscore}), 200, 120, 20, .green);
rl.drawText(rl.textFormat("Lives: %02i", .{lives}), 200, 160, 40, rl.Color.blue);
rl.drawText(rl.textFormat("Lives: %02i", .{lives}), 200, 160, 40, .blue);
rl.drawText(rl.textFormat("Elapsed Time: %02.02f ms", .{rl.getFrameTime() * 1000}), 200, 220, 20, rl.Color.black);
rl.drawText(rl.textFormat("Elapsed Time: %02.02f ms", .{rl.getFrameTime() * 1000}), 200, 220, 20, .black);
//----------------------------------------------------------------------------------
}
}

View file

@ -25,9 +25,9 @@ pub fn main() void {
{
// Update
//----------------------------------------------------------------------------------
framesCounter += if (rl.isKeyDown(rl.KeyboardKey.space)) 8 else 1;
framesCounter += if (rl.isKeyDown(.space)) 8 else 1;
if (rl.isKeyPressed(rl.KeyboardKey.enter)) framesCounter = 0;
if (rl.isKeyPressed(.enter)) framesCounter = 0;
//----------------------------------------------------------------------------------
// Draw
//----------------------------------------------------------------------------------