Browse Source

FIX: Capybara is now scaled better

master
parent
commit
cb32d1fb56
  1. 11
      src/main.go

11
src/main.go

@ -253,16 +253,15 @@ func (g *Game) Draw(screen *ebiten.Image) {
} }
capybaraBounds := g.ImageResources[capybaraKey].Bounds() capybaraBounds := g.ImageResources[capybaraKey].Bounds()
scaleX := float64(screen.Bounds().Dx()) / float64(capybaraBounds.Dx()) / 2.5 scale := float64(screen.Bounds().Dx()) / float64(capybaraBounds.Dx()) / 2.5
scaleY := float64(screen.Bounds().Dy()) / float64(capybaraBounds.Dy()) / 2.5
op.GeoM.Scale( op.GeoM.Scale(
scaleX+g.AnimationData.Squish, scale+g.AnimationData.Squish,
scaleY-g.AnimationData.Squish, scale-g.AnimationData.Squish,
) )
op.GeoM.Rotate(g.AnimationData.Theta) op.GeoM.Rotate(g.AnimationData.Theta)
capyWidth := float64(g.ImageResources[capybaraKey].Bounds().Dx()) * scaleX capyWidth := float64(g.ImageResources[capybaraKey].Bounds().Dx()) * scale
capyHeight := float64(g.ImageResources[capybaraKey].Bounds().Dy()) * scaleY capyHeight := float64(g.ImageResources[capybaraKey].Bounds().Dy()) * scale
op.GeoM.Translate( op.GeoM.Translate(
float64(screen.Bounds().Dx()/2)-capyWidth/2, float64(screen.Bounds().Dx()/2)-capyWidth/2,
float64(screen.Bounds().Dy()/2)-capyHeight/2, float64(screen.Bounds().Dy()/2)-capyHeight/2,

Loading…
Cancel
Save