use Default to avoid breaking fallback main

This commit is contained in:
numzero 2026-07-19 21:42:05 +03:00
parent f2b904b5f9
commit 187019a318
2 changed files with 11 additions and 5 deletions

View File

@ -1,6 +1,6 @@
use std::error::Error; use std::error::Error;
use glam::{UVec2, Vec4}; use glam::{UVec2, Vec4, vec4};
const DEPTH_FORMAT: wgpu::TextureFormat = wgpu::TextureFormat::Depth16Unorm; const DEPTH_FORMAT: wgpu::TextureFormat = wgpu::TextureFormat::Depth16Unorm;
const OUTPUT_FORMAT: wgpu::TextureFormat = wgpu::TextureFormat::Bgra8UnormSrgb; const OUTPUT_FORMAT: wgpu::TextureFormat = wgpu::TextureFormat::Bgra8UnormSrgb;
@ -11,6 +11,14 @@ pub struct RedrawArgs {
pub background: Vec4, pub background: Vec4,
} }
impl Default for RedrawArgs {
fn default() -> Self {
Self {
background: vec4(0.05, 0.20, 0.85, 1.00),
}
}
}
pub struct Gpu { pub struct Gpu {
device: wgpu::Device, device: wgpu::Device,
queue: wgpu::Queue, queue: wgpu::Queue,

View File

@ -1,7 +1,7 @@
use std::sync::Arc; use std::sync::Arc;
use PROJECT_NAME::{Core, RedrawArgs, init_gpu_inner}; use PROJECT_NAME::{Core, RedrawArgs, init_gpu_inner};
use glam::{uvec2, vec4}; use glam::uvec2;
use winit::{ use winit::{
application::ApplicationHandler, application::ApplicationHandler,
event::WindowEvent, event::WindowEvent,
@ -36,9 +36,7 @@ impl MainWindow {
WindowEvent::Resized(physical_size) => self WindowEvent::Resized(physical_size) => self
.core .core
.configure(uvec2(physical_size.width, physical_size.height)), .configure(uvec2(physical_size.width, physical_size.height)),
WindowEvent::RedrawRequested => self.core.redraw(&RedrawArgs { WindowEvent::RedrawRequested => self.core.redraw(&RedrawArgs::default()),
background: vec4(0.05, 0.20, 0.85, 1.00),
}),
_ => {} _ => {}
} }
} }