bevy_input::touch

Function touch_screen_input_system

Source
pub fn touch_screen_input_system(
    touch_state: ResMut<'_, Touches>,
    touch_input_events: EventReader<'_, '_, TouchInput>,
)
Expand description

Updates the Touches resource with the latest TouchInput events.

This is not clearing the pressed collection, because it could incorrectly mark a touch input as not pressed even though it is pressed. This could happen if the touch input is not moving for a single frame and would therefore be marked as not pressed, because this function is called on every single frame no matter if there was an event or not.

ยงDifferences

The main difference between the TouchInput event and the Touches resource is that the latter has convenient functions like Touches::just_pressed and Touches::just_released.