From 3f17821a0de673e8ba55570a646a13078f527076 Mon Sep 17 00:00:00 2001 From: Josh Deprez Date: Thu, 5 Aug 2021 12:40:32 +1000 Subject: [PATCH] More comment --- engine/game.go | 9 ++------- engine/interface.go | 6 ++++-- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/engine/game.go b/engine/game.go index 4c6e9d0..8ddbb49 100644 --- a/engine/game.go +++ b/engine/game.go @@ -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{}) { diff --git a/engine/interface.go b/engine/interface.go index f59cb5f..74bbb12 100644 --- a/engine/interface.go +++ b/engine/interface.go @@ -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 }