2018-06-21 01:43:14 +00:00
|
|
|
package doodle
|
|
|
|
|
|
|
|
// Scene is an abstraction for a game mode in Doodle. The app points to one
|
|
|
|
// scene at a time and that scene has control over the main loop, and its own
|
|
|
|
// state information.
|
|
|
|
type Scene interface {
|
2018-06-21 02:00:46 +00:00
|
|
|
Name() string
|
2018-06-21 01:43:14 +00:00
|
|
|
Setup(*Doodle) error
|
|
|
|
Loop(*Doodle) error
|
|
|
|
}
|
|
|
|
|
|
|
|
// Goto a scene. First it unloads the current scene.
|
|
|
|
func (d *Doodle) Goto(scene Scene) error {
|
|
|
|
// d.scene.Destroy()
|
|
|
|
log.Info("Goto Scene")
|
|
|
|
d.scene = scene
|
|
|
|
return d.scene.Setup(d)
|
|
|
|
}
|