diff options
Diffstat (limited to 'engine/src/camera')
-rw-r--r-- | engine/src/camera/fly.rs | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/engine/src/camera/fly.rs b/engine/src/camera/fly.rs index 3f5a0c2..ed41253 100644 --- a/engine/src/camera/fly.rs +++ b/engine/src/camera/fly.rs @@ -7,7 +7,7 @@ use glfw::window::{Key, KeyState}; use crate::camera::Camera; use crate::delta_time::DeltaTime; use crate::event::Update as UpdateEvent; -use crate::input::{Cursor, Keys}; +use crate::input::{Cursor, CursorFlags, Keys}; use crate::vector::{Vec2, Vec3}; /// Fly camera extension. @@ -41,6 +41,7 @@ fn update( camera_query: Query<(Camera,)>, keys: Single<Keys>, cursor: Single<Cursor>, + cursor_flags: Single<CursorFlags>, delta_time: Single<DeltaTime>, mut cursor_state: Local<CursorState>, options: Local<Options>, @@ -53,11 +54,10 @@ fn update( return; }; - if cursor.has_moved && cursor_state.first_mouse { + if cursor.has_moved && cursor_flags.is_first_move.flag { println!("First cursor move"); cursor_state.last_pos = cursor.position; - cursor_state.first_mouse = false; } let delta_time = delta_time.duration; @@ -119,7 +119,6 @@ struct CursorState last_pos: Vec2<f64>, current_pitch: f64, current_yaw: f64, - first_mouse: bool, } impl Default for CursorState @@ -130,7 +129,6 @@ impl Default for CursorState last_pos: Vec2::default(), current_pitch: 0.0, current_yaw: 0.0, - first_mouse: true, } } } |