natiny.render.view
natiny.render.view(view, x, y, width, height)
Lays out a view and everything in it inside a rectangle, runs their pointer hooks, and calls their draw hooks on the current render target.
Parameters
| Name | Type | Description |
|---|---|---|
view |
number |
Root view handle from natiny.view.create |
x, y |
number |
Top-left corner of the space the root is placed in, in drawing units |
width, height |
number |
Size of that space, in drawing units |
Example
natiny.backend.loop(function(dt)
natiny.window.bind(win, function()
natiny.render.clear(BACKGROUND)
natiny.render.view(ui, 0, 0,
natiny.window.get_width(win), natiny.window.get_height(win))
end)
end)
Notes
- An error raised by a Lua hook is raised from this call after it finishes.
- Called from inside a hook, it does nothing.
- A hook that moves, resizes, shows or hides a view is laid out again before anything is drawn, so what a press changes is on screen in the frame the press was made.