#[allow(unused_imports)] use log::{debug, error, info, trace, warn}; use winit; //--Position struct--------------------------------------------------------------------------------- pub struct Position { pub x: u32, pub y: u32, } //--Size struct------------------------------------------------------------------------------------- #[derive(Copy, Clone)] pub struct Size { pub w: u32, pub h: u32, } impl From for winit::dpi::Size { fn from(size: Size) -> Self { winit::dpi::Size::Physical ( winit::dpi::PhysicalSize { width: size.w, height: size.h, }) } } impl From> for Size { fn from(size: winit::dpi::PhysicalSize) -> Self { Self { w: size.width, h: size.height, } } } //--Pixel struct------------------------------------------------------------------------------------ #[derive(Copy, Clone)] struct Rgba { r: u8, g: u8, b: u8, a: u8, } pub union Pixel { flat: u32, rgba: Rgba, } impl Pixel { pub fn rgb(r: u8, g: u8, b: u8) -> Pixel { Pixel { rgba: Rgba{r, g, b, a: 255}, } } } //--Color values------------------------------------------------------------------------------------ #[non_exhaustive] pub struct Color; impl Color { pub const WHITE: Pixel = Pixel {flat: 0x000000ff}; pub const BLACK: Pixel = Pixel {flat: 0xffffffff}; }