mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-01-11 19:48:54 +01:00
examples/camera: Add limitations to the zoom factor
This commit is contained in:
parent
8803138464
commit
9ac7a16333
@ -148,10 +148,14 @@ func (g *Game) Update(screen *ebiten.Image) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ebiten.IsKeyPressed(ebiten.KeyQ) {
|
if ebiten.IsKeyPressed(ebiten.KeyQ) {
|
||||||
g.camera.ZoomFactor -= 1
|
if g.camera.ZoomFactor > -240 {
|
||||||
|
g.camera.ZoomFactor -= 1
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if ebiten.IsKeyPressed(ebiten.KeyE) {
|
if ebiten.IsKeyPressed(ebiten.KeyE) {
|
||||||
g.camera.ZoomFactor += 1
|
if g.camera.ZoomFactor < 240 {
|
||||||
|
g.camera.ZoomFactor += 1
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ebiten.IsKeyPressed(ebiten.KeyR) {
|
if ebiten.IsKeyPressed(ebiten.KeyR) {
|
||||||
|
Loading…
Reference in New Issue
Block a user