Break flow out of ordoor
This commit is contained in:
@@ -5,6 +5,7 @@ import (
|
||||
"fmt"
|
||||
"log"
|
||||
"os"
|
||||
"runtime/debug"
|
||||
"runtime/pprof"
|
||||
|
||||
"github.com/hajimehoshi/ebiten"
|
||||
@@ -67,7 +68,18 @@ func (w *Window) Layout(_, _ int) (int, int) {
|
||||
return w.xRes, w.yRes
|
||||
}
|
||||
|
||||
func (w *Window) Update(screen *ebiten.Image) error {
|
||||
func (w *Window) Update(screen *ebiten.Image) (outErr error) {
|
||||
// Ebiten does not like it if we panic inside its main loop
|
||||
defer func() {
|
||||
if panicErr := recover(); panicErr != nil {
|
||||
if w.debug {
|
||||
debug.PrintStack()
|
||||
}
|
||||
|
||||
outErr = fmt.Errorf("Panic: %v", panicErr)
|
||||
}
|
||||
}()
|
||||
|
||||
if err := w.game.Update(screen.Size()); err != nil {
|
||||
return err
|
||||
}
|
||||
|
Reference in New Issue
Block a user