diff --git a/src/app.rs b/src/app.rs index 126810e..22feb8a 100644 --- a/src/app.rs +++ b/src/app.rs @@ -33,7 +33,7 @@ pub struct App<'a> { last_tick: Instant, } -impl<'a> App<'a> { +impl App<'_> { pub fn new() -> Result { let sdl_context = sdl2::init().map_err(|e| anyhow!(e))?; let video_subsystem = sdl_context.video().map_err(|e| anyhow!(e))?; diff --git a/src/audio.rs b/src/audio.rs index 135fafd..e827efc 100644 --- a/src/audio.rs +++ b/src/audio.rs @@ -157,6 +157,7 @@ impl Audio { } /// Returns `true` if the audio system is disabled. + #[allow(dead_code)] pub fn is_disabled(&self) -> bool { self.disabled } diff --git a/src/map/builder.rs b/src/map/builder.rs index fb62b12..743b845 100644 --- a/src/map/builder.rs +++ b/src/map/builder.rs @@ -11,6 +11,8 @@ use sdl2::render::{Canvas, RenderTarget}; use std::collections::{HashMap, VecDeque}; use tracing::debug; +/// The starting positions of the entities in the game. +#[allow(dead_code)] pub struct NodePositions { pub pacman: NodeId, pub blinky: NodeId, @@ -22,12 +24,14 @@ pub struct NodePositions { /// The main map structure containing the game board and navigation graph. pub struct Map { /// The current state of the map. + #[allow(dead_code)] current: [[MapTile; BOARD_CELL_SIZE.y as usize]; BOARD_CELL_SIZE.x as usize], /// The node map for entity movement. pub graph: Graph, /// A mapping from grid positions to node IDs. pub grid_to_node: HashMap, /// A mapping of the starting positions of the entities. + #[allow(dead_code)] pub start_positions: NodePositions, /// Pac-Man's starting position. pacman_start: Option, diff --git a/src/texture/animated.rs b/src/texture/animated.rs index 6c94bd6..85f5843 100644 --- a/src/texture/animated.rs +++ b/src/texture/animated.rs @@ -50,19 +50,26 @@ impl AnimatedTexture { tile.render(canvas, atlas, dest) } - // Helper methods for testing + /// Returns the current frame index. + #[allow(dead_code)] pub fn current_frame(&self) -> usize { self.current_frame } + /// Returns the time bank. + #[allow(dead_code)] pub fn time_bank(&self) -> f32 { self.time_bank } + /// Returns the frame duration. + #[allow(dead_code)] pub fn frame_duration(&self) -> f32 { self.frame_duration } + /// Returns the number of tiles in the animation. + #[allow(dead_code)] pub fn tiles_len(&self) -> usize { self.tiles.len() } diff --git a/src/texture/directional.rs b/src/texture/directional.rs index e6d2f0b..dc155e0 100644 --- a/src/texture/directional.rs +++ b/src/texture/directional.rs @@ -55,19 +55,26 @@ impl DirectionalAnimatedTexture { } } - // Helper methods for testing + /// Returns true if the texture has a direction. + #[allow(dead_code)] pub fn has_direction(&self, direction: Direction) -> bool { self.textures.contains_key(&direction) } + /// Returns true if the texture has a stopped direction. + #[allow(dead_code)] pub fn has_stopped_direction(&self, direction: Direction) -> bool { self.stopped_textures.contains_key(&direction) } + /// Returns the number of textures. + #[allow(dead_code)] pub fn texture_count(&self) -> usize { self.textures.len() } + /// Returns the number of stopped textures. + #[allow(dead_code)] pub fn stopped_texture_count(&self) -> usize { self.stopped_textures.len() } diff --git a/src/texture/sprite.rs b/src/texture/sprite.rs index b560876..85533a9 100644 --- a/src/texture/sprite.rs +++ b/src/texture/sprite.rs @@ -50,11 +50,14 @@ impl AtlasTile { Ok(()) } - // Helper methods for testing + /// Creates a new atlas tile. + #[allow(dead_code)] pub fn new(pos: U16Vec2, size: U16Vec2, color: Option) -> Self { Self { pos, size, color } } + /// Sets the color of the tile. + #[allow(dead_code)] pub fn with_color(mut self, color: Color) -> Self { self.color = Some(color); self @@ -96,15 +99,20 @@ impl SpriteAtlas { &self.texture } - // Helper methods for testing + /// Returns the number of tiles in the atlas. + #[allow(dead_code)] pub fn tiles_count(&self) -> usize { self.tiles.len() } + /// Returns true if the atlas has a tile with the given name. + #[allow(dead_code)] pub fn has_tile(&self, name: &str) -> bool { self.tiles.contains_key(name) } + /// Returns the default color of the atlas. + #[allow(dead_code)] pub fn default_color(&self) -> Option { self.default_color }