C
void natiny_input_set_cursor(uint32_t cursor);
Sets the persistent, program-wide mouse cursor shape. The setting applies to
every window, including windows created after the call.
Parameters
| Name |
Type |
Description |
cursor |
uint32_t |
Cursor constant below; values above NATINY_CURSOR_FORBIDDEN print a diagnostic and leave the setting unchanged |
Constants
| Name |
Value |
Description |
NATINY_CURSOR_ARROW |
0 |
Ordinary pointer and the initial shape |
NATINY_CURSOR_TEXT |
1 |
I-beam for text input |
NATINY_CURSOR_CROSSHAIR |
2 |
Crosshair for aiming or precise selection |
NATINY_CURSOR_HAND |
3 |
Pointing hand for an interactive element |
NATINY_CURSOR_RESIZE_EW |
4 |
Horizontal resize arrow |
NATINY_CURSOR_RESIZE_NS |
5 |
Vertical resize arrow |
NATINY_CURSOR_RESIZE_NWSE |
6 |
Diagonal resize arrow from top-left to bottom-right |
NATINY_CURSOR_RESIZE_NESW |
7 |
Diagonal resize arrow from top-right to bottom-left |
NATINY_CURSOR_MOVE |
8 |
Four-way move arrow |
NATINY_CURSOR_FORBIDDEN |
9 |
Indicates that an action is not allowed |
Example
C
/* Reset the shape before hovered elements override it. */
natiny_input_set_cursor(NATINY_CURSOR_ARROW);
if (natiny_view_get_hovered(button))
natiny_input_set_cursor(NATINY_CURSOR_HAND);
Notes
- On platforms without a visible cursor, this records the shape without
displaying it.
natiny_input_get_cursor still returns the
recorded shape.
- Mouse capture hides the cursor without changing its shape. The cursor uses
the recorded shape again when capture is released. See
natiny_input_set_mouse_capture.