add "pressed" example to mouse_input

This commit is contained in:
Carter Anderson 2020-06-04 23:57:39 -07:00
parent aa2928739c
commit 5aeb3b937b

View file

@ -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");
} }
} }