natiny_input_get_touch_count

C
int natiny_input_get_touch_count(void);

Returns the number of touch identifiers available in the current frame. The count includes touches released during this frame.

Returns

Type Description
int Number of available touch identifiers, from 0 to 24

Example

C
for (int i = 0; i < natiny_input_get_touch_count(); i++) {
    uint32_t touch = natiny_input_get_touch_at(i);
    natiny_render_circle((float)natiny_input_get_touch_x(touch),
                         (float)natiny_input_get_touch_y(touch), 24.0f);
}

Notes

  • Natiny tracks at most 24 touches. Additional touches are ignored until a slot becomes available.
  • Touch input is available on Android and in touch-enabled browsers. Other platforms return 0.