mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-11-10 04:57:26 +01:00
mobile: Throw error when update is called without starting (#311)
This commit is contained in:
parent
3b9e6c2708
commit
fd71c86e20
@ -23,15 +23,22 @@ import (
|
||||
"github.com/hajimehoshi/ebiten/internal/ui"
|
||||
)
|
||||
|
||||
var chError <-chan error
|
||||
var (
|
||||
chError <-chan error
|
||||
running bool
|
||||
)
|
||||
|
||||
func update() error {
|
||||
if chError == nil {
|
||||
return errors.New("mobile: chError must not be nil: Start is not called yet?")
|
||||
}
|
||||
if !running {
|
||||
return errors.New("mobile: start must be called ahead of update")
|
||||
}
|
||||
return ui.Render(chError)
|
||||
}
|
||||
|
||||
func start(f func(*ebiten.Image) error, width, height int, scale float64, title string) {
|
||||
running = true
|
||||
chError = ebiten.RunWithoutMainLoop(f, width, height, scale, title)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user