Documentation ¶
Overview ¶
Package bamenn provides the ability to manage Ebitengine game scenes.
Index ¶
- type LinearTransition
- type LinearTransitionDrawer
- type LinearTransitionProgress
- type OnArrivaler
- type OnDeparturer
- type OnEnder
- type OnStarter
- type Parallel
- func (p *Parallel) Draw(screen *ebiten.Image)
- func (p *Parallel) DrawFinalScreen(screen ebiten.FinalScreen, offScreen *ebiten.Image, geoM ebiten.GeoM)
- func (p *Parallel) Layout(outsideWidth, outsideHeight int) (screenWidth, screenHeight int)
- func (p *Parallel) LayoutF(outsideWidth, outsideHeight float64) (screenWidth, screenHeight float64)
- func (p *Parallel) OnArrival()
- func (p *Parallel) OnDeparture()
- func (p *Parallel) OnEnd()
- func (p *Parallel) OnStart()
- func (p *Parallel) Update() error
- type Sequence
- func (s *Sequence) Draw(screen *ebiten.Image)
- func (s *Sequence) DrawFinalScreen(screen ebiten.FinalScreen, offScreen *ebiten.Image, geoM ebiten.GeoM)
- func (s *Sequence) Layout(outsideWidth, outsideHeight int) (screenWidth, screenHeight int)
- func (s *Sequence) LayoutF(outsideWidth, outsideHeight float64) (screenWidth, screenHeight float64)
- func (s *Sequence) OnArrival()
- func (s *Sequence) OnDeparture()
- func (s *Sequence) OnEnd()
- func (s *Sequence) OnStart()
- func (s *Sequence) SetFirst(first ebiten.Game)
- func (s *Sequence) Switch(next ebiten.Game) bool
- func (s *Sequence) SwitchWithTransition(next ebiten.Game, transition Transition) bool
- func (s *Sequence) Update() error
- type Transition
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type LinearTransition ¶
type LinearTransition struct {
// contains filtered or unexported fields
}
LinearTransition is a Transition that transitions linearly for a specified number of frames.
func NewLinearTransition ¶
func NewLinearTransition(frameToSwitch, maxFrames int, drawer LinearTransitionDrawer) *LinearTransition
NewLinearTransition returns a new LinearTransition.
func (*LinearTransition) CanSwitchScenes ¶
func (t *LinearTransition) CanSwitchScenes() bool
CanSwitchScenes returns true when ebiten.Game, which represents a scene, can be switched. Even if true is returned at multiple frames during a single scene transition, the scene is switched only once. If CanSwitchScenes does not return true, the scene switch will occur when Completed returns true.
func (*LinearTransition) Completed ¶
func (t *LinearTransition) Completed() bool
Completed returns true when the scene transition is complete.
func (*LinearTransition) Draw ¶
func (t *LinearTransition) Draw(screen *ebiten.Image)
Draw draws during scene transitions. The argument screen reflects the result of drawing by ebiten.Game.Draw.
func (*LinearTransition) Progress ¶
func (t *LinearTransition) Progress() LinearTransitionProgress
Progress returns the progress of it.
func (*LinearTransition) Reset ¶
func (t *LinearTransition) Reset()
Reset is called at the start of a scene transition. If the same instance is to be used multiple times, Reset should be used to initialize the Transition state.
func (*LinearTransition) Update ¶
func (t *LinearTransition) Update() error
Update is called in ebiten.Game.Update to update the state of Transition.
type LinearTransitionDrawer ¶
type LinearTransitionDrawer interface { // Draw draws as the LinearTransition progresses. Draw(screen *ebiten.Image, progress LinearTransitionProgress) }
LinearTransitionDrawer is an interface that draws as the LinearTransition progresses.
type LinearTransitionProgress ¶
type LinearTransitionProgress struct { CurrentFrame int // CurrentFrame is the current frame. MaxFrames int // MaxFrames is the maximum number of frames. FrameToSwitch int // FrameToSwitch returns the frame to switch scenes. }
LinearTransitionProgress represents the progress of LinearTransition.
func (LinearTransitionProgress) Rate ¶
func (p LinearTransitionProgress) Rate() float64
Rate returns the progress rate of LinearTransition in the range of 0.0~1.0.
type OnArrivaler ¶
type OnArrivaler interface {
OnArrival()
}
OnArrivaler is an interface that executes processing when a scene begins and the beginning transition is completed.
type OnDeparturer ¶
type OnDeparturer interface {
OnDeparture()
}
OnDeparturer is an interface that executes processing when a scene ends and the ending transition begins.
type OnEnder ¶
type OnEnder interface {
// OnEnd is called just before the end of the scene.
OnEnd()
}
OnEnder is an interface that executes processing at the end of a scene.
type OnStarter ¶
type OnStarter interface {
// OnStart is called immediately after the start of the scene.
OnStart()
}
OnStarter is an interface that executes processing at the start of a scene.
type Parallel ¶
type Parallel struct {
// contains filtered or unexported fields
}
Parallel runs multiple Games in parallel.
func NewParallel ¶
func NewParallel(games ...ebiten.Game) *Parallel
NewParallel creates a new Parallel instance.
func (*Parallel) Draw ¶
func (p *Parallel) Draw(screen *ebiten.Image)
Draw is ebiten.Game implementation. it calls all ebiten.Game.Draw in the order of index.
func (*Parallel) DrawFinalScreen ¶
func (p *Parallel) DrawFinalScreen(screen ebiten.FinalScreen, offScreen *ebiten.Image, geoM ebiten.GeoM)
DrawFinalScreen is ebiten.FinalScreenDrawer implementation. It calls only the DrawFinalScreen of the lowest index that implements FinalScreenDrawer among the Games it holds.
func (*Parallel) Layout ¶
Layout is ebiten.Game implementation. It returns the largest width and height of all Layouts.
func (*Parallel) LayoutF ¶
LayoutF is ebiten.LayoutFer implementation. It returns the largest width and height of all LayoutFs.
func (*Parallel) OnArrival ¶
func (p *Parallel) OnArrival()
OnArrival is OnArrivaler implementation. it calls all OnArrivaler.OnArrival in the order of index if implemented.
func (*Parallel) OnDeparture ¶
func (p *Parallel) OnDeparture()
OnDeparture is OnDeparturer implementation. it calls all OnDeparturer.OnDeparture in the order of index if implemented.
func (*Parallel) OnEnd ¶
func (p *Parallel) OnEnd()
OnEnd is OnEnder implementation. it calls all OnEnder.OnEnd in the order of index if implemented.
type Sequence ¶
type Sequence struct {
// contains filtered or unexported fields
}
Sequence provides the ability to run multiple ebiten.Games in sequence.
func NewSequence ¶
func NewSequence(first ebiten.Game) *Sequence
NewSequence creates a new Sequence instance with the first scene.
func (*Sequence) Draw ¶
func (s *Sequence) Draw(screen *ebiten.Image)
Draw is ebiten.Game implementation.
func (*Sequence) DrawFinalScreen ¶
func (s *Sequence) DrawFinalScreen(screen ebiten.FinalScreen, offScreen *ebiten.Image, geoM ebiten.GeoM)
DrawFinalScreen is ebiten.FinalScreenDrawer implementation.
func (*Sequence) OnArrival ¶
func (s *Sequence) OnArrival()
OnArrival is OnArrivaler implementation.
func (*Sequence) OnDeparture ¶
func (s *Sequence) OnDeparture()
OnDeparture is OnDeparturer implementation.
func (*Sequence) SetFirst ¶ added in v0.2.0
func (s *Sequence) SetFirst(first ebiten.Game)
SetFirst sets the first scene to be handled by it. It is intended for use when setting up the first scene. Do not use it to switch between scenes.
func (*Sequence) SwitchWithTransition ¶
func (s *Sequence) SwitchWithTransition(next ebiten.Game, transition Transition) bool
SwitchWithTransition switches the ebiten.Game to run in Sequence with the Transition.
type Transition ¶
type Transition interface { // Reset is called at the start of a scene transition. // If the same instance is to be used multiple times, Reset should be used to initialize the Transition state. Reset() // Update is called in ebiten.Game.Update to update the state of Transition. Update() error // Draw draws during scene transitions. // The argument screen reflects the result of drawing by ebiten.Game.Draw. Draw(screen *ebiten.Image) // Completed returns true when the scene transition is complete. Completed() bool // CanSwitchScenes returns true when ebiten.Game, which represents a scene, can be switched. // Even if true is returned at multiple frames during a single scene transition, the scene is switched only once. // If CanSwitchScenes does not return true, the scene switch will occur when Completed returns true. CanSwitchScenes() bool }
Transition is an interface for drawing during scene transitions.
var NopTransition Transition = nopTransition{}
NopTransition is a Transition that does not draw anything.