minor changes

This commit is contained in:
griffi-gh 2024-05-05 02:02:30 +02:00
parent 33c418ff6f
commit 230f10fc57

View file

@ -3,29 +3,23 @@ use winit::dpi::PhysicalSize;
use glam::{Vec3, UVec2}; use glam::{Vec3, UVec2};
use crate::{events::WindowResizedEvent, state::is_ingame}; use crate::{events::WindowResizedEvent, state::is_ingame};
pub mod renderer; mod renderer;
pub use renderer::Renderer;
pub mod primitives; pub mod primitives;
pub mod world; pub mod world;
pub mod selection_box; pub mod selection_box;
pub mod entities; pub mod entities;
pub mod sumberge; pub mod sumberge;
pub use renderer::Renderer;
pub struct BufferPair { pub struct BufferPair {
pub index: wgpu::Buffer, pub index: wgpu::Buffer,
pub vertex: wgpu::Buffer, pub vertex: wgpu::Buffer,
} }
#[derive(Unique)] #[derive(Unique)]
#[repr(transparent)]
pub struct BackgroundColor(pub Vec3); pub struct BackgroundColor(pub Vec3);
#[derive(Unique, Clone, Copy)]
#[repr(transparent)]
#[deprecated = "use Renderer.size instead"]
#[allow(deprecated)]
pub struct WindowSize(pub UVec2);
pub fn render_master(storages: AllStoragesViewMut) { pub fn render_master(storages: AllStoragesViewMut) {
let renderer = storages.borrow::<UniqueView<Renderer>>().unwrap(); let renderer = storages.borrow::<UniqueView<Renderer>>().unwrap();
@ -77,6 +71,13 @@ pub fn resize_renderer(
} }
//Deprecated WindowSize thingy //Deprecated WindowSize thingy
#[derive(Unique, Clone, Copy)]
#[repr(transparent)]
#[deprecated = "use Renderer.size instead"]
#[allow(deprecated)]
pub struct WindowSize(pub UVec2);
pub fn init_window_size(storages: AllStoragesView) { pub fn init_window_size(storages: AllStoragesView) {
let size = storages.borrow::<View<WindowResizedEvent>>().unwrap().iter().next().unwrap().0; let size = storages.borrow::<View<WindowResizedEvent>>().unwrap().iter().next().unwrap().0;
storages.add_unique(WindowSize(size)) storages.add_unique(WindowSize(size))