summaryrefslogtreecommitdiff
path: root/game/src/main.rs
diff options
context:
space:
mode:
Diffstat (limited to 'game/src/main.rs')
-rw-r--r--game/src/main.rs14
1 files changed, 7 insertions, 7 deletions
diff --git a/game/src/main.rs b/game/src/main.rs
index 6905fe3..9449710 100644
--- a/game/src/main.rs
+++ b/game/src/main.rs
@@ -6,7 +6,7 @@ struct Game {
window: Window,
dungeon: Dungeon,
// to ensure the most recently-pressed direction key is used:
- current_dir: Option<(Direction, KeyCode)>,
+ current_dir: Option<(Direction, Key)>,
}
impl Game {
@@ -21,11 +21,11 @@ impl Game {
}
fn player_dir(&mut self) -> Option<Direction> {
- const MOVE_KEYS: [(Direction, [KeyCode; 2]); 4] = [
- (Direction::North, [KeyCode::KEY_UP, KeyCode::KEY_W]),
- (Direction::West, [KeyCode::KEY_LEFT, KeyCode::KEY_A]),
- (Direction::South, [KeyCode::KEY_DOWN, KeyCode::KEY_S]),
- (Direction::East, [KeyCode::KEY_RIGHT, KeyCode::KEY_D]),
+ const MOVE_KEYS: [(Direction, [Key; 2]); 4] = [
+ (Direction::North, [Key::Up, Key::W]),
+ (Direction::West, [Key::Left, Key::A]),
+ (Direction::South, [Key::Down, Key::S]),
+ (Direction::East, [Key::Right, Key::D]),
];
// if a key was just pressed, use it for the new direction to move in
@@ -59,7 +59,7 @@ impl Game {
// Main game loop
while self.window.is_open() {
// Handle keyboard input
- if self.window.is_key_pressed(KeyCode::KEY_F3) {
+ if self.window.is_key_pressed(Key::F3) {
self.window.toggle_debug();
}