Ledger
Overseer.AbstractLedger — TypeAbstract type for all ECS ledgers. The easiest way to use the interface is by including a standard Ledger as a member field and defining ledger for your new AbstractLedger type to return that field.
Overseer.Ledger — TypeA Ledger holds all the Entities, Components and Systems. It has interfaces to create new Entities and access the Components. Calling update(ledger) will call all the update functions of the systems in the Ledger.
Example
l = Ledger()
e1 = Entity(l, CompType1(1, 2))
e2 = Entity(l, CompType1(1, 2), CompType2("comptype2"))this has created a new Ledger with two Entities, the first having 1 component of type CompType1, the second has 2 components.
l[e1]Will return an EntityState, essentially a bag of Components e1 belongs to.
l[CompType1]returns the AbstractComponent holding the data of type CompType1.
Overseer.ledger — Functionledger(l::AbstractLedger)Returns the underlying standard Ledger. This is the preferred method to create new AbstractLedgers.
Example
struct MyLedger <: AbstractLedger
base_ledger::Ledger
# other fields
end
Overseer.ledger(m::MyLedger) = m.base_ledger
# Now you can use MyLedger identically to the standard LedgerOverseer.update — Methodupdate(ledger)Updates sequentially all Stages that are in the ledger.
Base.delete! — Methoddelete!(ledger, entity)Immediately removes the data of an Entity from all components, after which the entity itself is removed from the Ledger.
Overseer.schedule_delete! — Functionschedule_delete!(ledger, entity)Schedules an Entity to be deleted with delete_scheduled!. This can be useful when wanting to delete entities during iteration which does not guarantee that all entities would be visited when using standard delete!.
Overseer.delete_scheduled! — Functiondelete_scheduled!(ledger)Deletes all the Entities that were previously scheduled for deletion with schedule_delete!.