pittore 0.2.4

Simple toolkit for 2D visualization based on wgpu.
Documentation
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]

use glam::UVec2;
use pittore::prelude::*;
use winit::{
    dpi::PhysicalSize,
    window::{Fullscreen, WindowAttributes},
};

struct App {
    fixed_resolution: bool,
}

impl PittoreApp for App {
    fn init(&mut self, c: &mut Context) {
        println!("Press F to toggle fullscreen");
        println!("Press R to toggle resolution");

        c.set_background_color(Color::new([11, 11, 11, 255]));
    }

    fn update(&mut self, c: &mut Context) {
        if c.key_just_pressed(KeyCode::KeyF) {
            let fullscreen = c
                .window()
                .fullscreen()
                .is_none()
                .then_some(Fullscreen::Borderless(None));
            c.window().set_fullscreen(fullscreen);
        }

        if c.key_just_pressed(KeyCode::KeyR) {
            self.fixed_resolution ^= true;
            if self.fixed_resolution {
                c.set_resolution(Some(UVec2::new(360, 360)));
            } else {
                c.set_resolution(None);
            }
        }

        c.set_camera(Camera::default_2d());
        c.draw_circles([Instance2d {
            transform: Transform2d::from_scale(Vec2::splat(64.0)),
            ..Default::default()
        }]);
    }
}

fn main() {
    pittore::run_with_options(
        App {
            fixed_resolution: false,
        },
        WindowAttributes::default()
            .with_title("pittore")
            .with_inner_size(PhysicalSize::new(1920, 1080)),
    );
}