use qilin::game::context::GameContext;
use qilin::game::game::Game;
use qilin::render::canvas::Canvas;
use qilin::render::color::Color;
use qilin::scene::Scene;
use qilin::simplified::vec2;
use qilin::text::TextSketch;
use qilin::types::{GameConfig, FPS30};
use qilin::ScaleMode;
use qilin::WindowOptions;
struct TextScene;
impl Scene for TextScene {
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.drawable(
&TextSketch::new(vec2(10, 10), include_bytes!("assets/Roboto-Medium.ttf"))
.with_color(Color::RED)
.with_text("This is with Subpixel Anti-Aliased", 30.0),
);
canvas.drawable(
&TextSketch::new(vec2(10, 100), include_bytes!("assets/Roboto-Medium.ttf"))
.with_color(Color::RED)
.with_ssa(false)
.with_text("This is without Subpixel Anti-Aliased", 30.0),
);
}
fn fixed_update(&mut self, _canvas: &mut Canvas, _ctx: &mut GameContext) {
}
fn exit(&mut self) { println!("An impasta!") }
}
fn main() {
Game::new::<TextScene>() .with_config(GameConfig {
title: "My Texts".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");
}