Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type State ¶
type State interface { // Executed when the state begins OnStart(world w.World) // Executed when the state exits OnStop(world w.World) // Executed when a new state is pushed over this one OnPause(world w.World) // Executed when the state become active again (states pushed over this one have been popped) OnResume(world w.World) // Executed on every frame when the state is active Update(world w.World) Transition // 描画 Draw(world w.World, screen *ebiten.Image) }
State is a game state
type StateMachine ¶
type StateMachine struct {
// contains filtered or unexported fields
}
StateMachine contains a stack of states. Only the top state is active.
func Init ¶
func Init(s State, world w.World) StateMachine
Init creates a new state machine with an initial state
func (*StateMachine) Draw ¶
func (sm *StateMachine) Draw(world w.World, screen *ebiten.Image)
Draw draws the screen after a state update
func (*StateMachine) Update ¶
func (sm *StateMachine) Update(world w.World)
Update updates the state machine
type TransType ¶
type TransType int
TransType is a transition type
const ( // TransNone does nothing TransNone TransType = iota // TransPop removes the active state and resume the next state TransPop // TransPush pauses the active state and add new states to the stack TransPush // TransSwitch removes the active state and replace it by a new one TransSwitch // TransReplace removes all states and insert a new stack TransReplace // TransQuit removes all states and quit TransQuit )
type Transition ¶
Transition is a state transition
Click to show internal directories.
Click to hide internal directories.