WithFrame
Execute a callback between BeginFrame and SubmitFrame automatically.
Syntax
Susano.WithFrame(callback) -> void
Parameters
callback (function): A function containing draw commands. BeginFrame() is called before it, SubmitFrame() after it.
Return(s)
None
Behavior
Convenience wrapper that calls BeginFrame(), executes your callback, then calls SubmitFrame(). If the callback errors, SubmitFrame() is still called and the error is re-raised.
Example(s)
Susano.WithFrame(function()
Susano.DrawRectFilled(100, 100, 200, 50, 0, 1, 0)
Susano.DrawText(110, 110, "Inside WithFrame", 16, 1, 1, 1)
end)