use bevy::{ input::mouse::{MouseButtonInput, MouseMotion, MouseWheel}, prelude::*, window::CursorMoved, }; fn main() { App::build() .add_default_plugins() .init_resource::() .add_system(print_mouse_events_system.system()) .run(); } #[derive(Default)] struct State { mouse_button_event_reader: EventReader, mouse_motion_event_reader: EventReader, cursor_moved_event_reader: EventReader, mouse_wheel_event_reader: EventReader, } /// This system prints out all mouse events as they come in fn print_mouse_events_system( mut state: ResMut, mouse_button_input_events: Res>, mouse_motion_events: Res>, cursor_moved_events: Res>, mouse_wheel_events: Res>, ) { for event in state .mouse_button_event_reader .iter(&mouse_button_input_events) { println!("{:?}", event); } for event in state.mouse_motion_event_reader.iter(&mouse_motion_events) { println!("{:?}", event); } for event in state.cursor_moved_event_reader.iter(&cursor_moved_events) { println!("{:?}", event); } for event in state.mouse_wheel_event_reader.iter(&mouse_wheel_events) { println!("{:?}", event); } }