2020-06-05 06:49:36 +00:00
|
|
|
use bevy::prelude::*;
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
App::build()
|
2020-11-03 02:38:37 +00:00
|
|
|
.add_plugin_group(DefaultPlugins)
|
2020-06-05 06:49:36 +00:00
|
|
|
.add_system(mouse_click_system.system())
|
|
|
|
.run();
|
|
|
|
}
|
|
|
|
|
|
|
|
// This system prints messages when you press or release the left mouse button:
|
|
|
|
fn mouse_click_system(mouse_button_input: Res<Input<MouseButton>>) {
|
2020-06-05 06:57:39 +00:00
|
|
|
if mouse_button_input.pressed(MouseButton::Left) {
|
|
|
|
println!("left mouse currently pressed");
|
|
|
|
}
|
2020-06-15 19:47:35 +00:00
|
|
|
|
2020-06-05 06:49:36 +00:00
|
|
|
if mouse_button_input.just_pressed(MouseButton::Left) {
|
2020-06-05 06:57:39 +00:00
|
|
|
println!("left mouse just pressed");
|
2020-06-05 06:49:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if mouse_button_input.just_released(MouseButton::Left) {
|
2020-06-05 06:57:39 +00:00
|
|
|
println!("left mouse just released");
|
2020-06-05 06:49:36 +00:00
|
|
|
}
|
|
|
|
}
|