mirror of
https://github.com/bevyengine/bevy
synced 2024-11-28 23:50:20 +00:00
add "pressed" example to mouse_input
This commit is contained in:
parent
aa2928739c
commit
5aeb3b937b
1 changed files with 6 additions and 2 deletions
|
@ -9,11 +9,15 @@ fn main() {
|
||||||
|
|
||||||
// This system prints messages when you press or release the left mouse button:
|
// This system prints messages when you press or release the left mouse button:
|
||||||
fn mouse_click_system(mouse_button_input: Res<Input<MouseButton>>) {
|
fn mouse_click_system(mouse_button_input: Res<Input<MouseButton>>) {
|
||||||
|
if mouse_button_input.pressed(MouseButton::Left) {
|
||||||
|
println!("left mouse currently pressed");
|
||||||
|
}
|
||||||
|
|
||||||
if mouse_button_input.just_pressed(MouseButton::Left) {
|
if mouse_button_input.just_pressed(MouseButton::Left) {
|
||||||
println!("left mouse clicked");
|
println!("left mouse just pressed");
|
||||||
}
|
}
|
||||||
|
|
||||||
if mouse_button_input.just_released(MouseButton::Left) {
|
if mouse_button_input.just_released(MouseButton::Left) {
|
||||||
println!("left mouse released");
|
println!("left mouse just released");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue