examples/rotate: Revert resizeable window

This was accidentally introduced at 9ed8279fc8.
This commit is contained in:
Hajime Hoshi 2020-02-06 03:05:28 +09:00
parent d6d17a7e85
commit 67b166f732

View File

@ -37,13 +37,7 @@ var (
gophersImage *ebiten.Image gophersImage *ebiten.Image
) )
type Game struct{} func update(screen *ebiten.Image) error {
func (g *Game) Layout(outsideWidth, outsideHeight int) (int, int) {
return outsideWidth, outsideHeight
}
func (g *Game) Update(screen *ebiten.Image) error {
count++ count++
if ebiten.IsDrawingSkipped() { if ebiten.IsDrawingSkipped() {
return nil return nil
@ -61,8 +55,7 @@ func (g *Game) Update(screen *ebiten.Image) error {
op.GeoM.Rotate(float64(count%360) * 2 * math.Pi / 360) op.GeoM.Rotate(float64(count%360) * 2 * math.Pi / 360)
// Move the image to the screen's center. // Move the image to the screen's center.
sw, sh := screen.Size() op.GeoM.Translate(screenWidth/2, screenHeight/2)
op.GeoM.Translate(float64(sw)/2, float64(sh)/2)
screen.DrawImage(gophersImage, op) screen.DrawImage(gophersImage, op)
return nil return nil
@ -84,11 +77,7 @@ func main() {
} }
gophersImage, _ = ebiten.NewImageFromImage(img, ebiten.FilterDefault) gophersImage, _ = ebiten.NewImageFromImage(img, ebiten.FilterDefault)
g := &Game{} if err := ebiten.Run(update, screenWidth, screenHeight, 2, "Rotate (Ebiten Demo)"); err != nil {
ebiten.SetWindowSize(screenWidth, screenHeight)
ebiten.SetWindowTitle("Rotate (Resizable Window Demo)")
ebiten.SetWindowResizable(true)
if err := ebiten.RunGame(g); err != nil {
log.Fatal(err) log.Fatal(err)
} }
} }