natiny_render_viewport_begin
void natiny_render_viewport_begin(int x, int y, int width, int height);
Sets a rectangular viewport on the current window or surface render target.
The viewport becomes the local drawing area: its top-left corner is (0, 0),
and its dimensions are used by 2D drawing and cameras bound afterwards.
Parameters
| Name | Type | Description |
|---|---|---|
x |
int |
Left edge in render-target pixels |
y |
int |
Top edge in render-target pixels |
width |
int |
Width in pixels |
height |
int |
Height in pixels |
Example
natiny_render_viewport_begin(0, 0, 320, 180);
draw_scene();
natiny_render_viewport_end();
Notes
- The rectangle is clamped to the render target. If the clamped width or height is not positive, no viewport is set.