bevy/crates/bevy_gilrs/src/lib.rs

26 lines
748 B
Rust
Raw Normal View History

mod converter;
mod gilrs_system;
use bevy_app::prelude::*;
2020-10-12 22:09:44 +00:00
use bevy_ecs::prelude::*;
use gilrs_system::{gilrs_startup_system, gilrs_update_system};
#[derive(Default)]
pub struct GilrsPlugin;
impl Plugin for GilrsPlugin {
fn build(&self, app: &mut AppBuilder) {
match gilrs::Gilrs::new() {
Ok(gilrs) => {
2020-10-12 22:09:44 +00:00
app.add_thread_local_resource(gilrs)
.add_startup_system(gilrs_startup_system.thread_local_system())
.add_system_to_stage(
stage::EVENT_UPDATE,
gilrs_update_system.thread_local_system(),
);
}
Err(err) => log::error!("Failed to start Gilrs. {}", err),
}
}
}