Skip to content

Commit

Permalink
Updates docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Joel Schutz committed Nov 5, 2024
1 parent 4a3af1f commit fc7077d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func MaxInt(a, b int) int {
return b
}

// Pre-draw scenes
// Pre-draw returns the rendered frames for the given scenes.
func PreDraw[T any](bounds image.Rectangle, fromScene, toScene Scene[T]) (*ebiten.Image, *ebiten.Image) {
fromImg := ebiten.NewImage(bounds.Dx(), bounds.Dy())
fromScene.Draw(fromImg)
Expand Down
5 changes: 3 additions & 2 deletions transition.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ type SceneTransition[T any] interface {
End()
}

// A helper class that implements basic transition functionality
type BaseTransition[T any] struct {
fromScene Scene[T]
toScene Scene[T]
Expand All @@ -24,7 +25,7 @@ func (t *BaseTransition[T]) Start(fromScene, toScene Scene[T], sm SceneControlle
t.sm = sm
}

// Update updates the transition state
// Updates the transition state
func (t *BaseTransition[T]) Update() error {
// Update the scenes
err := t.fromScene.Update()
Expand All @@ -40,7 +41,7 @@ func (t *BaseTransition[T]) Update() error {
return nil
}

// Layout updates the layout of the scenes
// Layout updates the layout of the scenes and return the larger one
func (t *BaseTransition[T]) Layout(outsideWidth, outsideHeight int) (int, int) {
sw, sh := t.fromScene.Layout(outsideWidth, outsideHeight)
tw, th := t.toScene.Layout(outsideWidth, outsideHeight)
Expand Down

0 comments on commit fc7077d

Please sign in to comment.