gilrs test

master
Milk.H 2024-05-07 15:51:17 +02:00
parent fe95327ca8
commit 15c75d8baf
Signed by: milk
GPG Key ID: 1C656AF758F96101
1 changed files with 13 additions and 1 deletions

View File

@ -3,6 +3,7 @@ use std::thread;
use std::time::{Duration, Instant}; use std::time::{Duration, Instant};
use egui_glow::EguiGlow; use egui_glow::EguiGlow;
use gilrs::Gilrs;
use glow::HasContext; use glow::HasContext;
use bevy_ecs::prelude::*; use bevy_ecs::prelude::*;
@ -128,7 +129,7 @@ fn main() {
gl.blend_func(glow::ONE, glow::ZERO); 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 world = World::new();
let mut schedule = Schedule::default(); let mut schedule = Schedule::default();
@ -142,9 +143,20 @@ fn main() {
let _ = world.run_system(init_defaults); let _ = world.run_system(init_defaults);
let _ = world.run_system(initialize_test); let _ = world.run_system(initialize_test);
// NOTE gilrs
let mut gilrs = Gilrs::new().unwrap();
let _ = event_loop.run(move |event, _, control_flow| { let _ = event_loop.run(move |event, _, control_flow| {
// new_frame for Framerate Locking // new_frame for Framerate Locking
let new_frame = Instant::now() + Duration::from_secs_f32(1.0 / 60.0); 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 { match event {
Event::WindowEvent { event, .. } => { Event::WindowEvent { event, .. } => {
if gui.passEvent(&event) == false { if gui.passEvent(&event) == false {