roast2d_internal 0.3.4

Roast2D internal crate
Documentation
use crate::prelude::*;

#[derive(Debug, Clone)]
pub struct SpriteDesc<TextureKey> {
    pub texture_key: TextureKey,
    pub start: u16,
    pub end: u16,
    pub frame_secs: f32,
    pub tile_size: UVec2,
    pub scale: f32,
    pub angle: f32,
}

impl<TextureKey> SpriteDesc<TextureKey> {
    pub fn single_tile(texture_key: TextureKey, tile: u16, tile_size: UVec2, scale: f32) -> Self {
        Self {
            texture_key,
            start: tile,
            end: tile,
            frame_secs: 0.0,
            tile_size,
            scale,
            angle: 0.0,
        }
    }

    pub fn with_angle(mut self, angle: f32) -> Self {
        self.angle = angle;
        self
    }
}