From 71add6cfc610060fd836101bc34825b1b2ccf7ef Mon Sep 17 00:00:00 2001 From: milk Date: Tue, 7 May 2024 14:04:58 +0200 Subject: [PATCH] set inputs as scancodes instead of u32 --- src/config.rs | 25 +++++++++++++------------ src/main.rs | 2 +- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/src/config.rs b/src/config.rs index 4d899f3..c21126f 100644 --- a/src/config.rs +++ b/src/config.rs @@ -20,24 +20,24 @@ pub struct InputConfigs {} #[derive(Deserialize, Serialize)] pub struct KeyboardConfig { // directionals - Up: u32, - Down: u32, - Right: u32, - Left: u32, + Up: ScanCodes, + Down: ScanCodes, + Right: ScanCodes, + Left: ScanCodes, // the punches - LightPunch: u32, - MediumPunch: u32, - HeavyPunch: u32, + LightPunch: ScanCodes, + MediumPunch: ScanCodes, + HeavyPunch: ScanCodes, // the kicks - LightKick: u32, - MediumKick: u32, - HeavyKick: u32, + LightKick: ScanCodes, + MediumKick: ScanCodes, + HeavyKick: ScanCodes, // Macros - PunchMacro: u32, - KickMacro: u32, + PunchMacro: ScanCodes, + KickMacro: ScanCodes, } impl Default for KeyboardConfig { @@ -64,6 +64,7 @@ impl Default for KeyboardConfig { /// TODO finish this /// UNTESTED AND UNFINISHED #[repr(u32)] +#[derive(Serialize, Deserialize)] pub enum ScanCodes { Escape = 0x01, Key1 = 0x02, diff --git a/src/main.rs b/src/main.rs index a9d848d..2389eac 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,4 +1,3 @@ -use std::rc::Rc; use std::sync::Arc; use std::thread; use std::time::{Duration, Instant}; @@ -18,6 +17,7 @@ use glutin::{context::Version, prelude::*}; use glutin_winit::DisplayBuilder; use glutin_winit::{self, GlWindow}; +pub mod config; pub mod gui; pub mod renderer; fn main() {