Skip to content

Commit 335b3a9

Browse files
author
Jay
committed
label.text_colour not needed now that style is standardised
1 parent b9dda11 commit 335b3a9

File tree

2 files changed

+3
-10
lines changed

2 files changed

+3
-10
lines changed

build.zig.zon

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
.{
22
.name = .engine,
3-
.version = "0.8.2",
3+
.version = "0.8.3",
44
.fingerprint = 0xe8a81a8d0aa558d5,
55
.minimum_zig_version = "0.15.2",
66
.dependencies = .{

src/engine.zig

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -384,15 +384,13 @@ pub const Element = struct {
384384
elements: ArrayListUnmanaged(TextElement) = .empty,
385385
line_height: f32 = 1,
386386
text_size: TextSize = .normal,
387-
text_colour: ThemeColour = .normal,
388387
on_click: Callback = .{ .func = null },
389388
},
390389
checkbox: struct {
391390
checked: bool = false,
392391
font: *FontInfo = undefined,
393392
font_name: ?[]const u8 = null,
394393
text_size: TextSize = .normal,
395-
text_colour: ThemeColour = .normal,
396394
text: []const u8 = "",
397395
translated: []const u8 = "",
398396
elements: ArrayListUnmanaged(TextElement) = .empty,
@@ -2253,11 +2251,6 @@ inline fn draw_label(
22532251
.checkbox => element.type.checkbox.elements.items,
22542252
else => unreachable,
22552253
};
2256-
const text_colour = switch (element.type) {
2257-
.label => element.type.label.text_colour,
2258-
.checkbox => element.type.checkbox.text_colour,
2259-
else => unreachable,
2260-
};
22612254

22622255
const word_spacing = display.text_height * display.scale * text_height.height() / 4.0;
22632256

@@ -2326,7 +2319,7 @@ inline fn draw_label(
23262319
}
23272320

23282321
// Only render text if display parameter is provided
2329-
const current_colour = text_colour.text(display.theme, element.colour);
2322+
const current_colour = element.style.text(display.theme, element.colour);
23302323
_ = sdl.SDL_SetTextureColorMod(
23312324
item.texture,
23322325
current_colour.r,
@@ -4994,6 +4987,7 @@ pub const Display = struct {
49944987
) (Error || Allocator.Error || Resources.Error)!void {
49954988
_ = try parent.add(allocator, display, .{
49964989
.name = name,
4990+
.style = .normal,
49974991
.focus = .accessibility_focus,
49984992
.rect = .{ .x = 250, .y = 50, .width = 500, .height = 80 },
49994993
.layout = .{ .y = .shrinks, .x = .grows },
@@ -5002,7 +4996,6 @@ pub const Display = struct {
50024996
.text = text,
50034997
.translated = "",
50044998
.text_size = size,
5005-
.text_colour = .normal,
50064999
} },
50075000
});
50085001
}

0 commit comments

Comments
 (0)