doodle/scene.go
Noah Petherbridge 9356502a50 Implement Developer Console with Initial Commands
Implements the dev console in-game with various commands to start out
with.

Press the Enter key to show or hide the console. Commands supported:

new
    Start a new map in Edit Mode.

save [filename.json]
    Save the current map to disk. Filename is required unless you
    have saved recently.

edit filename.json
    Open a map from disk in Edit Mode.

play filename.json
    Play a map from disk in Play Mode.
2018-07-21 20:43:01 -07:00

27 lines
704 B
Go

package doodle
import "git.kirsle.net/apps/doodle/events"
// 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 {
Name() string
Setup(*Doodle) error
// Loop should update the scene's state but not draw anything.
Loop(*Doodle, *events.State) error
// Draw should use the scene's state to figure out what pixels need
// to draw to the screen.
Draw(*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)
}