2020-06-05 05:48:53 +00:00
|
|
|
mod input;
|
2020-04-04 21:59:49 +00:00
|
|
|
pub mod keyboard;
|
2020-04-05 06:42:39 +00:00
|
|
|
pub mod mouse;
|
2020-04-19 19:13:04 +00:00
|
|
|
pub mod system;
|
2020-04-04 21:59:49 +00:00
|
|
|
|
2020-06-05 05:48:53 +00:00
|
|
|
pub use input::*;
|
|
|
|
|
2020-04-06 03:19:02 +00:00
|
|
|
use bevy_app::{AppBuilder, AppPlugin};
|
2020-04-04 21:59:49 +00:00
|
|
|
use keyboard::KeyboardInput;
|
2020-04-30 20:52:11 +00:00
|
|
|
use mouse::{MouseButtonInput, MouseMotionInput};
|
2020-06-05 05:48:53 +00:00
|
|
|
use legion::prelude::IntoSystem;
|
2020-04-04 21:59:49 +00:00
|
|
|
|
|
|
|
#[derive(Default)]
|
|
|
|
pub struct InputPlugin;
|
|
|
|
|
|
|
|
impl AppPlugin for InputPlugin {
|
2020-04-06 03:19:02 +00:00
|
|
|
fn build(&self, app: &mut AppBuilder) {
|
2020-04-04 21:59:49 +00:00
|
|
|
app.add_event::<KeyboardInput>()
|
2020-04-05 07:32:53 +00:00
|
|
|
.add_event::<MouseButtonInput>()
|
2020-06-05 05:48:53 +00:00
|
|
|
.add_event::<MouseMotionInput>()
|
|
|
|
.init_resource::<Input>()
|
|
|
|
.init_resource::<InputState>()
|
|
|
|
.add_system_to_stage(bevy_app::stage::EVENT_UPDATE, input_system.system());
|
2020-04-04 21:59:49 +00:00
|
|
|
}
|
|
|
|
}
|