summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMicha White <botahamec@outlook.com>2022-10-12 11:36:58 -0400
committerMicha White <botahamec@outlook.com>2022-10-12 11:36:58 -0400
commit3352e94bade525c9922b448208b1e6c44fc3340d (patch)
treec1d3d4606394da9cdccba3b5670806d7a13942dd /src
parentd88e1dc1643c04377b685bc7409cb7bcbd82c019 (diff)
Changed assertions to logs
Diffstat (limited to 'src')
-rw-r--r--src/camera.rs36
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;
}