C
int natiny_input_get_touch_x_speed(uint32_t touch);
Returns the touch movement along the x axis since the previous frame, in the
window's current drawing units.
Parameters
Returns
| Type |
Description |
int |
Signed horizontal movement in drawing units; positive to the right, negative to the left, 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_x -= (float)natiny_input_get_touch_x_speed(touch);
}
Notes
- The value uses the window's scale mode, not
physical pixels. It uses the same units as
natiny_input_get_mouse_x_speed.
- The value remains fixed for the current frame. Movement during a frame is
visible in the next frame.
- A new touch returns
0 because no previous touch position exists.
- See also
natiny_input_get_touch_x.
- Touch input is available on Android and in touch-enabled browsers.