refactor: restructure game logic and state management into separate modules

- Moved game logic from `game.rs` to `game/mod.rs` and `game/state.rs` for better organization.
- Updated `App` to utilize the new `Game` struct and its state management.
- Refactored error handling
- Removed unused audio subsystem references
This commit is contained in:
2025-08-12 14:40:48 -05:00
parent c489f32908
commit c1c5dae6f2
21 changed files with 577 additions and 591 deletions

View File

@@ -1,5 +1,5 @@
use glam::Vec2;
use pacman::constants::{BOARD_CELL_SIZE, CELL_SIZE, RAW_BOARD};
use pacman::constants::{CELL_SIZE, RAW_BOARD};
use pacman::map::Map;
use sdl2::render::Texture;
@@ -21,19 +21,6 @@ fn test_map_creation() {
assert!(has_connections);
}
#[test]
fn test_map_starting_positions() {
let map = Map::new(RAW_BOARD).unwrap();
let pacman_pos = map.find_starting_position(0);
assert!(pacman_pos.is_some());
assert!(pacman_pos.unwrap().x < BOARD_CELL_SIZE.x);
assert!(pacman_pos.unwrap().y < BOARD_CELL_SIZE.y);
let nonexistent_pos = map.find_starting_position(99);
assert_eq!(nonexistent_pos, None);
}
#[test]
fn test_map_node_positions() {
let map = Map::new(RAW_BOARD).unwrap();