use roast2d::prelude::*;

struct Demo;

impl Scene for Demo {
    fn draw(&mut self, g: &mut Engine) {
        g.egui(|ctx, g| {
            egui::Window::new("Debug").show(ctx, |ui| {
                ui.label(format!("time: {:.2}", g.time));
                ui.label(format!("frame: {}", g.frame as u64));
                ui.label(format!("view_size: {:?}", g.view_size()));
            });
        });

        g.with_ui(|g| {
            let text = Text::new("Hello egui + Roast2D".to_string(), 18.0, WHITE);
            g.draw_text(&text, None, Transform::new(Vec3::new(0.0, 0.0, 1.0)));
        });
    }
}

fn setup(g: &mut Engine) {
    g.set_scale_mode(ScaleMode::Fixed {
        width: 800,
        height: 600,
    });
    g.set_scene(Demo);
}

fn main() {
    env_logger::init();
    let app = App::default()
        .title("egui overlay".to_string())
        .window(UVec2::new(800, 600))
        .vsync(true)
        .resizable(true);
    app.run(setup).expect("Start game");
}
