From fc7077d47e14b5604f2b1cd72a6e903cc1bb1b44 Mon Sep 17 00:00:00 2001 From: Joel Schutz Date: Mon, 4 Nov 2024 21:59:06 -0300 Subject: [PATCH] Updates docs --- helpers.go | 2 +- transition.go | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/helpers.go b/helpers.go index b904a4b..caa5405 100644 --- a/helpers.go +++ b/helpers.go @@ -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) diff --git a/transition.go b/transition.go index 8ff2abc..7d0683a 100644 --- a/transition.go +++ b/transition.go @@ -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] @@ -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() @@ -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)