bevy/crates/bevy_gilrs/src/lib.rs
Christopher Durham 997eae6185 Remove double Events::update in bevy-gilrs (#2894)
# Objective

- Remove duplicate `Events::update` call in `gilrs_event_system` (fixes #2893)
  - See #2893 for context
- While there, make the systems no longer exclusive, as that is not required of them

## Solution

- Do the change

r? @alice-i-cecile
2021-10-08 00:37:08 +00:00

30 lines
903 B
Rust

mod converter;
mod gilrs_system;
use bevy_app::{App, CoreStage, Plugin, StartupStage};
use bevy_utils::tracing::error;
use gilrs::GilrsBuilder;
use gilrs_system::{gilrs_event_startup_system, gilrs_event_system};
#[derive(Default)]
pub struct GilrsPlugin;
impl Plugin for GilrsPlugin {
fn build(&self, app: &mut App) {
match GilrsBuilder::new()
.with_default_filters(false)
.set_update_state(false)
.build()
{
Ok(gilrs) => {
app.insert_non_send_resource(gilrs)
.add_startup_system_to_stage(
StartupStage::PreStartup,
gilrs_event_startup_system,
)
.add_system_to_stage(CoreStage::PreUpdate, gilrs_event_system);
}
Err(err) => error!("Failed to start Gilrs. {}", err),
}
}
}