mirror of
https://github.com/bevyengine/bevy
synced 2024-11-26 22:50:19 +00:00
e9312254d8
Fixes issue mentioned in PR #8285. _Note: By mistake, this is currently dependent on #8285_ # Objective Ensure consistency in the spelling of the documentation. Exceptions: `crates/bevy_mikktspace/src/generated.rs` - Has not been changed from licence to license as it is part of a licensing agreement. Maybe for further consistency, https://github.com/bevyengine/bevy-website should also be given a look. ## Solution ### Changed the spelling of the current words (UK/CN/AU -> US) : cancelled -> canceled (Breaking API changes in #8285) behaviour -> behavior (Breaking API changes in #8285) neighbour -> neighbor grey -> gray recognise -> recognize centre -> center metres -> meters colour -> color ### ~~Update [`engine_style_guide.md`]~~ Moved to #8324 --- ## Changelog Changed UK spellings in documentation to US ## Migration Guide Non-breaking changes* \* If merged after #8285
38 lines
1,000 B
Rust
38 lines
1,000 B
Rust
//! Displays touch presses, releases, and cancels.
|
|
|
|
use bevy::{input::touch::*, prelude::*};
|
|
|
|
fn main() {
|
|
App::new()
|
|
.add_plugins(DefaultPlugins)
|
|
.add_systems(Update, touch_system)
|
|
.run();
|
|
}
|
|
|
|
fn touch_system(touches: Res<Touches>) {
|
|
for touch in touches.iter_just_pressed() {
|
|
info!(
|
|
"just pressed touch with id: {:?}, at: {:?}",
|
|
touch.id(),
|
|
touch.position()
|
|
);
|
|
}
|
|
|
|
for touch in touches.iter_just_released() {
|
|
info!(
|
|
"just released touch with id: {:?}, at: {:?}",
|
|
touch.id(),
|
|
touch.position()
|
|
);
|
|
}
|
|
|
|
for touch in touches.iter_just_canceled() {
|
|
info!("canceled touch with id: {:?}", touch.id());
|
|
}
|
|
|
|
// you can also iterate all current touches and retrieve their state like this:
|
|
for touch in touches.iter() {
|
|
info!("active touch: {:?}", touch);
|
|
info!(" just_pressed: {}", touches.just_pressed(touch.id()));
|
|
}
|
|
}
|