Skip to content

Commit

Permalink
fix: Zoom camera only when in debug mode
Browse files Browse the repository at this point in the history
  • Loading branch information
PraxTube committed Dec 20, 2023
1 parent 941434c commit d0ee508
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "magus-parvus"
version = "0.1.2"
version = "0.1.3"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
Expand Down
6 changes: 6 additions & 0 deletions src/world/camera.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ use bevy_rapier2d::dynamics::Velocity;
use super::camera_shake::{update_camera, CameraShake};
use crate::player::input::PlayerInput;
use crate::player::{Player, PlayerState};
use crate::spell::debug_spell::DebugSpell;
use crate::GameState;

// How much `1.0` in bevy coordinates translates to the pixels of a sprite.
Expand Down Expand Up @@ -50,9 +51,14 @@ fn update_camera_target(
}

fn zoom_camera(
debug_spell: Res<DebugSpell>,
mut q_projection: Query<&mut OrthographicProjection, With<MainCamera>>,
player_input: Res<PlayerInput>,
) {
if !debug_spell.active {
return;
}

let mut projection = match q_projection.get_single_mut() {
Ok(p) => p,
Err(_) => return,
Expand Down

0 comments on commit d0ee508

Please sign in to comment.