mirror of
https://github.com/Xevion/Pac-Man.git
synced 2025-12-15 22:12:25 -06:00
refactor: move direction & edible into entity submodule
This commit is contained in:
@@ -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};
|
||||||
|
|||||||
@@ -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;
|
||||||
@@ -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;
|
||||||
|
|||||||
@@ -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,
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -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,
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|
||||||
|
|||||||
@@ -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> {
|
||||||
|
|||||||
@@ -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 {
|
||||||
|
|||||||
Reference in New Issue
Block a user