Skip to content

Commit

Permalink
Support more keys
Browse files Browse the repository at this point in the history
  • Loading branch information
aelred committed Sep 30, 2024
1 parent 34d362c commit d7166bc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/runtime/sdl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,9 @@ impl Runtime for Sdl {

fn keycode_binding(keycode: Keycode) -> Buttons {
match keycode {
Keycode::Z => Buttons::A,
Keycode::X => Buttons::B,
Keycode::RShift => Buttons::SELECT,
Keycode::Z | Keycode::A => Buttons::A,
Keycode::X | Keycode::S => Buttons::B,
Keycode::RShift | Keycode::LShift => Buttons::SELECT,
Keycode::Return => Buttons::START,
Keycode::Up => Buttons::UP,
Keycode::Down => Buttons::DOWN,
Expand Down
6 changes: 3 additions & 3 deletions src/runtime/web.rs
Original file line number Diff line number Diff line change
Expand Up @@ -197,9 +197,9 @@ struct NesContext {

fn keycode_binding(keycode: &str) -> Buttons {
match keycode {
"KeyZ" => Buttons::A,
"KeyX" => Buttons::B,
"ShiftRight" => Buttons::SELECT,
"KeyZ" | "KeyA" => Buttons::A,
"KeyX" | "KeyS" => Buttons::B,
"ShiftRight" | "ShiftLeft" => Buttons::SELECT,
"Enter" => Buttons::START,
"ArrowUp" => Buttons::UP,
"ArrowDown" => Buttons::DOWN,
Expand Down

0 comments on commit d7166bc

Please sign in to comment.