bevy/examples/input/touch_input_highlevel.rs
Sergey Minakov a80469bd13
Touch support implementation (#696)
Adds a basic touch input system
2020-10-18 12:24:01 -07:00

29 lines
681 B
Rust

use bevy::{input::touch::*, prelude::*};
fn main() {
App::build()
.add_default_plugins()
.add_system(touch_system.system())
.run();
}
fn touch_system(touches: Res<Touches>) {
for touch in touches.iter_just_pressed() {
println!(
"just pressed touch with id: {:?}, at: {:?}",
touch.id, touch.position
);
}
for touch in touches.iter_just_released() {
println!(
"just released touch with id: {:?}, at: {:?}",
touch.id, touch.position
);
}
for touch in touches.iter_just_cancelled() {
println!("cancelled touch with id: {:?}", touch.id);
}
}