mirror of
https://github.com/Xevion/Pac-Man.git
synced 2025-12-09 12:08:05 -06:00
chore: lifetimes
This commit is contained in:
12
src/game.rs
12
src/game.rs
@@ -11,16 +11,16 @@ use sdl2::ttf::Font;
|
||||
use sdl2::video::WindowContext;
|
||||
use sdl2::{pixels::Color, render::Canvas, video::Window};
|
||||
|
||||
use crate::animation::AtlasTexture;
|
||||
use crate::audio::Audio;
|
||||
use crate::animation::{AtlasTexture, FrameDrawn};
|
||||
use crate::constants::RAW_BOARD;
|
||||
use crate::debug::{DebugMode, DebugRenderer};
|
||||
use crate::direction::Direction;
|
||||
use crate::entity::{Entity, Renderable};
|
||||
use crate::edible::{reconstruct_edibles, Edible, EdibleKind};
|
||||
use crate::entity::Renderable;
|
||||
use crate::ghosts::blinky::Blinky;
|
||||
use crate::map::Map;
|
||||
use crate::pacman::Pacman;
|
||||
use crate::debug::{DebugMode, DebugRenderer};
|
||||
use crate::edible::{reconstruct_edibles, Edible, EdibleKind};
|
||||
|
||||
// Embed texture data directly into the executable
|
||||
static PACMAN_TEXTURE_DATA: &[u8] = include_bytes!("../assets/32/pacman.png");
|
||||
@@ -52,7 +52,7 @@ pub struct Game<'a> {
|
||||
edibles: Vec<Edible<'a>>,
|
||||
}
|
||||
|
||||
impl Game<'_> {
|
||||
impl<'a> Game<'a> {
|
||||
/// Creates a new `Game` instance.
|
||||
///
|
||||
/// # Arguments
|
||||
@@ -61,7 +61,7 @@ impl Game<'_> {
|
||||
/// * `texture_creator` - The SDL texture creator.
|
||||
/// * `ttf_context` - The SDL TTF context.
|
||||
/// * `_audio_subsystem` - The SDL audio subsystem (currently unused).
|
||||
pub fn new<'a>(
|
||||
pub fn new(
|
||||
canvas: &'a mut Canvas<Window>,
|
||||
texture_creator: &'a TextureCreator<WindowContext>,
|
||||
ttf_context: &'a sdl2::ttf::Sdl2TtfContext,
|
||||
|
||||
@@ -303,7 +303,7 @@ impl<'a> Moving for Ghost<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
impl Renderable for Ghost<'_> {
|
||||
impl<'a> Renderable for Ghost<'a> {
|
||||
fn render(&self, canvas: &mut sdl2::render::Canvas<sdl2::video::Window>) {
|
||||
let pos = self.base.base.pixel_position;
|
||||
self.body_sprite.render(canvas, pos, Direction::Right, None);
|
||||
|
||||
@@ -55,7 +55,9 @@ unsafe fn attach_console() {
|
||||
mod animation;
|
||||
mod audio;
|
||||
mod constants;
|
||||
mod debug;
|
||||
mod direction;
|
||||
mod edible;
|
||||
mod entity;
|
||||
mod game;
|
||||
mod ghost;
|
||||
@@ -64,8 +66,6 @@ mod helper;
|
||||
mod map;
|
||||
mod modulation;
|
||||
mod pacman;
|
||||
mod debug;
|
||||
mod edible;
|
||||
|
||||
/// The main entry point of the application.
|
||||
///
|
||||
|
||||
Reference in New Issue
Block a user