This package provides a Scene interface and Scene Director struct for use in game dev. The stack it uses is thread safe.
The Scene Director operates on structs implementing IScene
however this interface intentionally doesn't provide an update
or draw
methods. That is up to you to implement in your extension to IScene
.
For example, you might have your own Scene
interface such as:
type Scene interface {
scenes.IScene
Draw()
HandleEvent(ev tcell.Event) bool
}
You would then cast the return of PeekState()
to your required interface like so:
scene := director.PeekState().(Scene)
scene.Draw()
A full working demonstration can be found at https://github.com/go-rogue/scenes-demo