gamebridge: multiple commands per line

This commit is contained in:
Cadey Ratio 2020-05-09 11:00:46 -04:00
parent 09f51531cc
commit 902c98451b
2 changed files with 4 additions and 2 deletions

View File

@ -150,7 +150,7 @@ fn main() -> Result<()> {
lo = lo | LoButtons::C_RIGHT; lo = lo | LoButtons::C_RIGHT;
} }
println!( debug!(
"[ rust] {:02x}{:02x} {:02x}{:02x}", "[ rust] {:02x}{:02x} {:02x}{:02x}",
hi.bits(), hi.bits(),
lo.bits(), lo.bits(),

View File

@ -82,7 +82,8 @@ async fn run_loop(
let mut data = st.write().unwrap(); let mut data = st.write().unwrap();
const BUTTON_ADD_AMT: i64 = 64; const BUTTON_ADD_AMT: i64 = 64;
match chatline.as_str() { for cmd in chatline.to_string().split(" ").collect::<Vec<&str>>().iter() {
match *cmd {
"a" => data.a_button.add(BUTTON_ADD_AMT), "a" => data.a_button.add(BUTTON_ADD_AMT),
"b" => data.b_button.add(BUTTON_ADD_AMT), "b" => data.b_button.add(BUTTON_ADD_AMT),
"z" => data.z_button.add(BUTTON_ADD_AMT), "z" => data.z_button.add(BUTTON_ADD_AMT),
@ -99,6 +100,7 @@ async fn run_loop(
"stop" => {data.stickx.update(0); data.sticky.update(0);}, "stop" => {data.stickx.update(0); data.sticky.update(0);},
_ => {}, _ => {},
} }
}
eprintln!("[{}] {}: {}", msg.channel, msg.name, msg.data); eprintln!("[{}] {}: {}", msg.channel, msg.name, msg.data);
} }