-func get_camera_input_direction() -> Vector2:
- return Input.get_vector(
- "camera-left", "camera-right", "camera-up", "camera-down"
- )
+var camera_input_method := CameraInput.MOUSE
+var camera_input_direction := Vector2.ZERO
+
+
+func _unhandled_input(event: InputEvent) -> void:
+ # If user clicks on the window, capture the mouse and direct the camera with it
+ if Input.get_mouse_mode() != Input.MOUSE_MODE_CAPTURED:
+ return
+
+ if event is InputEventMouseMotion:
+ camera_input_method = CameraInput.MOUSE
+ camera_input_direction = event.screen_relative
+ elif event is InputEventJoypadMotion:
+ # TODO: add these settings!
+ camera_input_method = CameraInput.JOYSTICK
+ camera_input_direction = Input.get_vector(
+ "camera-left", "camera-right", "camera-up", "camera-down"
+ )