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
|
return
|
||||||
}
|
}
|
||||||
// Has subcomponents? recurse
|
// Has subcomponents? recurse
|
||||||
|
// TODO: use g.Children or g.Query - but need to go in Scan order...
|
||||||
if sc, ok := component.(Scanner); ok {
|
if sc, ok := component.(Scanner); ok {
|
||||||
sc.Scan(func(x interface{}) error {
|
sc.Scan(func(x interface{}) error {
|
||||||
d.drawRecursive(x, screen, opts)
|
d.drawRecursive(x, screen, opts)
|
||||||
|
|
|
@ -348,11 +348,8 @@ func (g *Game) Unregister(component interface{}) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (g *Game) unregisterRecursive(component interface{}) {
|
func (g *Game) unregisterRecursive(component interface{}) {
|
||||||
if sc, ok := component.(Scanner); ok {
|
for x := range g.children[component] {
|
||||||
sc.Scan(func(x interface{}) error {
|
g.unregisterRecursive(x)
|
||||||
g.unregisterRecursive(x)
|
|
||||||
return nil
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
g.unregisterOne(component)
|
g.unregisterOne(component)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue