natiny_input_get_touch_y_speed

C
int natiny_input_get_touch_y_speed(uint32_t touch);

Returns the touch movement along the y axis since the previous frame, in the window's current drawing units.

Parameters

Name Type Description
touch uint32_t Touch identifier from natiny_input_get_touch_at

Returns

Type Description
int Signed vertical movement in drawing units; positive downward, negative upward, or 0 for a new or invalid touch

Example

C
for (int index = 0; index < natiny_input_get_touch_count(); index++) {
    uint32_t touch = natiny_input_get_touch_at(index);
    if (natiny_input_get_touch_down(touch))
        camera_y -= (float)natiny_input_get_touch_y_speed(touch);
}

Notes

  • Touch input is available on Android and in touch-enabled browsers.