C
bool natiny_input_get_touch_pressed(uint32_t touch);
Returns true only on the frame when the specified touch first contacts the
screen.
Parameters
Returns
| Type |
Description |
bool |
true on the touch's first frame; false on later frames or for an invalid identifier |
Example
C
for (int i = 0; i < natiny_input_get_touch_count(); i++) {
uint32_t touch = natiny_input_get_touch_at(i);
if (natiny_input_get_touch_pressed(touch))
fire(natiny_input_get_touch_x(touch), natiny_input_get_touch_y(touch));
}
Notes
- A touch that starts and ends between two frames returns
true here and from
natiny_input_get_touch_released in the same frame.
- Touch input is available on Android and in touch-enabled browsers.
- The first active touch is also reported as the left mouse button. Do not
process both APIs unless duplicate input is intended.