diff --git a/src/window.rs b/src/window.rs index 1134fc1..ba78b77 100644 --- a/src/window.rs +++ b/src/window.rs @@ -167,53 +167,53 @@ impl WindowContext<'_>{ } pub fn worker<'a>(window:&'a winit::window::Window,setup_context:crate::setup::SetupContext<'a>,scope:&'a std::thread::Scope<'a,'_>)->crate::compat_worker::QNWorker<'a,TimedInstruction>{ // WindowContextSetup::new - let user_settings=crate::settings::read_user_settings(); + let user_settings=crate::settings::read_user_settings(); - let mut graphics=crate::graphics::GraphicsState::new(&setup_context.device,&setup_context.queue,&setup_context.config); - graphics.load_user_settings(&user_settings); + let mut graphics=crate::graphics::GraphicsState::new(&setup_context.device,&setup_context.queue,&setup_context.config); + graphics.load_user_settings(&user_settings); //WindowContextSetup::into_context - let screen_size=glam::uvec2(setup_context.config.width,setup_context.config.height); - let graphics_thread=crate::graphics_worker::new(graphics,setup_context.config,setup_context.surface,setup_context.device,setup_context.queue); - //this obviously doesn't belong here, do something about it pls - let bot_thread=crate::bot_worker::new(scope); - let mut window_context=WindowContext{ - manual_mouse_lock:false, - mouse:strafesnet_common::mouse::MouseState::default(), - //make sure to update this!!!!! - screen_size, - window, - physics_thread:crate::physics_worker::new(graphics_thread,bot_thread,user_settings), - }; + let screen_size=glam::uvec2(setup_context.config.width,setup_context.config.height); + let graphics_thread=crate::graphics_worker::new(graphics,setup_context.config,setup_context.surface,setup_context.device,setup_context.queue); + //this obviously doesn't belong here, do something about it pls + let bot_thread=crate::bot_worker::new(scope); + let mut window_context=WindowContext{ + manual_mouse_lock:false, + mouse:strafesnet_common::mouse::MouseState::default(), + //make sure to update this!!!!! + screen_size, + window, + physics_thread:crate::physics_worker::new(graphics_thread,bot_thread,user_settings), + }; //WindowContextSetup::into_worker - crate::compat_worker::QNWorker::new(move |ins:TimedInstruction|{ - match ins.instruction{ - WindowInstruction::RequestRedraw=>{ - window_context.window.request_redraw(); + crate::compat_worker::QNWorker::new(move |ins:TimedInstruction|{ + match ins.instruction{ + WindowInstruction::RequestRedraw=>{ + window_context.window.request_redraw(); + } + WindowInstruction::WindowEvent(window_event)=>{ + window_context.window_event(ins.time,window_event); + }, + WindowInstruction::DeviceEvent(device_event)=>{ + window_context.device_event(ins.time,device_event); + }, + WindowInstruction::Resize(size)=>{ + window_context.physics_thread.send( + TimedInstruction{ + time:ins.time, + instruction:crate::physics_worker::Instruction::Resize(size) + } + ).unwrap(); + } + WindowInstruction::Render=>{ + window_context.physics_thread.send( + TimedInstruction{ + time:ins.time, + instruction:crate::physics_worker::Instruction::Render + } + ).unwrap(); + } } - WindowInstruction::WindowEvent(window_event)=>{ - window_context.window_event(ins.time,window_event); - }, - WindowInstruction::DeviceEvent(device_event)=>{ - window_context.device_event(ins.time,device_event); - }, - WindowInstruction::Resize(size)=>{ - window_context.physics_thread.send( - TimedInstruction{ - time:ins.time, - instruction:crate::physics_worker::Instruction::Resize(size) - } - ).unwrap(); - } - WindowInstruction::Render=>{ - window_context.physics_thread.send( - TimedInstruction{ - time:ins.time, - instruction:crate::physics_worker::Instruction::Render - } - ).unwrap(); - } - } - }) + }) }