natiny.render.scissor_begin

Lua
natiny.render.scissor_begin(x, y, width, height [, fn])

Starts a scissor clip rectangle for subsequent draw calls on the currently bound render target.

Parameters

Name Type Default Description
x number Left edge of the clip rectangle
y number Top edge of the clip rectangle
width number Clip rectangle width
height number Clip rectangle height
fn function nil Called with no arguments while the clip is in force; the clip is ended when it returns

Example

Lua
natiny.render.scissor_begin(40, 40, 220, 120, function()
    draw_content()
end)

Without the callback, end the clip by hand:

Lua
natiny.render.scissor_begin(40, 40, 220, 120)
draw_content()
natiny.render.scissor_end()

Notes

  • Pair every successful begin with natiny.render.scissor_end(); nesting is limited to 16 levels.