summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLizzy Fleckenstein <eliasfleckenstein@web.de>2023-05-08 22:39:21 +0200
committerLizzy Fleckenstein <eliasfleckenstein@web.de>2023-05-08 22:39:21 +0200
commit6f746798f9e488cfab48ec108390cedafaec99a4 (patch)
tree1eb59c65dd0220b4173dee6b8c5f5ee1eb66ebfd /src
parentcf2d1870a2585069a1286ecca77109a12ca4dd47 (diff)
downloadmt_client-6f746798f9e488cfab48ec108390cedafaec99a4.tar.xz
Fix yaw
Diffstat (limited to 'src')
-rw-r--r--src/gfx.rs3
-rw-r--r--src/gfx/state.rs9
2 files changed, 9 insertions, 3 deletions
diff --git a/src/gfx.rs b/src/gfx.rs
index c86b351..385291f 100644
--- a/src/gfx.rs
+++ b/src/gfx.rs
@@ -6,7 +6,6 @@ use winit::{
event::{DeviceEvent::*, Event::*, WindowEvent::*},
event_loop::ControlFlow::ExitWithCode,
platform::run_return::EventLoopExtRunReturn,
- window::CursorGrabMode,
};
mod map;
@@ -106,7 +105,7 @@ pub async fn run(
..
} => {
if !game_paused {
- state.camera.update_mouse(delta.0 as f32, delta.1 as f32);
+ state.camera.update_mouse(-delta.0 as f32, delta.1 as f32);
window
.set_cursor_position(winit::dpi::PhysicalPosition::new(
state.config.width / 2,
diff --git a/src/gfx/state.rs b/src/gfx/state.rs
index 9d1cfd1..43ac41c 100644
--- a/src/gfx/state.rs
+++ b/src/gfx/state.rs
@@ -177,10 +177,17 @@ impl State {
}
pub fn update(&mut self, dt: Duration) {
+ self.camera.yaw += Rad::from(Deg(180.0)).0;
+ self.camera.yaw *= -1.0;
+
let cam = self.camera.camera(dt.as_secs_f32());
+
+ self.camera.yaw *= -1.0;
+ self.camera.yaw -= Rad::from(Deg(180.0)).0;
+
self.camera.position = cam.position;
- self.view = Matrix4::from(cam.orthogonal());
+ self.view = Matrix4::from(cam.orthogonal());
self.camera_uniform.set(&self.queue, self.proj * self.view);
}