Skip to content

Commit

Permalink
Added debug features
Browse files Browse the repository at this point in the history
  • Loading branch information
sedyh committed Dec 25, 2021
1 parent 2cd42ba commit fe065ba
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions pkg/engine/world.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ type World interface {
AddSystems(systems ...interface{}) // Adds a system that will work with each entity by its components.
AddEntities(entities ...interface{}) // Adds an entities that will represent your objects.
RemoveEntity(entity Entity) // Removes an entity.
Components() int // Get current amount of registered components.
Systems() int // Get current amount of added systems.
Entities() int // Get current amount of added entities.
}

// world is an internal struct, which implements both engine.World and ebiten.Game interfaces
Expand All @@ -34,9 +37,6 @@ type world struct {
once sync.Once
}

// factory is a type responsible for creating world components in any order within the scene
type factory func(values ...interface{})

// NewGame creates world and returns ebiten.Game, which you can use right away,
// or embed in your own ebiten.Game implementation if you want to add your own
// behavior there (for example, change the logical resolution which is same
Expand Down Expand Up @@ -161,3 +161,18 @@ func (w *world) RemoveEntity(e Entity) {
}
}
}

// Components returns current amount of registered components.
func (w *world) Components() int {
return len(w.stores)
}

// Systems returns current amount of added systems.
func (w *world) Systems() int {
return len(w.systems)
}

// Entities returns current amount of added entities.
func (w *world) Entities() int {
return len(w.entities)
}

0 comments on commit fe065ba

Please sign in to comment.