DRAWING FUNCTIONS
DrawText
Draws text at the given position.
Syntax
ONYX.DrawText(x, y, text, size_px, r, g, b, a, fontId)Parameters
x, y(number) — Position in pixels.text(string) — The text to render.size_px(number) — Font size in pixels; 0 uses the font default size.r, g, b(number) — Colour; floats in [0,1] or 0-255 integers.a(number (optional)) — Alpha; default 1.fontId(number (optional)) — Handle from LoadFont / LoadFontFromBuffer.
Return(s)
None
Behavior
- Enqueues a text draw command and floors the position to whole pixels for sharpness.
- Visible after SubmitFrame, or on the next present when auto-frame is enabled.
Example(s)
local font = ONYX.LoadFont("C:/fonts/Inter.ttf", 16)
ONYX.BeginFrame()
ONYX.DrawText(100, 40, "ONYXS", 16, 1, 1, 1, 1, font)
ONYX.SubmitFrame()