mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-24 10:48: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 (
|
const (
|
||||||
screenWidth = 320
|
screenWidth = 640
|
||||||
screenHeight = 240
|
screenHeight = 480
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@ -103,7 +103,9 @@ func (g *Game) Draw(screen *ebiten.Image) {
|
|||||||
// Center the image on the screen.
|
// Center the image on the screen.
|
||||||
w, h := gophersImage.Size()
|
w, h := gophersImage.Size()
|
||||||
op := &ebiten.DrawImageOptions{}
|
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.
|
// Change HSV.
|
||||||
hue := float64(g.hue128) * 2 * math.Pi / 128
|
hue := float64(g.hue128) * 2 * math.Pi / 128
|
||||||
@ -151,7 +153,7 @@ func main() {
|
|||||||
}
|
}
|
||||||
gophersImage = ebiten.NewImageFromImage(img)
|
gophersImage = ebiten.NewImageFromImage(img)
|
||||||
|
|
||||||
ebiten.SetWindowSize(screenWidth*2, screenHeight*2)
|
ebiten.SetWindowSize(screenWidth, screenHeight)
|
||||||
ebiten.SetWindowTitle("HSV (Ebiten Demo)")
|
ebiten.SetWindowTitle("HSV (Ebiten Demo)")
|
||||||
if err := ebiten.RunGame(NewGame()); err != nil {
|
if err := ebiten.RunGame(NewGame()); err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
|
@ -28,8 +28,8 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
screenWidth = 320
|
screenWidth = 640
|
||||||
screenHeight = 240
|
screenHeight = 480
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@ -49,7 +49,9 @@ func (g *Game) Draw(screen *ebiten.Image) {
|
|||||||
// Center the image on the screen.
|
// Center the image on the screen.
|
||||||
w, h := gophersImage.Size()
|
w, h := gophersImage.Size()
|
||||||
op := &ebiten.DrawImageOptions{}
|
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.
|
// Rotate the hue.
|
||||||
op.ColorM.RotateHue(float64(g.count%360) * 2 * math.Pi / 360)
|
op.ColorM.RotateHue(float64(g.count%360) * 2 * math.Pi / 360)
|
||||||
@ -77,7 +79,7 @@ func main() {
|
|||||||
}
|
}
|
||||||
gophersImage = ebiten.NewImageFromImage(img)
|
gophersImage = ebiten.NewImageFromImage(img)
|
||||||
|
|
||||||
ebiten.SetWindowSize(screenWidth*2, screenHeight*2)
|
ebiten.SetWindowSize(screenWidth, screenHeight)
|
||||||
ebiten.SetWindowTitle("Hue (Ebiten Demo)")
|
ebiten.SetWindowTitle("Hue (Ebiten Demo)")
|
||||||
if err := ebiten.RunGame(&Game{}); err != nil {
|
if err := ebiten.RunGame(&Game{}); err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
|
Loading…
Reference in New Issue
Block a user