Added zoom limits
parent
c0db69bd76
commit
c12d278d80
|
@ -78,6 +78,9 @@ struct Game {
|
|||
}
|
||||
|
||||
impl Game {
|
||||
const ZOOM_MIN: Pfloat = 200.0;
|
||||
const ZOOM_MAX: Pfloat = 2000.0;
|
||||
|
||||
fn new() -> Self {
|
||||
Game {
|
||||
last_update: Instant::now(),
|
||||
|
@ -119,7 +122,8 @@ impl Game {
|
|||
}
|
||||
|
||||
if self.input.v_scroll != 0.0 {
|
||||
self.camera.zoom += self.input.v_scroll;
|
||||
self.camera.zoom =
|
||||
(self.camera.zoom + self.input.v_scroll).clamp(Self::ZOOM_MIN, Self::ZOOM_MAX);
|
||||
self.input.v_scroll = 0.0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue