diff --git a/game/game.odin b/game/game.odin index d42ddd1..f0a4865 100644 --- a/game/game.odin +++ b/game/game.odin @@ -898,20 +898,23 @@ collect_camera_input :: proc() -> (delta: rl.Vector2, sense: f32, is_mouse: bool } should_capture_mouse := rl.IsMouseButtonDown(.RIGHT) - @(static) last_mouse_pos: rl.Vector2 + @(static) first_delta := true if g_mem.mouse_captured != should_capture_mouse { if should_capture_mouse { rl.DisableCursor() - last_mouse_pos = rl.GetMousePosition() + first_delta = true } else { rl.EnableCursor() } g_mem.mouse_captured = should_capture_mouse } - mouse_pos := rl.GetMousePosition() - mouse_delta := g_mem.mouse_captured ? mouse_pos - last_mouse_pos : 0 - last_mouse_pos = mouse_pos + mouse_delta := g_mem.mouse_captured ? rl.GetMouseDelta() : 0 + + if mouse_delta != 0 && first_delta { + mouse_delta = 0 + first_delta = false + } MOUSE_SENSE :: 0.005 GAMEPAD_SENSE :: 1