use qilin::game::context::GameContext;
use qilin::game::game::Game;
use qilin::render::canvas::Canvas;
use qilin::render::color::Color;
use qilin::render::sketch::Sketch;
use qilin::scene::Scene;
use qilin::simplified::vec2;
use qilin::types::{GameConfig, FPS30};
use qilin::ScaleMode;
use qilin::WindowOptions;
struct ShapeScene;
impl Scene for ShapeScene {
fn new() -> Self
where
Self: Sized,
{
Self
}
fn enter(&mut self) { println!("What do you call a fake noodle?") }
fn update(&mut self, canvas: &mut Canvas, _ctx: &mut GameContext) {
canvas.draw(
Sketch::new()
.line(vec2(0, 0), vec2(300, 600), Color::GREEN),
);
canvas.draw(
Sketch::new()
.circle(vec2(100, 100), 30, Color::RED)
.rect(vec2(300, 300), 100, 100, Color::BLUE)
.oval(vec2(400, 200), 120, 60, Color::CYAN),
);
}
fn fixed_update(&mut self, _canvas: &mut Canvas, _ctx: &mut GameContext) {
}
fn exit(&mut self) { println!("An impasta!") }
}
fn main() {
Game::new::<ShapeScene>() .with_config(GameConfig {
title: "My Shapes".to_string(), update_rate_limit: FPS30, width: 800, height: 600, fixed_time_step: Default::default(), window: WindowOptions {
scale_mode: ScaleMode::AspectRatioStretch, resize: true, ..Default::default()
},
})
.play()
.expect("Failed to play game");
}