Compare commits

..

2 Commits

Author SHA1 Message Date
24216e4ab4 add separator widget 2025-09-24 22:49:51 +02:00
6a13245fd9 revert ccca2be49684cdcc905d1acc0b8d2c4cb126c4b4 2025-09-24 22:49:34 +02:00
2 changed files with 20 additions and 4 deletions

View File

@ -113,10 +113,10 @@ fn void? Font.load(&font, String name, ZString path, uint height, float scale)
font.atlas.new(font.id, ATLAS_GRAYSCALE, size, size)!;
// FIXME: this crashes with O1 or greater, why??
// // preallocate the ASCII range
// for (char c = ' '; c < '~'; c++) {
// font.get_glyph((Codepoint)c)!;
// }
// preallocate the ASCII range
for (char c = ' '; c < '~'; c++) {
font.get_glyph((Codepoint)c)!;
}
}
fn Glyph*? Font.get_glyph(&font, Codepoint code)

View File

@ -0,0 +1,16 @@
module ugui;
macro Ctx.separator(&ctx, int width, int height, ...)
=> ctx.separator_id(@compute_id($vasplat), width, height);
fn void? Ctx.separator_id(&ctx, Id id, int width, int height)
{
id = ctx.gen_id(id)!;
Elem *parent = ctx.get_parent()!;
Elem *elem = ctx.get_elem(id, ETYPE_NONE)!;
elem.layout.w = @exact((short)width);
elem.layout.h = @exact((short)height);
update_parent_size(elem, parent);
}