This commit is contained in:
Josh Deprez 2021-08-02 14:38:48 +10:00 committed by Josh Deprez
parent 4d6c6889de
commit 6e8a3e67df
2 changed files with 9 additions and 1 deletions

View file

@ -30,6 +30,7 @@ type ZPositioner interface {
// Scene manages drawing and updating a bunch of components.
type Scene struct {
Components []interface{}
Disabled bool
Hidden bool
ID
Transform GeoMDef
@ -69,6 +70,9 @@ func (s *Scene) Scan() []interface{} { return s.Components }
// Update calls Update on all Updater components.
func (s *Scene) Update() error {
if s.Disabled {
return nil
}
needsSort := false
curZ := -math.MaxFloat64 // fun fact: this is min float64
for _, c := range s.Components {

View file

@ -15,6 +15,7 @@ func init() {
// Tilemap renders a grid of tiles.
type Tilemap struct {
Disabled bool
Hidden bool
ID
Map [][]Tile
@ -45,6 +46,9 @@ func (t *Tilemap) Draw(screen *ebiten.Image, geom ebiten.GeoM) {
// Update calls Update on any tiles that are Updaters, e.g. AnimatedTile.
func (t *Tilemap) Update() error {
if t.Disabled {
return nil
}
for j := range t.Map {
for i := range t.Map[j] {
if tile, ok := t.Map[j][i].(Updater); ok {