index : snake-rs
An implementation of the classic Snake game in Rust using SDL2
about summary refs log tree commit diff
author y2w8 <yousefalharby416@gmail.com> 2026-02-08 17:39:48 +0300
committer y2w8 <yousefalharby416@gmail.com> 2026-02-08 17:39:48 +0300
commit 5e84268613957bb4186462c25bc9ddec08723115 [patch]
tree 690c3133548e60680021299b07919dfe919c31c8
parent efcf2da2d5433d6f1be2fff62dedffb2e3ebaff4
download 5e84268613957bb4186462c25bc9ddec08723115.tar.gz

Add arrow mapping

Diffstat

-rw-r--r-- src/app.rs 8
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/app.rs b/src/app.rs
index 7052abf..e1b0662 100644
--- a/src/app.rs
+++ b/src/app.rs
@@ -35,10 +35,10 @@
                        keycode: Some(keycode),
                        ..
                    } => match keycode {
                        Keycode::W => self.game_context.move_up(),
                        Keycode::A => self.game_context.move_left(),
                        Keycode::S => self.game_context.move_down(),
                        Keycode::D => self.game_context.move_right(),
                        Keycode::W | Keycode::Up => self.game_context.move_up(),
                        Keycode::A | Keycode::Left => self.game_context.move_left(),
                        Keycode::S | Keycode::Down => self.game_context.move_down(),
                        Keycode::D | Keycode::Right => self.game_context.move_right(),
                        Keycode::Escape => self.game_context.toggle_pause(),
                        _ => {}
                    },