mirror of
https://github.com/Xevion/Pac-Man.git
synced 2025-12-12 20:12:21 -06:00
refactor: huge refactor into atlas-based resources
This commit is contained in:
@@ -2,7 +2,6 @@
|
||||
use crate::entity::direction::Direction;
|
||||
use crate::texture::sprite::AtlasTile;
|
||||
use anyhow::Result;
|
||||
use glam::IVec2;
|
||||
use sdl2::render::WindowCanvas;
|
||||
|
||||
pub struct DirectionalAnimatedTexture {
|
||||
@@ -49,4 +48,18 @@ impl DirectionalAnimatedTexture {
|
||||
|
||||
tile.render(canvas, dest)
|
||||
}
|
||||
|
||||
pub fn render_stopped(&mut self, canvas: &mut WindowCanvas, dest: sdl2::rect::Rect, direction: Direction) -> Result<()> {
|
||||
let frames = match direction {
|
||||
Direction::Up => &self.up,
|
||||
Direction::Down => &self.down,
|
||||
Direction::Left => &self.left,
|
||||
Direction::Right => &self.right,
|
||||
};
|
||||
|
||||
// Show the last frame (full sprite) when stopped
|
||||
let tile = &frames[1];
|
||||
|
||||
tile.render(canvas, dest)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user