comment time

This commit is contained in:
Josh Deprez 2021-08-01 17:14:57 +10:00 committed by Josh Deprez
parent ba7bfe62fc
commit 62f3086eb5

View file

@ -47,7 +47,8 @@ func (g *Game) Update() error {
return g.Scene.Update() return g.Scene.Update()
} }
// RegisterComponent tells the game there is a new component. // RegisterComponent tells the game there is a new component. Currently this is
// only necessary for components with IDs.
func (g *Game) RegisterComponent(c interface{}) { func (g *Game) RegisterComponent(c interface{}) {
i, ok := c.(Identifier) i, ok := c.(Identifier)
if !ok { if !ok {
@ -73,7 +74,7 @@ func (g *Game) UnregisterComponent(c interface{}) {
delete(g.componentsByID, id) delete(g.componentsByID, id)
} }
// Component returns the component with a given ID. // Component returns the component with a given ID, or nil if there is none.
func (g *Game) Component(id string) interface{} { return g.componentsByID[id] } func (g *Game) Component(id string) interface{} { return g.componentsByID[id] }
// Walk calls v with every component, for as long as visit returns true. // Walk calls v with every component, for as long as visit returns true.