save
All checks were successful
Rust Checks / checks (push) Successful in 4m10s
Rust Checks / checks (pull_request) Successful in 2m37s

This commit is contained in:
CoCo_Sol 2024-03-01 07:52:57 +01:00
parent 2af9dd5fe1
commit 382d1c102d

View file

@ -56,7 +56,13 @@ fn init_camera(mut commands: Commands) {
commands.spawn(Camera2dBundle::default());
}
/// Initializes the key movement settings for the camera.
/// Initializes the resources related to the camera.
///
/// - [KeysMovementSettings]: The key settings for camera movement.
/// - [CameraSpeedMouvement]: The speed of camera movement.
/// - [CameraSpeedScale]: The speed of camera scaling.
/// - [MinScale]: The minimum scale of the camera.
/// - [MaxScale]: The maximum scale of the camera.
fn init_resources(mut commands: Commands) {
commands.insert_resource(KeysMovementSettings {
up: KeyCode::Z,
@ -94,15 +100,15 @@ fn movement_system(
}
}
/// Scales the camera with mouse input.
/// Scales the view with mouse input.
fn scale_system(
mut scroll_ev: EventReader<MouseWheel>,
mut scroll_event: EventReader<MouseWheel>,
mut query: Query<&mut OrthographicProjection, With<Camera>>,
min_scale: Res<MinScale>,
max_scale: Res<MaxScale>,
scale_speed: Res<CameraSpeedScale>,
) {
for ev in scroll_ev.read() {
for ev in scroll_event.read() {
for mut projection in query.iter_mut() {
if ev.unit != MouseScrollUnit::Line {
return;