mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-11-10 04:57:26 +01:00
internal/processteset/testdta: bug fix: compile error
This commit is contained in:
parent
67178c9534
commit
966823e445
7
internal/processtest/testdata/issue2362.go
vendored
7
internal/processtest/testdata/issue2362.go
vendored
@ -18,19 +18,22 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"image/color"
|
"image/color"
|
||||||
|
|
||||||
"github.com/hajimehoshi/ebiten/v2"
|
"github.com/hajimehoshi/ebiten/v2"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var regularTermination = errors.New("regular termination")
|
||||||
|
|
||||||
type Game struct {
|
type Game struct {
|
||||||
drawCount int
|
drawCount int
|
||||||
}
|
}
|
||||||
|
|
||||||
func (g *Game) Update() error {
|
func (g *Game) Update() error {
|
||||||
if g.drawCount == 2 {
|
if g.drawCount == 2 {
|
||||||
return ebiten.Termination
|
return regularTermination
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@ -56,7 +59,7 @@ func main() {
|
|||||||
ebiten.SetWindowTitle("Test")
|
ebiten.SetWindowTitle("Test")
|
||||||
ebiten.SetScreenClearedEveryFrame(false)
|
ebiten.SetScreenClearedEveryFrame(false)
|
||||||
|
|
||||||
if err := ebiten.RunGame(&Game{}); err != nil {
|
if err := ebiten.RunGame(&Game{}); err != nil && !errors.Is(err, regularTermination) {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user