From 26e63c769d17dcc9a866f83eaa092e3593f9e183 Mon Sep 17 00:00:00 2001 From: milk Date: Mon, 13 May 2024 16:10:24 +0200 Subject: [PATCH] Added extra Traits and Added input manager module --- src/config.rs | 8 ++++---- src/input.rs | 5 +++++ src/main.rs | 1 + 3 files changed, 10 insertions(+), 4 deletions(-) create mode 100644 src/input.rs diff --git a/src/config.rs b/src/config.rs index 6666839..e476648 100644 --- a/src/config.rs +++ b/src/config.rs @@ -15,7 +15,7 @@ pub struct DisplayConfigs { // i think thats it tbqh } -#[derive(Deserialize, Serialize, Debug, Default)] +#[derive(Deserialize, Serialize, Debug, Default, Clone)] pub struct InputConfigs { keyboard_single: KeyboardConfig, //Keyboard_duo_1: KeyboardConfig, @@ -27,7 +27,7 @@ pub struct InputConfigs { pub Controller5: Option, } -#[derive(Deserialize, Serialize, Debug)] +#[derive(Deserialize, Serialize, Debug, Clone)] pub struct ControllerConfig { // directionals pub Up: Button, @@ -71,7 +71,7 @@ impl Default for ControllerConfig { } } } -#[derive(Deserialize, Serialize, Debug)] +#[derive(Deserialize, Serialize, Debug, Clone)] pub struct KeyboardConfig { // directionals pub Up: ScanCodes, @@ -118,7 +118,7 @@ impl Default for KeyboardConfig { /// TODO finish this /// UNTESTED AND UNFINISHED #[repr(u32)] -#[derive(Serialize, Deserialize, Debug)] +#[derive(Serialize, Deserialize, Debug, Clone)] pub enum ScanCodes { Escape = 0x01, Key1 = 0x02, diff --git a/src/input.rs b/src/input.rs new file mode 100644 index 0000000..f51b337 --- /dev/null +++ b/src/input.rs @@ -0,0 +1,5 @@ +use super::config::InputConfigs; + +struct InputInterpreter { + input_config: InputConfigs, +} diff --git a/src/main.rs b/src/main.rs index 67bd662..2bacb6c 100644 --- a/src/main.rs +++ b/src/main.rs @@ -21,6 +21,7 @@ use glutin_winit::{self, GlWindow}; pub mod config; pub mod gui; +pub mod input; pub mod renderer; fn main() { // NOTE initialization code here