diff --git a/src/camera.rs b/src/camera.rs index a37a0ac..9943dee 100644 --- a/src/camera.rs +++ b/src/camera.rs @@ -56,9 +56,9 @@ impl Camera { let (dx, dy) = input.mouse_moved; input.mouse_moved = (0.0, 0.0); - self.rot_x += Deg(dx * input.dots_multiplier / input.dots_per_degree); + self.rot_x += Deg(dx * input.sens); let pitch_lim = 90.0 - 0.0001; - let pitch = self.rot_y.0 + (-dy * input.dots_multiplier / input.dots_per_degree); + let pitch = self.rot_y.0 + (-dy * input.sens); self.rot_y = Deg(pitch.clamp(-pitch_lim, pitch_lim)); } } diff --git a/src/main.rs b/src/main.rs index 3668a09..62de0f8 100644 --- a/src/main.rs +++ b/src/main.rs @@ -21,12 +21,11 @@ pub struct Input { amount_down: f32, mouse_moved: (f32, f32), speed: f32, - dots_multiplier: f32, - dots_per_degree: f32, + sens: f32, } impl Input { - pub fn new(speed: f32, sens: f32) -> Self { + pub fn new(speed: f32, dots_multiplier: f32, dots_per_degree: f32) -> Self { Self { amount_left: 0.0, amount_right: 0.0, @@ -36,10 +35,7 @@ impl Input { amount_down: 0.0, mouse_moved: (0.0, 0.0), speed, - dots_multiplier: sens, - - // i don't want the sensitivity to be tied to the resolution, though. - dots_per_degree: 1920.0 / 360.0, + sens: dots_multiplier / dots_per_degree, } } @@ -113,7 +109,12 @@ fn real_main() -> Result<(), &'static str> { let mut fullscreen = set_fullscreen(false, &(window), &mut(cursor_locked)); let mut state = State::new(window)?; - let mut input = Input::new(1.0, 8.8 / 100.0); + let mut input = Input::new( + 1.0, + 8.8 / 100.0, + // i don't want the sensitivity to be tied to the resolution, though. + 1920.0 / 360.0 + ); let mut total_elapsed = 0.0; let mut timer = Instant::now();