From 83e0d1d737a337e94c3e01c99afb2b381b52398c Mon Sep 17 00:00:00 2001 From: Ryan Walters Date: Wed, 10 Sep 2025 22:08:32 -0500 Subject: [PATCH] fix: FruitSprites resource for common tests, disable Exit command bindings on Emscripten, update ROADMAP.md --- ROADMAP.md | 2 +- src/systems/input.rs | 8 ++++++-- tests/common.rs | 7 ++++--- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/ROADMAP.md b/ROADMAP.md index d2c2474..c3a2bb1 100644 --- a/ROADMAP.md +++ b/ROADMAP.md @@ -28,7 +28,7 @@ A comprehensive list of features needed to complete the Pac-Man emulation, organ - [x] Fruit Spawning Mechanics - [x] Spawn at pellet counts 70 and 170 - - [ ] Fruit display in bottom-right corner + - [x] Fruit display in bottom-right corner - [x] Fruit collection and scoring - [x] Bonus point display system diff --git a/src/systems/input.rs b/src/systems/input.rs index fe5e20a..912f78b 100644 --- a/src/systems/input.rs +++ b/src/systems/input.rs @@ -85,8 +85,12 @@ impl Default for Bindings { key_bindings.insert(Keycode::Space, GameCommand::ToggleDebug); key_bindings.insert(Keycode::M, GameCommand::MuteAudio); key_bindings.insert(Keycode::R, GameCommand::ResetLevel); - key_bindings.insert(Keycode::Escape, GameCommand::Exit); - key_bindings.insert(Keycode::Q, GameCommand::Exit); + + #[cfg(not(target_os = "emscripten"))] + { + key_bindings.insert(Keycode::Escape, GameCommand::Exit); + key_bindings.insert(Keycode::Q, GameCommand::Exit); + } let movement_keys = HashSet::from([ Keycode::W, diff --git a/tests/common.rs b/tests/common.rs index ab6e39e..d114742 100644 --- a/tests/common.rs +++ b/tests/common.rs @@ -13,9 +13,9 @@ use pacman::{ graph::{Graph, Node}, }, systems::{ - item_collision_observer, AudioEvent, AudioState, BufferedDirection, Collider, DebugState, DeltaTime, EntityType, Ghost, - GhostCollider, GhostState, GlobalState, ItemCollider, MovementModifiers, PacmanCollider, PelletCount, PlayerControlled, - Position, ScoreResource, Velocity, + item_collision_observer, AudioEvent, AudioState, BufferedDirection, Collider, DebugState, DeltaTime, EntityType, + FruitSprites, Ghost, GhostCollider, GhostState, GlobalState, ItemCollider, MovementModifiers, PacmanCollider, + PelletCount, PlayerControlled, Position, ScoreResource, Velocity, }, texture::sprite::{AtlasMapper, AtlasTile, SpriteAtlas}, }; @@ -83,6 +83,7 @@ pub fn create_test_world() -> (World, Schedule) { world.insert_resource(Events::::default()); world.insert_resource(Events::::default()); world.insert_resource(ScoreResource(0)); + world.insert_resource(FruitSprites::default()); world.insert_resource(AudioState::default()); world.insert_resource(GlobalState { exit: false }); world.insert_resource(DebugState::default());