More comment

This commit is contained in:
Josh Deprez 2021-08-05 12:40:32 +10:00 committed by Josh Deprez
parent c30472c67e
commit 3f17821a0d
2 changed files with 6 additions and 9 deletions

View file

@ -14,12 +14,12 @@ func init() {
type Game struct {
ScreenWidth int
ScreenHeight int
Scene *Scene
*Scene
componentsByID map[string]interface{}
}
// Draw draws the entire thing.
// Draw draws the entire thing, with no geometric transform.
func (g *Game) Draw(screen *ebiten.Image) {
g.Scene.Draw(screen, ebiten.GeoM{})
}
@ -29,11 +29,6 @@ func (g *Game) Layout(outsideWidth, outsideHeight int) (w, h int) {
return g.ScreenWidth, g.ScreenHeight
}
// Update just passes the call onto Layers.
func (g *Game) Update() error {
return g.Scene.Update()
}
// RegisterComponent tells the game there is a new component. Currently this is
// only necessary for components with IDs.
func (g *Game) RegisterComponent(c interface{}) {

View file

@ -12,7 +12,8 @@ type Collider interface {
}
// Drawer components can draw themselves. Draw is called often.
// Each component is responsible for calling Draw on its child components.
// Each component is responsible for calling Draw on its child components
// (so that hiding the parent can hide the children, etc).
type Drawer interface {
Draw(screen *ebiten.Image, geom ebiten.GeoM)
}
@ -38,7 +39,8 @@ type Scanner interface {
}
// Updater components can update themselves. Update is called repeatedly.
// Each component is responsible for calling Update on its child components.
// Each component is responsible for calling Update on its child components
// (so that disabling the parent prevents updates to the children, etc).
type Updater interface {
Update() error
}