calculate title at compile time

This commit is contained in:
Quaternions 2025-01-05 21:39:48 -08:00
parent 02bb2d797c
commit ccce54c1a3
2 changed files with 5 additions and 3 deletions

View File

@ -12,6 +12,8 @@ mod model_graphics;
mod physics_worker; mod physics_worker;
mod graphics_worker; mod graphics_worker;
const TITLE:&'static str=concat!("Strafe Client v",env!("CARGO_PKG_VERSION"));
fn main(){ fn main(){
setup::setup_and_start(format!("Strafe Client v{}",env!("CARGO_PKG_VERSION"))); setup::setup_and_start(TITLE);
} }

View File

@ -192,14 +192,14 @@ pub struct SetupContext<'a>{
pub config:wgpu::SurfaceConfiguration, pub config:wgpu::SurfaceConfiguration,
} }
pub fn setup_and_start(title:String){ pub fn setup_and_start(title:&str){
let event_loop=winit::event_loop::EventLoop::new().unwrap(); let event_loop=winit::event_loop::EventLoop::new().unwrap();
println!("Initializing the surface..."); println!("Initializing the surface...");
let partial_1=create_instance(); let partial_1=create_instance();
let window=create_window(title.as_str(),&event_loop).unwrap(); let window=create_window(title,&event_loop).unwrap();
let partial_2=partial_1.create_surface(&window).unwrap(); let partial_2=partial_1.create_surface(&window).unwrap();