BeginFrame

Start a new Lua render frame. Clears the build buffer for this tick.

Syntax

Susano.BeginFrame() -> void

Parameters

None

Return(s)

None

Behavior

Clears the build buffer only.

Leaves the currently displayed frame untouched.

Subsequent Draw* calls append to the new build buffer.

Calling it again within the same tick re-clears the build buffer.

Does not trigger rendering or a swap by itself.

Example(s)

-- Example 1: one-time overlay (persists until you submit a new frame)
Susano.BeginFrame()
Susano.DrawLine(100,100, 300,200, 1,0,0,1, 2)
Susano.DrawRect(320,100, 120,80, 0,1,0,1, 1.5)
Susano.DrawRectFilled(460,100, 120,80, 0,0,1,0.6)
Susano.DrawCircle(620,140, 40, false, 1,1,0,1, 2, 48)
Susano.DrawText(100,260, "Overlay", 20, 1,1,1,1)
Susano.SubmitFrame()
-- Example 2: animated overlay (updates every frame)
Citizen.CreateThread(function()
  while true do
    local t = GetGameTimer() / 1000.0
    local x = 100 + math.floor(math.sin(t) * 50)

    Susano.BeginFrame()
    Susano.DrawLine(100,100, 300,200, 1,0,0,1, 2)
    Susano.DrawRectFilled(x, 80, 120, 30, 0,0,0,0.5)
    Susano.DrawText(x + 8, 88, ("x=%d"):format(x), 16, 1,1,1,1)
    Susano.SubmitFrame()

    Citizen.Wait(0)
  end
end)

Last updated