work on button with label

This commit is contained in:
Alessandro Mauri 2024-12-20 19:50:58 +01:00
parent ca691d1294
commit a0c6a3b2cb
6 changed files with 89 additions and 23 deletions

View file

@ -212,8 +212,16 @@ fn Rect! Ctx.get_text_bounds(&ctx, String text)
return text_bounds;
}
fn Point Ctx.center_text(&ctx, Rect text_bounds, Rect bounds)
{
short dw = bounds.w - text_bounds.w;
short dh = bounds.h - text_bounds.h;
return Point{.x = dw/2, .y = dh/2};
}
// TODO: check if the font is present in the context
fn Id Ctx.get_font_id(&ctx, String label)
{
return (Id)label.hash();
}
}