wrong instruction

This commit is contained in:
Quaternions 2025-01-14 01:36:50 -08:00
parent 29f9d5298f
commit 90f6437817

View File

@ -1,7 +1,7 @@
use strafesnet_common::instruction::TimedInstruction;
use strafesnet_common::session::{Time as SessionTime,TimeInner as SessionTimeInner};
use strafesnet_common::physics::{OtherInstruction,UnbufferedInstruction};
use crate::session::ExternalInstruction as SessionExternalInstruction;
use crate::physics_worker::Instruction as PhysicsWorkerInstruction;
pub enum Instruction{
Resize(winit::dpi::PhysicalSize<u32>),
@ -17,7 +17,7 @@ struct WindowContext<'a>{
mouse:strafesnet_common::mouse::MouseState<SessionTimeInner>,//std::sync::Arc<std::sync::Mutex<>>
screen_size:glam::UVec2,
window:&'a winit::window::Window,
physics_thread:crate::compat_worker::QNWorker<'a,TimedInstruction<SessionExternalInstruction,SessionTimeInner>>,
physics_thread:crate::compat_worker::QNWorker<'a,TimedInstruction<PhysicsWorkerInstruction,SessionTimeInner>>,
}
impl WindowContext<'_>{
@ -28,7 +28,7 @@ impl WindowContext<'_>{
match event{
winit::event::WindowEvent::DroppedFile(path)=>{
match crate::file::load(path.as_path()){
Ok(map)=>self.physics_thread.send(TimedInstruction{time,instruction:SessionExternalInstruction::ChangeMap(map)}).unwrap(),
Ok(map)=>self.physics_thread.send(TimedInstruction{time,instruction:PhysicsWorkerInstruction::ChangeMap(map)}).unwrap(),
Err(e)=>println!("Failed to load map: {e}"),
}
},
@ -36,7 +36,7 @@ impl WindowContext<'_>{
//pause unpause
self.physics_thread.send(TimedInstruction{
time,
instruction:SessionExternalInstruction::SetPaused(!state),
instruction:PhysicsWorkerInstruction::SetPaused(!state),
}).unwrap();
//recalculate pressed keys on focus
},
@ -113,7 +113,7 @@ impl WindowContext<'_>{
}{
self.physics_thread.send(TimedInstruction{
time,
instruction:SessionExternalInstruction::Input(UnbufferedInstruction::Other(input_instruction)),
instruction:PhysicsWorkerInstruction::Input(UnbufferedInstruction::Other(input_instruction)),
}).unwrap();
}
},
@ -141,7 +141,7 @@ impl WindowContext<'_>{
self.mouse.pos+=delta;
self.physics_thread.send(TimedInstruction{
time,
instruction:SessionExternalInstruction::Input(UnbufferedInstruction::MoveMouse(self.mouse.pos)),
instruction:PhysicsWorkerInstruction::Input(UnbufferedInstruction::MoveMouse(self.mouse.pos)),
}).unwrap();
},
winit::event::DeviceEvent::MouseWheel {
@ -151,7 +151,7 @@ impl WindowContext<'_>{
if false{//self.physics.style.use_scroll{
self.physics_thread.send(TimedInstruction{
time,
instruction:SessionExternalInstruction::Input(UnbufferedInstruction::Other(OtherInstruction::SetJump(true))),//activates the immediate jump path, but the style modifier prevents controls&CONTROL_JUMP bit from being set to auto jump
instruction:PhysicsWorkerInstruction::Input(UnbufferedInstruction::Other(OtherInstruction::SetJump(true))),//activates the immediate jump path, but the style modifier prevents controls&CONTROL_JUMP bit from being set to auto jump
}).unwrap();
}
},
@ -200,7 +200,7 @@ pub fn worker<'a>(
window_context.physics_thread.send(
TimedInstruction{
time:ins.time,
instruction:SessionExternalInstruction::Resize(size)
instruction:PhysicsWorkerInstruction::Resize(size)
}
).unwrap();
}
@ -208,7 +208,7 @@ pub fn worker<'a>(
window_context.physics_thread.send(
TimedInstruction{
time:ins.time,
instruction:SessionExternalInstruction::Render
instruction:PhysicsWorkerInstruction::Render
}
).unwrap();
}