Compare commits

..

No commits in common. "master" and "v0.1.8" have entirely different histories.

2 changed files with 14 additions and 30 deletions

View File

@ -60,7 +60,6 @@ pub struct Buttons {
pub b: String, pub b: String,
pub x: String, pub x: String,
pub y: String, pub y: String,
pub start: String,
pub l: String, pub l: String,
pub r: String, pub r: String,
} }
@ -121,7 +120,6 @@ fn build_config_std() -> Config {
b: env::var("INPUT_GUI_BUTTON_B").unwrap_or(String::from("2")), b: env::var("INPUT_GUI_BUTTON_B").unwrap_or(String::from("2")),
x: env::var("INPUT_GUI_BUTTON_X").unwrap_or(String::from("3")), x: env::var("INPUT_GUI_BUTTON_X").unwrap_or(String::from("3")),
y: env::var("INPUT_GUI_BUTTON_Y").unwrap_or(String::from("4")), 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")), l: env::var("INPUT_GUI_BUTTON_L").unwrap_or(String::from("q")),
r: env::var("INPUT_GUI_BUTTON_R").unwrap_or(String::from("e")), r: env::var("INPUT_GUI_BUTTON_R").unwrap_or(String::from("e")),
}, },

View File

@ -29,7 +29,7 @@ pub fn main(cfg: GUI, output_stream: Box<dyn OutputStream>) -> iced::Result {
text_multithreading: def.text_multithreading, text_multithreading: def.text_multithreading,
try_opengles_first: def.try_opengles_first, try_opengles_first: def.try_opengles_first,
window: iced::window::Settings{ window: iced::window::Settings{
size: (300, 900), size: (300, 720),
position: iced::window::Position::Specific(0, 0), position: iced::window::Position::Specific(0, 0),
..iced::window::Settings::default() ..iced::window::Settings::default()
}, },
@ -63,7 +63,6 @@ struct Inputs {
b: iced::keyboard::KeyCode, b: iced::keyboard::KeyCode,
x: iced::keyboard::KeyCode, x: iced::keyboard::KeyCode,
y: iced::keyboard::KeyCode, y: iced::keyboard::KeyCode,
start: iced::keyboard::KeyCode,
l: iced::keyboard::KeyCode, l: iced::keyboard::KeyCode,
r: iced::keyboard::KeyCode, r: iced::keyboard::KeyCode,
} }
@ -90,7 +89,6 @@ enum Message {
B, B,
X, X,
Y, Y,
Start,
L, L,
R, R,
} }
@ -117,7 +115,6 @@ impl Main {
_ if key_code == &self.inputs.b => Some(&self.flags.cfg.buttons.b), _ 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.x => Some(&self.flags.cfg.buttons.x),
_ if key_code == &self.inputs.y => Some(&self.flags.cfg.buttons.y), _ 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.l => Some(&self.flags.cfg.buttons.l),
_ if key_code == &self.inputs.r => Some(&self.flags.cfg.buttons.r), _ if key_code == &self.inputs.r => Some(&self.flags.cfg.buttons.r),
_ => None, _ => None,
@ -145,9 +142,7 @@ impl Main {
match self.feedback_recv_c.try_recv() { match self.feedback_recv_c.try_recv() {
Ok(msg) => { Ok(msg) => {
match msg { match msg {
Feedback::Heard(msg) => { Feedback::Heard(msg) => self.ntfy_from_server = msg,
self.ntfy_from_server = msg;
},
_ => break, _ => break,
}; };
}, },
@ -248,7 +243,6 @@ impl Application for Main {
b: iced::keyboard::KeyCode::Key2, b: iced::keyboard::KeyCode::Key2,
x: iced::keyboard::KeyCode::Key3, x: iced::keyboard::KeyCode::Key3,
y: iced::keyboard::KeyCode::Key4, y: iced::keyboard::KeyCode::Key4,
start: iced::keyboard::KeyCode::Key5,
l: iced::keyboard::KeyCode::Q, l: iced::keyboard::KeyCode::Q,
r: iced::keyboard::KeyCode::E, r: iced::keyboard::KeyCode::E,
}, },
@ -297,7 +291,6 @@ impl Application for Main {
Message::B => { self.inputs.b = key_code }, Message::B => { self.inputs.b = key_code },
Message::X => { self.inputs.x = key_code }, Message::X => { self.inputs.x = key_code },
Message::Y => { self.inputs.y = key_code }, Message::Y => { self.inputs.y = key_code },
Message::Start => { self.inputs.start = key_code },
Message::L => { self.inputs.l = key_code }, Message::L => { self.inputs.l = key_code },
Message::R => { self.inputs.r = key_code }, Message::R => { self.inputs.r = key_code },
_ => {}, _ => {},
@ -364,7 +357,7 @@ impl Application for Main {
}, },
_ => None, _ => None,
}), }),
every(std::time::Duration::from_millis(2000)).map(|_| Message::Tick), every(std::time::Duration::from_millis(5000)).map(|_| Message::Tick),
]); ]);
} }
@ -376,23 +369,16 @@ impl Application for Main {
column![ column![
text(String::from("Button Mapping")).size(24), text(String::from("Button Mapping")).size(24),
text(String::from("--------------")).size(24), text(String::from("--------------")).size(24),
row![ new_cfg_button(Message::Up, self.inputs.stick.up),
column![ new_cfg_button(Message::Down, self.inputs.stick.down),
new_cfg_button(Message::Up, self.inputs.stick.up), new_cfg_button(Message::Left, self.inputs.stick.left),
new_cfg_button(Message::Down, self.inputs.stick.down), new_cfg_button(Message::Right, self.inputs.stick.right),
new_cfg_button(Message::Left, self.inputs.stick.left), new_cfg_button(Message::A, self.inputs.a),
new_cfg_button(Message::Right, self.inputs.stick.right), new_cfg_button(Message::B, self.inputs.b),
new_cfg_button(Message::Start, self.inputs.start), new_cfg_button(Message::X, self.inputs.x),
].padding(5).align_items(Alignment::Center), new_cfg_button(Message::Y, self.inputs.y),
column![ new_cfg_button(Message::L, self.inputs.l),
new_cfg_button(Message::A, self.inputs.a), new_cfg_button(Message::R, self.inputs.r),
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::L, self.inputs.l),
new_cfg_button(Message::R, self.inputs.r),
].padding(5).align_items(Alignment::Center),
].padding(5).align_items(Alignment::Center),
text(String::from("--------------")).size(24), text(String::from("--------------")).size(24),
text(self.ntfy_from_client.clone()).size(18), text(self.ntfy_from_client.clone()).size(18),
].padding(20).align_items(Alignment::Center), ].padding(20).align_items(Alignment::Center),
@ -406,7 +392,7 @@ impl Application for Main {
button(text("Say")).on_press(Message::InputTextEntrySubmitSay).padding(20), button(text("Say")).on_press(Message::InputTextEntrySubmitSay).padding(20),
button(text("Send")).on_press(Message::InputTextEntrySubmitSend).padding(20), button(text("Send")).on_press(Message::InputTextEntrySubmitSend).padding(20),
].padding(20).align_items(Alignment::Center), ].padding(20).align_items(Alignment::Center),
text(self.ntfy_from_server.clone().trim()).size(18), text(self.ntfy_from_server.clone()).size(18),
].padding(20).align_items(Alignment::Center), ].padding(20).align_items(Alignment::Center),
].padding(0).align_items(Alignment::Center), ].padding(0).align_items(Alignment::Center),
].padding(0).align_items(Alignment::Center).into(); ].padding(0).align_items(Alignment::Center).into();