DrawText

Draw text at a given position with optional font.

Syntax

Susano.DrawText(x, y, text, size_px, r, g, b[, a][, fontId]) -> void

Parameters

x, y (number): Position in pixels.

text (string): The text to render.

size_px (number): Font size in pixels. Pass 0 to use the font's default size.

r, g, b (number): Color. Accepts 0..1 floats or 0..255 integers (auto-detected).

a (number, optional): Alpha. Default: 1.0.

fontId (number, optional): Font handle from LoadFont/LoadFontFromBuffer. If omitted, uses the current PushFont stack or ImGui default.

Return(s)

None

Behavior

Enqueues a text draw command. The position is floor'd to integer pixels for sharpness. Visible after SubmitFrame() or on next present if auto-frame is enabled.

Example(s)

local font = Susano.LoadFont("C:/Windows/Fonts/arial.ttf", 18)
Susano.BeginFrame()
Susano.DrawText(100, 50, "Hello World", 18, 255, 255, 255, 255, font)
Susano.SubmitFrame()