1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// publics 
pub mod axis;
pub mod inputmap;
pub mod util;
pub mod bindings;
pub mod stack;

// crates
mod action;
mod keyboard;
mod mouse;

use crate::inputmap::InputMap;
use bevy_app::prelude::*;
use bevy_ecs::IntoQuerySystem;

#[derive(Default)]
pub struct InputMapPlugin;

impl Plugin for InputMapPlugin {
    fn build(&self, app: &mut AppBuilder) {
        app
            // input map
            .init_resource::<InputMap>()
            .add_system_to_stage(stage::EVENT_UPDATE, InputMap::action_reset_system.system())
            // // keyboard
            .add_system_to_stage(stage::UPDATE, InputMap::kb_key_press_input_system.system())
            // // mouse
            .add_system_to_stage(stage::UPDATE, InputMap::mouse_button_press_input_system.system())
            .add_system_to_stage(stage::UPDATE, InputMap::mouse_move_event_system.system());
    }
}