diff options
| author | Freya Murphy <freya@freyacat.org> | 2025-11-30 15:11:29 -0500 |
|---|---|---|
| committer | Freya Murphy <freya@freyacat.org> | 2025-11-30 15:11:29 -0500 |
| commit | cf1e13a328f962a760757f31f86ce5bc248c72a3 (patch) | |
| tree | 3f0ae469423ad7cd1fbc1b9efef672d7b7d39137 /game/src/lib.rs | |
| parent | audio: make sounds! woah (diff) | |
| download | DungeonCrawl-cf1e13a328f962a760757f31f86ce5bc248c72a3.tar.gz DungeonCrawl-cf1e13a328f962a760757f31f86ce5bc248c72a3.tar.bz2 DungeonCrawl-cf1e13a328f962a760757f31f86ce5bc248c72a3.zip | |
game: add more debug keys
Diffstat (limited to 'game/src/lib.rs')
| -rw-r--r-- | game/src/lib.rs | 34 |
1 files changed, 26 insertions, 8 deletions
diff --git a/game/src/lib.rs b/game/src/lib.rs index 6e09a37..a5a07ba 100644 --- a/game/src/lib.rs +++ b/game/src/lib.rs @@ -103,19 +103,37 @@ impl Game { } } + fn handle_misc_input(&mut self) { + // Handle debug keys + if self.window.is_key_pressed(Key::F3) { + self.window.toggle_debug(); + } + if self.window.is_key_pressed(Key::F4) { + *self.dungeon.floor.get_mut(self.dungeon.player.entity.pos) = + Tile::Chest(Some(Item::Bomb)); + } + if self.window.is_key_pressed(Key::F5) { + self.dungeon + .msg + .set_message("Lorem ipsum dolor sit amet, consectetur adipiscing elit."); + } + if self.window.is_key_pressed(Key::F6) { + self.dungeon.player.entity.health = 0; + } + + // handle fulscreen + if self.window.is_key_pressed(Key::F11) { + self.window.toggle_fullscreen(); + } + } + pub fn run(&mut self) { play_sound!(self, &self.music.background); // Main game loop while self.window.is_open() { - // Handle debug keys - if self.window.is_key_pressed(Key::F3) { - self.window.toggle_debug(); - } - if self.window.is_key_pressed(Key::F4) { - *self.dungeon.floor.get_mut(self.dungeon.player.entity.pos) = - Tile::Chest(Some(Item::Bomb)); - } + // Handle misc input + self.handle_misc_input(); // Update game state let inputs = self.get_player_input(); |