DRAWING FUNCTIONS

WithFrame

Runs a callback inside a new frame and submits it afterwards.

Syntax

ONYX.WithFrame(callback)

Parameters

  • callback (function) — Function containing draw commands; BeginFrame runs before it and SubmitFrame after it.

Return(s)

None

Behavior

  • Convenience wrapper: BeginFrame, then your callback, then SubmitFrame.
  • If the callback raises an error, SubmitFrame is still called and the error is re-raised.

Example(s)

ONYX.WithFrame(function()
  ONYX.DrawRectFilled(100, 100, 200, 50, 0, 0, 0, 1)
  ONYX.DrawText(110, 110, "inside WithFrame", 16, 1, 1, 1, 1)
end)