parent
37566c4413
commit
324a7b07b0
|
|
@ -60,6 +60,7 @@ pub struct Buttons {
|
|||
pub b: String,
|
||||
pub x: String,
|
||||
pub y: String,
|
||||
pub start: String,
|
||||
pub l: String,
|
||||
pub r: String,
|
||||
}
|
||||
|
|
@ -120,6 +121,7 @@ fn build_config_std() -> Config {
|
|||
b: env::var("INPUT_GUI_BUTTON_B").unwrap_or(String::from("2")),
|
||||
x: env::var("INPUT_GUI_BUTTON_X").unwrap_or(String::from("3")),
|
||||
y: env::var("INPUT_GUI_BUTTON_Y").unwrap_or(String::from("4")),
|
||||
start: env::var("INPUT_GUI_BUTTON_START").unwrap_or(String::from("5")),
|
||||
l: env::var("INPUT_GUI_BUTTON_L").unwrap_or(String::from("q")),
|
||||
r: env::var("INPUT_GUI_BUTTON_R").unwrap_or(String::from("e")),
|
||||
},
|
||||
|
|
|
|||
|
|
@ -63,6 +63,7 @@ struct Inputs {
|
|||
b: iced::keyboard::KeyCode,
|
||||
x: iced::keyboard::KeyCode,
|
||||
y: iced::keyboard::KeyCode,
|
||||
start: iced::keyboard::KeyCode,
|
||||
l: iced::keyboard::KeyCode,
|
||||
r: iced::keyboard::KeyCode,
|
||||
}
|
||||
|
|
@ -89,6 +90,7 @@ enum Message {
|
|||
B,
|
||||
X,
|
||||
Y,
|
||||
Start,
|
||||
L,
|
||||
R,
|
||||
}
|
||||
|
|
@ -115,6 +117,7 @@ impl Main {
|
|||
_ if key_code == &self.inputs.b => Some(&self.flags.cfg.buttons.b),
|
||||
_ if key_code == &self.inputs.x => Some(&self.flags.cfg.buttons.x),
|
||||
_ if key_code == &self.inputs.y => Some(&self.flags.cfg.buttons.y),
|
||||
_ if key_code == &self.inputs.start => Some(&self.flags.cfg.buttons.start),
|
||||
_ if key_code == &self.inputs.l => Some(&self.flags.cfg.buttons.l),
|
||||
_ if key_code == &self.inputs.r => Some(&self.flags.cfg.buttons.r),
|
||||
_ => None,
|
||||
|
|
@ -243,6 +246,7 @@ impl Application for Main {
|
|||
b: iced::keyboard::KeyCode::Key2,
|
||||
x: iced::keyboard::KeyCode::Key3,
|
||||
y: iced::keyboard::KeyCode::Key4,
|
||||
start: iced::keyboard::KeyCode::Key5,
|
||||
l: iced::keyboard::KeyCode::Q,
|
||||
r: iced::keyboard::KeyCode::E,
|
||||
},
|
||||
|
|
@ -291,6 +295,7 @@ impl Application for Main {
|
|||
Message::B => { self.inputs.b = key_code },
|
||||
Message::X => { self.inputs.x = key_code },
|
||||
Message::Y => { self.inputs.y = key_code },
|
||||
Message::Start => { self.inputs.start = key_code },
|
||||
Message::L => { self.inputs.l = key_code },
|
||||
Message::R => { self.inputs.r = key_code },
|
||||
_ => {},
|
||||
|
|
@ -377,6 +382,7 @@ impl Application for Main {
|
|||
new_cfg_button(Message::B, self.inputs.b),
|
||||
new_cfg_button(Message::X, self.inputs.x),
|
||||
new_cfg_button(Message::Y, self.inputs.y),
|
||||
new_cfg_button(Message::Start, self.inputs.start),
|
||||
new_cfg_button(Message::L, self.inputs.l),
|
||||
new_cfg_button(Message::R, self.inputs.r),
|
||||
text(String::from("--------------")).size(24),
|
||||
|
|
|
|||
Loading…
Reference in New Issue