2020-09-18 21:43:47 +00:00
|
|
|
mod converter;
|
|
|
|
mod gilrs_system;
|
|
|
|
|
|
|
|
use bevy_app::prelude::*;
|
2020-10-12 22:09:44 +00:00
|
|
|
use bevy_ecs::prelude::*;
|
2020-10-21 17:27:00 +00:00
|
|
|
use gilrs::GilrsBuilder;
|
2020-10-21 22:56:07 +00:00
|
|
|
use gilrs_system::gilrs_event_system;
|
2020-09-18 21:43:47 +00:00
|
|
|
|
|
|
|
#[derive(Default)]
|
|
|
|
pub struct GilrsPlugin;
|
|
|
|
|
|
|
|
impl Plugin for GilrsPlugin {
|
|
|
|
fn build(&self, app: &mut AppBuilder) {
|
2020-10-21 17:27:00 +00:00
|
|
|
match GilrsBuilder::new()
|
|
|
|
.with_default_filters(false)
|
|
|
|
.set_update_state(false)
|
|
|
|
.build()
|
|
|
|
{
|
2020-09-18 21:43:47 +00:00
|
|
|
Ok(gilrs) => {
|
2020-10-12 22:09:44 +00:00
|
|
|
app.add_thread_local_resource(gilrs)
|
2020-10-21 22:56:07 +00:00
|
|
|
.add_startup_system(gilrs_event_system.thread_local_system())
|
|
|
|
.add_system_to_stage(
|
|
|
|
stage::PRE_EVENT,
|
|
|
|
gilrs_event_system.thread_local_system(),
|
|
|
|
);
|
2020-09-18 21:43:47 +00:00
|
|
|
}
|
|
|
|
Err(err) => log::error!("Failed to start Gilrs. {}", err),
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|