#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
use std::num::NonZeroU32;
use alligator_render::{ImageFormat, Instance, RenderWindowConfig, Renderer};
use winit::event_loop::EventLoop;
fn main() {
// configure the render window
let config = RenderWindowConfig {
title: "Bumper Sticker",
instance_capacity: 2,
default_width: NonZeroU32::new(1280).unwrap(),
default_height: NonZeroU32::new(720).unwrap(),
mode: alligator_render::config::WindowMode::BorderlessFullscreen,
vsync: false,
..Default::default()
};
let texture = include_bytes!("res/sample.bmp");
let event_loop = EventLoop::new();
let mut renderer = Renderer::new(&config, &event_loop).unwrap();
let texture = renderer
.textures_mut()
.load_from_memory(texture, ImageFormat::Bmp)
.unwrap();
let width = renderer.textures().texture_width(texture).unwrap();
let height = renderer.textures().texture_height(texture).unwrap();
let x = renderer.textures().texture_x(texture).unwrap();
let y = renderer.textures().texture_y(texture).unwrap();
renderer.instances_mut().push_instance(Instance {
position: [-0.5, 0.0],
size: [0.75; 2],
texture_size: [width, height],
texture_coordinates: [x, y],
..Default::default()
});
renderer.instances_mut().push_instance(Instance {
position: [0.5, 0.0],
size: [0.75; 2],
texture_size: [width, height],
texture_coordinates: [x, y],
..Default::default()
});
renderer.run(event_loop);
}
|