mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-24 02:38:53 +01:00
examples/hsv, examples/hue: Use wider screens
This commit is contained in:
parent
c950e03fb1
commit
ed4dded094
@ -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)
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user