style
This commit is contained in:
parent
ff011f9f0c
commit
cbdc389cc9
@ -16,15 +16,15 @@ struct WindowContext<'a>{
|
|||||||
mouse:strafesnet_common::mouse::MouseState,//std::sync::Arc<std::sync::Mutex<>>
|
mouse:strafesnet_common::mouse::MouseState,//std::sync::Arc<std::sync::Mutex<>>
|
||||||
screen_size:glam::UVec2,
|
screen_size:glam::UVec2,
|
||||||
window:&'a winit::window::Window,
|
window:&'a winit::window::Window,
|
||||||
physics_thread:crate::compat_worker::QNWorker<'a, TimedInstruction<crate::physics_worker::Instruction>>,
|
physics_thread:crate::compat_worker::QNWorker<'a,TimedInstruction<crate::physics_worker::Instruction>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl WindowContext<'_>{
|
impl WindowContext<'_>{
|
||||||
fn get_middle_of_screen(&self)->winit::dpi::PhysicalPosition<u32>{
|
fn get_middle_of_screen(&self)->winit::dpi::PhysicalPosition<u32>{
|
||||||
winit::dpi::PhysicalPosition::new(self.screen_size.x/2,self.screen_size.y/2)
|
winit::dpi::PhysicalPosition::new(self.screen_size.x/2,self.screen_size.y/2)
|
||||||
}
|
}
|
||||||
fn window_event(&mut self,time:integer::Time,event: winit::event::WindowEvent) {
|
fn window_event(&mut self,time:integer::Time,event:winit::event::WindowEvent){
|
||||||
match event {
|
match event{
|
||||||
winit::event::WindowEvent::DroppedFile(path)=>{
|
winit::event::WindowEvent::DroppedFile(path)=>{
|
||||||
match crate::file::load(path.as_path()){
|
match crate::file::load(path.as_path()){
|
||||||
Ok(map)=>self.physics_thread.send(TimedInstruction{time,instruction:crate::physics_worker::Instruction::ChangeMap(map)}).unwrap(),
|
Ok(map)=>self.physics_thread.send(TimedInstruction{time,instruction:crate::physics_worker::Instruction::ChangeMap(map)}).unwrap(),
|
||||||
@ -122,11 +122,11 @@ impl WindowContext<'_>{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn device_event(&mut self,time:integer::Time,event: winit::event::DeviceEvent) {
|
fn device_event(&mut self,time:integer::Time,event: winit::event::DeviceEvent){
|
||||||
match event {
|
match event{
|
||||||
winit::event::DeviceEvent::MouseMotion {
|
winit::event::DeviceEvent::MouseMotion{
|
||||||
delta,//these (f64,f64) are integers on my machine
|
delta,//these (f64,f64) are integers on my machine
|
||||||
} => {
|
}=>{
|
||||||
if self.manual_mouse_lock{
|
if self.manual_mouse_lock{
|
||||||
match self.window.set_cursor_position(self.get_middle_of_screen()){
|
match self.window.set_cursor_position(self.get_middle_of_screen()){
|
||||||
Ok(())=>(),
|
Ok(())=>(),
|
||||||
@ -145,7 +145,7 @@ impl WindowContext<'_>{
|
|||||||
},
|
},
|
||||||
winit::event::DeviceEvent::MouseWheel {
|
winit::event::DeviceEvent::MouseWheel {
|
||||||
delta,
|
delta,
|
||||||
} => {
|
}=>{
|
||||||
println!("mousewheel {:?}",delta);
|
println!("mousewheel {:?}",delta);
|
||||||
if false{//self.physics.style.use_scroll{
|
if false{//self.physics.style.use_scroll{
|
||||||
self.physics_thread.send(TimedInstruction{
|
self.physics_thread.send(TimedInstruction{
|
||||||
@ -153,7 +153,7 @@ impl WindowContext<'_>{
|
|||||||
instruction:crate::physics_worker::Instruction::Input(InputInstruction::Jump(true)),//activates the immediate jump path, but the style modifier prevents controls&CONTROL_JUMP bit from being set to auto jump
|
instruction:crate::physics_worker::Instruction::Input(InputInstruction::Jump(true)),//activates the immediate jump path, but the style modifier prevents controls&CONTROL_JUMP bit from being set to auto jump
|
||||||
}).unwrap();
|
}).unwrap();
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
_=>(),
|
_=>(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user