unregister uses g.children; add TODO in DrawDFS
This commit is contained in:
parent
c23b149a84
commit
db5a10a14b
2 changed files with 3 additions and 5 deletions
|
@ -56,6 +56,7 @@ func (d *DrawDFS) drawRecursive(component interface{}, screen *ebiten.Image, opt
|
|||
return
|
||||
}
|
||||
// Has subcomponents? recurse
|
||||
// TODO: use g.Children or g.Query - but need to go in Scan order...
|
||||
if sc, ok := component.(Scanner); ok {
|
||||
sc.Scan(func(x interface{}) error {
|
||||
d.drawRecursive(x, screen, opts)
|
||||
|
|
|
@ -348,11 +348,8 @@ func (g *Game) Unregister(component interface{}) {
|
|||
}
|
||||
|
||||
func (g *Game) unregisterRecursive(component interface{}) {
|
||||
if sc, ok := component.(Scanner); ok {
|
||||
sc.Scan(func(x interface{}) error {
|
||||
for x := range g.children[component] {
|
||||
g.unregisterRecursive(x)
|
||||
return nil
|
||||
})
|
||||
}
|
||||
g.unregisterOne(component)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue