mirror of
https://github.com/Xevion/Pac-Man.git
synced 2025-12-11 04:07:55 -06:00
feat: atlas decoding & frame acquisition
This commit is contained in:
@@ -1,13 +1,16 @@
|
||||
use glam::IVec2;
|
||||
use sdl2::{render::Canvas, video::Window};
|
||||
|
||||
use crate::entity::direction::Direction;
|
||||
use std::rc::Rc;
|
||||
|
||||
/// Trait for drawable atlas-based textures
|
||||
pub trait FrameDrawn {
|
||||
fn render(&self, canvas: &mut Canvas<Window>, position: IVec2, direction: Direction, frame: Option<u32>);
|
||||
}
|
||||
use crate::entity::direction::Direction;
|
||||
use crate::texture::sprite::{AtlasTile, SpriteAtlas};
|
||||
|
||||
pub mod animated;
|
||||
pub mod atlas;
|
||||
pub mod blinking;
|
||||
pub mod directional;
|
||||
pub mod sprite;
|
||||
|
||||
pub fn get_atlas_tile(atlas: &Rc<SpriteAtlas>, name: &str) -> AtlasTile {
|
||||
SpriteAtlas::get_tile(atlas, name).unwrap_or_else(|| panic!("Could not find tile {}", name))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user