refactor: move direction & edible into entity submodule

This commit is contained in:
2025-07-24 12:44:47 -05:00
parent 002da46045
commit 829462d3b6
11 changed files with 12 additions and 13 deletions

View File

@@ -4,7 +4,7 @@ use std::rc::Rc;
use sdl2::render::{Canvas, Texture}; use sdl2::render::{Canvas, Texture};
use sdl2::video::Window; use sdl2::video::Window;
use crate::direction::Direction; use crate::entity::direction::Direction;
use crate::entity::ghost::{Ghost, GhostMode, GhostType}; use crate::entity::ghost::{Ghost, GhostMode, GhostType};
use crate::entity::pacman::Pacman; use crate::entity::pacman::Pacman;
use crate::entity::{Entity, Moving, Renderable, StaticEntity}; use crate::entity::{Entity, Moving, Renderable, StaticEntity};

View File

@@ -1,6 +1,6 @@
//! Edible entity for Pac-Man: pellets, power pellets, and fruits. //! Edible entity for Pac-Man: pellets, power pellets, and fruits.
use crate::constants::{FruitType, MapTile, BOARD_HEIGHT, BOARD_WIDTH}; use crate::constants::{FruitType, MapTile, BOARD_HEIGHT, BOARD_WIDTH};
use crate::direction::Direction; use crate::entity::direction::Direction;
use crate::entity::{Entity, Renderable, StaticEntity}; use crate::entity::{Entity, Renderable, StaticEntity};
use crate::map::Map; use crate::map::Map;
use crate::texture::atlas::AtlasTexture; use crate::texture::atlas::AtlasTexture;

View File

@@ -3,7 +3,7 @@ use rand::Rng;
use rand::SeedableRng; use rand::SeedableRng;
use crate::constants::{MapTile, BOARD_WIDTH}; use crate::constants::{MapTile, BOARD_WIDTH};
use crate::direction::Direction; use crate::entity::direction::Direction;
use crate::entity::pacman::Pacman; use crate::entity::pacman::Pacman;
use crate::entity::{Entity, MovableEntity, Moving, Renderable}; use crate::entity::{Entity, MovableEntity, Moving, Renderable};
use crate::map::Map; use crate::map::Map;

View File

@@ -1,10 +1,12 @@
pub mod blinky; pub mod blinky;
pub mod direction;
pub mod edible;
pub mod ghost; pub mod ghost;
pub mod pacman; pub mod pacman;
use crate::{ use crate::{
constants::{MapTile, BOARD_OFFSET, BOARD_WIDTH, CELL_SIZE}, constants::{MapTile, BOARD_OFFSET, BOARD_WIDTH, CELL_SIZE},
direction::Direction, entity::direction::Direction,
map::Map, map::Map,
modulation::SimpleTickModulator, modulation::SimpleTickModulator,
}; };

View File

@@ -8,8 +8,7 @@ use sdl2::{
}; };
use crate::{ use crate::{
direction::Direction, entity::{direction::Direction, Entity, MovableEntity, Moving, Renderable, StaticEntity},
entity::{Entity, MovableEntity, Moving, Renderable, StaticEntity},
map::Map, map::Map,
modulation::{SimpleTickModulator, TickModulator}, modulation::{SimpleTickModulator, TickModulator},
texture::animated::AnimatedAtlasTexture, texture::animated::AnimatedAtlasTexture,

View File

@@ -19,9 +19,9 @@ use crate::asset::{get_asset_bytes, Asset};
use crate::audio::Audio; use crate::audio::Audio;
use crate::constants::RAW_BOARD; use crate::constants::RAW_BOARD;
use crate::debug::{DebugMode, DebugRenderer}; use crate::debug::{DebugMode, DebugRenderer};
use crate::direction::Direction;
use crate::edible::{reconstruct_edibles, Edible, EdibleKind};
use crate::entity::blinky::Blinky; use crate::entity::blinky::Blinky;
use crate::entity::direction::Direction;
use crate::entity::edible::{reconstruct_edibles, Edible, EdibleKind};
use crate::entity::pacman::Pacman; use crate::entity::pacman::Pacman;
use crate::entity::Renderable; use crate::entity::Renderable;
use crate::map::Map; use crate::map::Map;

View File

@@ -56,8 +56,6 @@ mod asset;
mod audio; mod audio;
mod constants; mod constants;
mod debug; mod debug;
mod direction;
mod edible;
#[cfg(target_os = "emscripten")] #[cfg(target_os = "emscripten")]
mod emscripten; mod emscripten;
mod entity; mod entity;

View File

@@ -4,7 +4,7 @@ use sdl2::{
video::Window, video::Window,
}; };
use crate::direction::Direction; use crate::entity::direction::Direction;
use crate::texture::atlas::AtlasTexture; use crate::texture::atlas::AtlasTexture;
use crate::texture::FrameDrawn; use crate::texture::FrameDrawn;

View File

@@ -4,7 +4,7 @@ use sdl2::{
video::Window, video::Window,
}; };
use crate::{direction::Direction, texture::FrameDrawn}; use crate::{entity::direction::Direction, texture::FrameDrawn};
/// A texture atlas abstraction for static (non-animated) rendering. /// A texture atlas abstraction for static (non-animated) rendering.
pub struct AtlasTexture<'a> { pub struct AtlasTexture<'a> {

View File

@@ -1,6 +1,6 @@
use sdl2::{render::Canvas, video::Window}; use sdl2::{render::Canvas, video::Window};
use crate::direction::Direction; use crate::entity::direction::Direction;
/// Trait for drawable atlas-based textures /// Trait for drawable atlas-based textures
pub trait FrameDrawn { pub trait FrameDrawn {