diff options
Diffstat (limited to 'src/camera.rs')
| -rw-r--r-- | src/camera.rs | 36 |
1 files changed, 20 insertions, 16 deletions
diff --git a/src/camera.rs b/src/camera.rs index 3bd729d..edc3405 100644 --- a/src/camera.rs +++ b/src/camera.rs @@ -109,28 +109,32 @@ impl Camera { /// Set the position of the camera pub fn set_position(&mut self, x: f32, y: f32) { - debug_assert!( - (-1000.0..1000.0).contains(&x) && (-1000.0..1000.0).contains(&y), - "The position of the camera is (x: {}, y: {}). \ - Please keep both the x and y positions above -1000 and below 1000 units. \ - Otherwise, everything will look crazy. \ - For an explanation, see https://www.youtube.com/watch?v=Q2OGwnRik24", - x, - y - ); + #[cfg(debug_assertions)] + if !(-1000.0..1000.0).contains(&x) || !(-1000.0..1000.0).contains(&y) { + log::warn!( + "The position of the camera is (x: {}, y: {}). \ + Please keep both the x and y positions above -1000 and below 1000 units. \ + Otherwise, everything will look crazy. \ + For an explanation, see https://www.youtube.com/watch?v=Q2OGwnRik24", + x, + y + ); + } self.position = (x, y); } /// Set the zoom of the camera pub fn set_zoom(&mut self, zoom: f32) { - debug_assert!( - (-1000.0..1000.0).contains(&zoom), - "The zoom of the camera is {}. \ - Please keep above -1000, and below 1000, or else smooth zoom may be difficult. \ - For an explanation, see https://www.youtube.com/watch?v=Q2OGwnRik24", - zoom - ); + #[cfg(debug_assertions)] + if !(-1000.0..1000.0).contains(&zoom) { + log::warn!( + "The zoom of the camera is {}. \ + Please keep above -1000, and below 1000, or else smooth zoom may be difficult. \ + For an explanation, see https://www.youtube.com/watch?v=Q2OGwnRik24", + zoom + ); + } self.zoom = zoom; } |
