some comments

This commit is contained in:
Alessandro Mauri 2025-09-20 00:27:24 +02:00
parent df18be7bf6
commit c046c6af52
3 changed files with 17 additions and 11 deletions

View File

@ -303,6 +303,8 @@ fn TextSize? Ctx.measure_string(&ctx, String text)
// layout a string inside a bounding box, following the given alignment (anchor).
// returns the position of the cursor, the returned height is the line height and the width is the last
// character's advance value
// TODO: implement a "reflow" flag to toggle reflow if a character goes out of bounds
// TODO: also return the total bounds of the laid out string
fn Rect? Ctx.layout_string(&ctx, String text, Rect bounds, Anchor anchor, int z_index, Color hue, isz cursor = -1)
{
Font* font = &ctx.font;

View File

@ -8,6 +8,10 @@ struct ElemText {
TextEdit* te;
}
/* Layout some text without bounds.
* There is a limitation where the current frame bounds are based on the last frame, this is usually
* not a problem but it is in the situation where the text changes almost all frames.
*/
macro Ctx.text(&ctx, String text, ...)
=> ctx.text_id(@compute_id($vasplat), text);
fn void? Ctx.text_id(&ctx, Id id, String text)

View File

@ -52,8 +52,8 @@ const char[*] FS_PATH = "resources/shaders/compiled/ugui.frag.spv";
const char[*] STYLESHEET_PATH = "resources/style.css";
const bool LIMIT_FPS = false;
const bool VSYNC = false;
const bool LIMIT_FPS = true;
const bool VSYNC = true;
fn int main(String[] args)
{