From 15c75d8baf085db21745117c84a4dc9960b3cd7c Mon Sep 17 00:00:00 2001 From: milk Date: Tue, 7 May 2024 15:51:17 +0200 Subject: [PATCH] gilrs test --- src/main.rs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index 2389eac..1683cc5 100644 --- a/src/main.rs +++ b/src/main.rs @@ -3,6 +3,7 @@ use std::thread; use std::time::{Duration, Instant}; use egui_glow::EguiGlow; +use gilrs::Gilrs; use glow::HasContext; use bevy_ecs::prelude::*; @@ -128,7 +129,7 @@ fn main() { gl.blend_func(glow::ONE, glow::ZERO); } - // TODO write bevy Init code here + // NOTE bevy Init code here let mut world = World::new(); let mut schedule = Schedule::default(); @@ -142,9 +143,20 @@ fn main() { let _ = world.run_system(init_defaults); let _ = world.run_system(initialize_test); + // NOTE gilrs + let mut gilrs = Gilrs::new().unwrap(); + let _ = event_loop.run(move |event, _, control_flow| { // new_frame for Framerate Locking let new_frame = Instant::now() + Duration::from_secs_f32(1.0 / 60.0); + + // NOTE process controllers + // TESTING + // TODO + + while let Some(Event { id, event, time }) = gilrs.next_event() { + println!("{:?} New Event from {}: {:?}", time, id, event); + } match event { Event::WindowEvent { event, .. } => { if gui.passEvent(&event) == false {