C
int natiny_input_get_touch_x(uint32_t touch);
Returns the touch position on the x axis in the window's current drawing units.
Parameters
Returns
| Type |
Description |
int |
Position in drawing units from the window's left edge, or 0 for an invalid identifier |
Example
C
for (int index = 0; index < natiny_input_get_touch_count(); index++) {
uint32_t touch = natiny_input_get_touch_at(index);
natiny_render_circle((float)natiny_input_get_touch_x(touch),
(float)natiny_input_get_touch_y(touch), 24.0f);
}
Notes
- The value uses the window's scale mode, not
physical pixels. It uses the same coordinate system as
natiny_input_get_mouse_x and 2D drawing calls.
- The value remains fixed for the current frame. Movement during a frame is
visible in the next frame.
- See also
natiny_input_get_touch_x_speed.
- Touch input is available on Android and in touch-enabled browsers.