natiny_input_get_touch_down

C
bool natiny_input_get_touch_down(uint32_t touch);

Returns whether the specified touch is currently in contact with the screen.

Parameters

Name Type Description
touch uint32_t Touch identifier from natiny_input_get_touch_at

Returns

Type Description
bool true while the touch is in contact with the screen; false on its release frame or for an invalid identifier

Example

C
if (drag && natiny_input_get_touch_down(drag)) {
    camera_x -= (float)natiny_input_get_touch_x_speed(drag);
}

Notes

  • The function returns false on the same frame that natiny_input_get_touch_released returns true.
  • 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.