diff --git a/examples/hsv/main.go b/examples/hsv/main.go index c9e0847a1..b2a44716e 100644 --- a/examples/hsv/main.go +++ b/examples/hsv/main.go @@ -31,8 +31,8 @@ import ( ) const ( - screenWidth = 320 - screenHeight = 240 + screenWidth = 640 + screenHeight = 480 ) var ( @@ -103,7 +103,9 @@ func (g *Game) Draw(screen *ebiten.Image) { // Center the image on the screen. w, h := gophersImage.Size() op := &ebiten.DrawImageOptions{} - op.GeoM.Translate(float64(screenWidth-w)/2, float64(screenHeight-h)/2) + op.GeoM.Translate(-float64(w)/2, -float64(h)/2) + op.GeoM.Scale(2, 2) + op.GeoM.Translate(float64(screenWidth)/2, float64(screenHeight)/2) // Change HSV. hue := float64(g.hue128) * 2 * math.Pi / 128 @@ -151,7 +153,7 @@ func main() { } gophersImage = ebiten.NewImageFromImage(img) - ebiten.SetWindowSize(screenWidth*2, screenHeight*2) + ebiten.SetWindowSize(screenWidth, screenHeight) ebiten.SetWindowTitle("HSV (Ebiten Demo)") if err := ebiten.RunGame(NewGame()); err != nil { log.Fatal(err) diff --git a/examples/hue/main.go b/examples/hue/main.go index b7a6e0031..7a0b34aa8 100644 --- a/examples/hue/main.go +++ b/examples/hue/main.go @@ -28,8 +28,8 @@ import ( ) const ( - screenWidth = 320 - screenHeight = 240 + screenWidth = 640 + screenHeight = 480 ) var ( @@ -49,7 +49,9 @@ func (g *Game) Draw(screen *ebiten.Image) { // Center the image on the screen. w, h := gophersImage.Size() op := &ebiten.DrawImageOptions{} - op.GeoM.Translate(float64(screenWidth-w)/2, float64(screenHeight-h)/2) + op.GeoM.Translate(-float64(w)/2, -float64(h)/2) + op.GeoM.Scale(2, 2) + op.GeoM.Translate(float64(screenWidth)/2, float64(screenHeight)/2) // Rotate the hue. op.ColorM.RotateHue(float64(g.count%360) * 2 * math.Pi / 360) @@ -77,7 +79,7 @@ func main() { } gophersImage = ebiten.NewImageFromImage(img) - ebiten.SetWindowSize(screenWidth*2, screenHeight*2) + ebiten.SetWindowSize(screenWidth, screenHeight) ebiten.SetWindowTitle("Hue (Ebiten Demo)") if err := ebiten.RunGame(&Game{}); err != nil { log.Fatal(err)