use macroquad::prelude::*;
#[derive(Debug, Clone, Copy)]
pub struct FrameContext {
pub time: f32,
pub delta: f32,
pub width: f32,
pub height: f32,
pub center: Vec2,
pub mouse: Vec2,
pub mouse_offset: Vec2,
}
impl FrameContext {
pub fn gather() -> Self {
let width = screen_width();
let height = screen_height();
let center = vec2(width * 0.5, height * 0.5);
let (mouse_x, mouse_y) = mouse_position();
let mouse = vec2(mouse_x, mouse_y);
Self {
time: get_time() as f32,
delta: get_frame_time(),
width,
height,
center,
mouse,
mouse_offset: mouse - center,
}
}
}
pub trait Scene {
fn update(&mut self, ctx: &FrameContext);
fn draw(&self, ctx: &FrameContext);
}