natiny_render_view_children
void natiny_render_view_children(NatinyView view);
Draws the view's children in parenting order, from inside its own
NATINY_VIEW_HOOK_DRAW. A view with a draw
hook draws its children only when this function is called; a view without one
draws them automatically. Drawing happens at the position of the call, so a
scissor opened before it and closed after it clips the whole subtree.
Parameters
| Name | Type | Description |
|---|---|---|
view |
NatinyView |
The view being drawn; the one the hook was given |
view must be the handle passed to the draw hook that is currently running.
A call outside that hook, with another handle (including 0), or for a second
time during the same hook invocation writes a diagnostic to standard error and
draws nothing.
Example
static void panel_draw(NatinyView self, void* userdata) {
float x, y, w, h;
natiny_view_get_rect(self, &x, &y, &w, &h);
natiny_render_set_color(PANEL);
natiny_render_rectangle(x, y, w, h);
/* the list scrolls, so nothing of it may leave the panel */
natiny_render_scissor_begin((int)x, (int)y, (int)w, (int)h);
natiny_render_view_children(self);
natiny_render_scissor_end();
}