-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathscene.go
More file actions
26 lines (21 loc) · 695 Bytes
/
scene.go
File metadata and controls
26 lines (21 loc) · 695 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
package stagehand
import (
ebiten "github.com/hajimehoshi/ebiten/v2"
)
type ProtoScene[T any] interface {
ebiten.Game
}
type SceneController[T any] interface {
// *SceneManager[T] | *SceneDirector[T]
ReturnFromTransition(scene, orgin Scene[T])
}
type Scene[T any] interface {
ProtoScene[T]
Load(T, SceneController[T]) // Runs when scene is first started, must keep state and SceneManager
Unload() T // Runs when scene is discarted, must return last state
}
type TransitionAwareScene[T any] interface {
Scene[T]
PreTransition(Scene[T]) T // Runs before new scene is loaded, must return last state
PostTransition(T, Scene[T]) // Runs when old scene is unloaded
}