use bevy::prelude::*;
#[derive(Debug, Clone, Default)]
pub struct ControllerPlugin {
pub icon_base_path: Option<String>,
}
impl ControllerPlugin {
pub fn with_icon_path(icon_path: impl Into<String>) -> Self {
Self {
icon_base_path: Some(icon_path.into()),
}
}
}
impl Plugin for ControllerPlugin {
fn build(&self, app: &mut App) {
crate::config::register_config_types(app);
crate::detection::register_detection_types(app);
crate::actions::register_action_types(app);
crate::icons::register_icon_types(app);
crate::virtual_cursor::register_virtual_cursor_types(app);
crate::haptics::register_haptics_types(app);
crate::input_buffer::register_input_buffer_types(app);
crate::multiplayer::register_multiplayer_types(app);
crate::gyro::register_gyro_types(app);
crate::touchpad::register_touchpad_types(app);
crate::action_modifiers::register_action_modifier_types(app);
crate::profiles::register_profile_types(app);
crate::debug::register_debug_types(app);
if let Some(path) = &self.icon_base_path {
app.insert_resource(crate::icons::ControllerIconAssets::new(path.clone()));
}
crate::detection::add_detection_systems(app);
crate::actions::add_action_systems(app);
crate::icons::add_icon_systems(app);
crate::virtual_cursor::add_virtual_cursor_systems(app);
crate::haptics::add_haptics_systems(app);
crate::input_buffer::add_input_buffer_systems(app);
crate::multiplayer::add_multiplayer_systems(app);
crate::gyro::add_gyro_systems(app);
crate::touchpad::add_touchpad_systems(app);
crate::action_modifiers::add_action_modifier_systems(app);
crate::profiles::add_profile_systems(app);
crate::debug::add_debug_systems(app);
#[cfg(feature = "remapping")]
crate::remapping::add_remapping_systems(app);
#[cfg(feature = "virtual_keyboard")]
crate::virtual_keyboard::add_virtual_keyboard_systems(app);
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, SystemSet)]
pub enum ControllerSystemSet {
Detection,
Actions,
UI,
}