examples/camera: Add limitations to the zoom factor

This commit is contained in:
Hajime Hoshi 2020-09-21 01:13:00 +09:00
parent 8803138464
commit 9ac7a16333

View File

@ -148,10 +148,14 @@ func (g *Game) Update(screen *ebiten.Image) error {
}
if ebiten.IsKeyPressed(ebiten.KeyQ) {
g.camera.ZoomFactor -= 1
if g.camera.ZoomFactor > -240 {
g.camera.ZoomFactor -= 1
}
}
if ebiten.IsKeyPressed(ebiten.KeyE) {
g.camera.ZoomFactor += 1
if g.camera.ZoomFactor < 240 {
g.camera.ZoomFactor += 1
}
}
if ebiten.IsKeyPressed(ebiten.KeyR) {