More comment
This commit is contained in:
parent
c30472c67e
commit
3f17821a0d
2 changed files with 6 additions and 9 deletions
|
@ -14,12 +14,12 @@ func init() {
|
||||||
type Game struct {
|
type Game struct {
|
||||||
ScreenWidth int
|
ScreenWidth int
|
||||||
ScreenHeight int
|
ScreenHeight int
|
||||||
Scene *Scene
|
*Scene
|
||||||
|
|
||||||
componentsByID map[string]interface{}
|
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) {
|
func (g *Game) Draw(screen *ebiten.Image) {
|
||||||
g.Scene.Draw(screen, ebiten.GeoM{})
|
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
|
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
|
// RegisterComponent tells the game there is a new component. Currently this is
|
||||||
// only necessary for components with IDs.
|
// only necessary for components with IDs.
|
||||||
func (g *Game) RegisterComponent(c interface{}) {
|
func (g *Game) RegisterComponent(c interface{}) {
|
||||||
|
|
|
@ -12,7 +12,8 @@ type Collider interface {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Drawer components can draw themselves. Draw is called often.
|
// 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 {
|
type Drawer interface {
|
||||||
Draw(screen *ebiten.Image, geom ebiten.GeoM)
|
Draw(screen *ebiten.Image, geom ebiten.GeoM)
|
||||||
}
|
}
|
||||||
|
@ -38,7 +39,8 @@ type Scanner interface {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Updater components can update themselves. Update is called repeatedly.
|
// 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 {
|
type Updater interface {
|
||||||
Update() error
|
Update() error
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue