diff --git a/src/sandbox.zig b/src/sandbox.zig index bdcc0f1..148d571 100644 --- a/src/sandbox.zig +++ b/src/sandbox.zig @@ -104,12 +104,18 @@ pub fn spawnAtEdge(rng: *std.Random) Entity { const vx = (dx / dist) * ENTITY_SPEED; const vy = (dy / dist) * ENTITY_SPEED; + // random RGB color + const r = rng.int(u8); + const g = rng.int(u8); + const b = rng.int(u8); + const color: u32 = (@as(u32, r) << 16) | (@as(u32, g) << 8) | @as(u32, b); + return .{ .x = x, .y = y, .vx = vx, .vy = vy, - .color = 0x00FFFF, // cyan + .color = color, }; } diff --git a/src/sandbox_main.zig b/src/sandbox_main.zig index 122aaed..8c1c9b9 100644 --- a/src/sandbox_main.zig +++ b/src/sandbox_main.zig @@ -117,7 +117,7 @@ fn createCircleTexture() ?rl.Texture2D { @divTrunc(TEXTURE_SIZE, 2), @divTrunc(TEXTURE_SIZE, 2), ENTITY_RADIUS, - CYAN, + rl.Color{ .r = 255, .g = 255, .b = 255, .a = 255 }, // white, tinted per-entity ); rl.endTextureMode(); @@ -183,9 +183,14 @@ pub fn main() !void { rl.gl.rlSetTexture(circle_texture.id); rl.gl.rlBegin(rl.gl.rl_quads); - rl.gl.rlColor4ub(255, 255, 255, 255); // white tint for (entities.items[0..entities.count]) |entity| { + // extract RGB from entity color (0xRRGGBB) + const r: u8 = @truncate(entity.color >> 16); + const g: u8 = @truncate(entity.color >> 8); + const b: u8 = @truncate(entity.color); + rl.gl.rlColor4ub(r, g, b, 255); + const x1 = entity.x - half; const y1 = entity.y - half; const x2 = entity.x + half; diff --git a/src/ui.zig b/src/ui.zig index 098217e..3ab9c77 100644 --- a/src/ui.zig +++ b/src/ui.zig @@ -8,8 +8,8 @@ const sandbox = @import("sandbox.zig"); // config - tweak these // ============================================================================= -pub const font_size: f32 = 14; -pub const small_font_size: f32 = 12; +pub const font_size: f32 = 16; +pub const small_font_size: f32 = 16; pub const line_height: f32 = 20; pub const small_line_height: f32 = 18; pub const padding: f32 = 10;