This repository has been archived on 2021-04-27. You can view files and clone it, but cannot push or open issues or pull requests.
ludum-dare-48/src/lib/wrappers/complexanimation.rs

33 lines
756 B
Rust

use std::usize;
use raylib::prelude::*;
pub struct FrameRange {
pub min: usize,
pub max: usize,
}
pub struct ComplexAnimationTool {
sprite_sheet: Texture2D,
frames_per_second: f32,
frame_size: Vector2,
sprite_sheet_size_frames: Vector2
}
impl ComplexAnimationTool {
pub fn render_loop(&self, context_2d: &mut RaylibMode2D<RaylibDrawHandle>, bounds: Rectangle, rotation: f32, range: &FrameRange) {
}
pub fn render_frame(&self, context_2d: &mut RaylibMode2D<RaylibDrawHandle>, bounds: Rectangle, rotation: f32, id: usize) {
// Convert the ID to an xy
let col_id = id % self.sprite_sheet_size_frames.x as usize;
let row_id = id / self.sprite_sheet_size_frames.y as usize;
}
}