natiny_render_rounded_rectangle
void natiny_render_rounded_rectangle(
float x, float y, float w, float h,
float radius_tl, float radius_tr, float radius_br, float radius_bl
);
Draws a filled rectangle with each corner rounded by a radius of its own, on
the currently bound render target, using the current drawing color set by
natiny_render_set_color().
Radii are ordered top-left, top-right, bottom-right, bottom-left.
Parameters
| Name | Type | Description |
|---|---|---|
x |
float |
Left edge X position |
y |
float |
Top edge Y position |
w |
float |
Width |
h |
float |
Height |
radius_tl |
float |
Top-left corner radius |
radius_tr |
float |
Top-right corner radius |
radius_br |
float |
Bottom-right corner radius |
radius_bl |
float |
Bottom-left corner radius |
Example
natiny_render_rounded_rectangle(40.0f, 40.0f, 240.0f, 140.0f,
14.0f, 14.0f, 14.0f, 14.0f);
Notes
- Negative radii become
0.0f; a zero or negativeworhdraws nothing. - If adjacent radii do not fit a side, all four are scaled down by one common factor until they fit. All-zero radii produce a plain rectangle.
- UV coordinates run from
0to1across the rectangle bounds.