master
Bel LaPointe 2023-03-23 10:53:16 -06:00
parent 5e5891fe7c
commit 321630a945
2 changed files with 20 additions and 1 deletions

View File

@ -192,6 +192,10 @@ pub trait OutputEngine {
}
pub fn build_output_engine(cfg: &Engine) -> Box<dyn OutputEngine> {
return _build_output_engine(cfg)
}
pub fn _build_output_engine(cfg: &Engine) -> Box<dyn OutputEngine> {
if cfg.name.as_str() == "stdout" {
return Box::new(OutputEngineStdout{});
} else if cfg.name.as_str() == "udp" {

View File

@ -139,7 +139,22 @@ impl Application for Main {
modifiers: _,
..
}) => {
println!("pushed {:?}", key_code);
let s = match key_code {
_ if key_code == self.inputs.stick.up => String::from("up"),
_ if key_code == self.inputs.stick.down => String::from("down"),
_ if key_code == self.inputs.stick.left => String::from("left"),
_ if key_code == self.inputs.stick.right => String::from("right"),
_ if key_code == self.inputs.a => String::from("a"),
_ if key_code == self.inputs.b => String::from("b"),
_ if key_code == self.inputs.x => String::from("x"),
_ if key_code == self.inputs.y => String::from("y"),
_ if key_code == self.inputs.l => String::from("l"),
_ if key_code == self.inputs.r => String::from("r"),
_ => String::from(""),
};
if s.len() > 0 {
self.flags.outputEngine.put(s.chars().collect());
}
},
_ => {},
}