Simp module

draw_text

procedureSource

Draws text in one line and returns its width in pixels.

Example
font := load_font("", "Roboto-Regular.ttf", 24);
width := draw_text(font, 20, 40, "Score: 120", .{1, 1, 0, 1});

This one is only checked to compile, not run.

draw_text :: (
    font: *Dynamic_Font,
    x: s64,
    y: s64,
    text: string,
    color := Vector4.{ 1, 1, 1, 1 },
    effects: Font_Effects = 0
) -> width: s64

Draws text in one line and returns its width in pixels.

Parameters

font: *Dynamic_Font
a font from load_font.
x: s64
where the text starts, in the units of the render target.
y: s64
the baseline of the text.
text: string
UTF-8.
color := Vector4.{ 1, 1, 1, 1 }
white by default.
effects: Font_Effects = 0
Font_Effects flags.

Returns

width: s64
Example
font := load_font("", "Roboto-Regular.ttf", 24);
width := draw_text(font, 20, 40, "Score: 120", .{1, 1, 0, 1});

This one is only checked to compile, not run.

See also