diff --git a/init.sh b/init.sh index 7e098e7..6fe9b04 100755 --- a/init.sh +++ b/init.sh @@ -54,6 +54,9 @@ git remote remove origin git rm --cached init.sh git rm -r skel-test +# replace the README with a stub +echo "# $name" >| README.md + # escape HTML special characters (&, <, and >), but also sed special characters (& again, \, and /) htmlname=$(echo -n "$name" | sed 's/&/\&/g; s//\>/g; s:[\\/&]:\\&:g') sed -i "s/PROJECT NAME/$htmlname/" ui/src/main_window.ui @@ -73,4 +76,7 @@ grep -l -r PROJECT_NAME | xargs sed -i "s/PROJECT_NAME/$ident/g" pascal=$(echo -n $ident | LC_ALL=C tr '_' '\n' | LC_ALL=C awk -v FIELDWIDTHS='1 1000' -v ORS='' '{print toupper($1) $2}') grep -l -r PROJECTNAME | xargs sed -i "s/PROJECTNAME/$pascal/g" +# another hack, to update Cargo.lock +cargo tree >/dev/null + git commit -a -m "MORPH INTO: $name" diff --git a/src/lib.rs b/src/lib.rs index 2518f00..294edfd 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,6 +1,6 @@ use std::error::Error; -use glam::{UVec2, Vec4}; +use glam::{UVec2, Vec4, vec4}; const DEPTH_FORMAT: wgpu::TextureFormat = wgpu::TextureFormat::Depth16Unorm; const OUTPUT_FORMAT: wgpu::TextureFormat = wgpu::TextureFormat::Bgra8UnormSrgb; @@ -11,6 +11,14 @@ pub struct RedrawArgs { pub background: Vec4, } +impl Default for RedrawArgs { + fn default() -> Self { + Self { + background: vec4(0.05, 0.20, 0.85, 1.00), + } + } +} + pub struct Gpu { device: wgpu::Device, queue: wgpu::Queue, diff --git a/src/main.rs b/src/main.rs index aa0bec3..3021a6a 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,7 +1,7 @@ use std::sync::Arc; use PROJECT_NAME::{Core, RedrawArgs, init_gpu_inner}; -use glam::{uvec2, vec4}; +use glam::uvec2; use winit::{ application::ApplicationHandler, event::WindowEvent, @@ -36,9 +36,7 @@ impl MainWindow { WindowEvent::Resized(physical_size) => self .core .configure(uvec2(physical_size.width, physical_size.height)), - WindowEvent::RedrawRequested => self.core.redraw(&RedrawArgs { - background: vec4(0.05, 0.20, 0.85, 1.00), - }), + WindowEvent::RedrawRequested => self.core.redraw(&RedrawArgs::default()), _ => {} } }