Added extra Traits and Added input manager module

master
Milk.H 2024-05-13 16:10:24 +02:00
parent bee9ae2a41
commit 26e63c769d
Signed by: milk
GPG Key ID: 1C656AF758F96101
3 changed files with 10 additions and 4 deletions

View File

@ -15,7 +15,7 @@ pub struct DisplayConfigs {
// i think thats it tbqh // i think thats it tbqh
} }
#[derive(Deserialize, Serialize, Debug, Default)] #[derive(Deserialize, Serialize, Debug, Default, Clone)]
pub struct InputConfigs { pub struct InputConfigs {
keyboard_single: KeyboardConfig, keyboard_single: KeyboardConfig,
//Keyboard_duo_1: KeyboardConfig, //Keyboard_duo_1: KeyboardConfig,
@ -27,7 +27,7 @@ pub struct InputConfigs {
pub Controller5: Option<ControllerConfig>, pub Controller5: Option<ControllerConfig>,
} }
#[derive(Deserialize, Serialize, Debug)] #[derive(Deserialize, Serialize, Debug, Clone)]
pub struct ControllerConfig { pub struct ControllerConfig {
// directionals // directionals
pub Up: Button, pub Up: Button,
@ -71,7 +71,7 @@ impl Default for ControllerConfig {
} }
} }
} }
#[derive(Deserialize, Serialize, Debug)] #[derive(Deserialize, Serialize, Debug, Clone)]
pub struct KeyboardConfig { pub struct KeyboardConfig {
// directionals // directionals
pub Up: ScanCodes, pub Up: ScanCodes,
@ -118,7 +118,7 @@ impl Default for KeyboardConfig {
/// TODO finish this /// TODO finish this
/// UNTESTED AND UNFINISHED /// UNTESTED AND UNFINISHED
#[repr(u32)] #[repr(u32)]
#[derive(Serialize, Deserialize, Debug)] #[derive(Serialize, Deserialize, Debug, Clone)]
pub enum ScanCodes { pub enum ScanCodes {
Escape = 0x01, Escape = 0x01,
Key1 = 0x02, Key1 = 0x02,

5
src/input.rs Normal file
View File

@ -0,0 +1,5 @@
use super::config::InputConfigs;
struct InputInterpreter {
input_config: InputConfigs,
}

View File

@ -21,6 +21,7 @@ use glutin_winit::{self, GlWindow};
pub mod config; pub mod config;
pub mod gui; pub mod gui;
pub mod input;
pub mod renderer; pub mod renderer;
fn main() { fn main() {
// NOTE initialization code here // NOTE initialization code here