comment clarifications

This commit is contained in:
Josh Deprez 2021-10-05 11:22:10 +11:00
parent 268be80ccc
commit 93113ca7d6

View file

@ -79,7 +79,9 @@ func (g *Game) Layout(outsideWidth, outsideHeight int) (w, h int) {
return g.ScreenSize.X, g.ScreenSize.Y return g.ScreenSize.X, g.ScreenSize.Y
} }
// Update updates everything. // Update updates everything. Subcomponents are updated before parent
// components. Disabled components, and components with a disabled ancestor, are
// not updated.
func (g *Game) Update() error { func (g *Game) Update() error {
return g.Query(g.Root, UpdaterType, return g.Query(g.Root, UpdaterType,
func(c interface{}) error { func(c interface{}) error {
@ -190,8 +192,8 @@ func (g *Game) ReversePath(component interface{}) []interface{} {
// //
// Query returns the first error returned from either visitor callback, except // Query returns the first error returned from either visitor callback, except
// Skip when it is returned from a recursive call. Returning Skip from visitPre // Skip when it is returned from a recursive call. Returning Skip from visitPre
// will cause the descendants of the component to be skipped (see the // will cause visitPost and the descendants of the component to be skipped (see
// implementation of Update for an example). // the implementation of Update for an example of how to use this).
func (g *Game) Query(ancestor interface{}, behaviour reflect.Type, visitPre, visitPost VisitFunc) error { func (g *Game) Query(ancestor interface{}, behaviour reflect.Type, visitPre, visitPost VisitFunc) error {
if visitPre != nil { if visitPre != nil {
if err := visitPre(ancestor); err != nil { if err := visitPre(ancestor); err != nil {