feat: make text gray if it has no command

dev
LeRoyce Pearson 2024-02-29 13:45:41 -07:00
parent 6d7c4d8b74
commit 527c3aa0ce
1 changed files with 3 additions and 7 deletions

View File

@ -1009,7 +1009,9 @@ pub const TextElement = struct {
const this: *@This() = @ptrCast(@alignCast(pointer)); const this: *@This() = @ptrCast(@alignCast(pointer));
_ = max; _ = max;
const text_size = canvas.writeText(min, this.text, .{}); const text_size = canvas.writeText(min, this.text, .{
.color = if (this.command != null) .{ 0xFF, 0xFF, 0xFF, 0xFF } else .{ 0xAA, 0xAA, 0xAA, 0xFF },
});
if (render_resources.hovered != null and this.command != null and std.mem.eql(u8, render_resources.hovered.?, this.command.?)) { if (render_resources.hovered != null and this.command != null and std.mem.eql(u8, render_resources.hovered.?, this.command.?)) {
canvas.rect( canvas.rect(
@ -1195,13 +1197,7 @@ fn endOfTurnConfirmHandler(arena: std.mem.Allocator, request: Request) HandlerEr
} }
} }
var new_meld_text = try TextElement.create(arena, .{
.text = "New Meld",
.command = null,
});
var melds_hbox = try HBox.create(arena); var melds_hbox = try HBox.create(arena);
try melds_hbox.addElement(new_meld_text.element());
var draw_pile = try Pile.create(arena, request.game_state.draw_pile.items); var draw_pile = try Pile.create(arena, request.game_state.draw_pile.items);
draw_pile.hidden = true; draw_pile.hidden = true;