harmboschloo/elm-ecs/1.0.0

NOTE: the latest version is 2.0.0

Ecs

Model

empty : Spec comparable ecs -> ecs

Create an empty ecs.

isEmpty : Spec comparable ecs -> ecs -> Bool

Determine if the ecs is empty

entityCount : Spec comparable ecs -> ecs -> Int

Determine the total number of entities in the ecs. Warning: this is an expensive operation.

componentCount : Spec comparable ecs -> ecs -> Int

Determine the total number of components in the ecs.

ids : Spec comparable ecs -> ecs -> Set comparable

Get all entity ids in the ecs. Warning: this is an expensive operation.

Entity

member : Spec comparable ecs -> comparable -> ecs -> Bool

Determine if an entity is in the ecs.

clear : Spec comparable ecs -> comparable -> ecs -> ecs

Remove all components of an entity.

Component

has : ComponentSpec comparable ecs a -> comparable -> ecs -> Bool

Determines if an entity has a specific component.

get : ComponentSpec comparable ecs a -> comparable -> ecs -> Maybe a

Get a specific component of an entity.

insert : ComponentSpec comparable ecs a -> comparable -> a -> ecs -> ecs

Insert a specific component in an entity.

ComponentSpec comparable ecs a
-> comparable
-> (Maybe a -> Maybe a)
-> ecs
-> ecs

Update a specific component in an entity.

remove : ComponentSpec comparable ecs a -> comparable -> ecs -> ecs

Remove a specific component from an entity.

size : ComponentSpec comparable ecs a -> ecs -> Int

Determine the total number of components of a specific type.

Apply Selectors

select : Selector comparable ecs a -> comparable -> ecs -> Maybe a

Get a specific set of components of an entity.

selectList : Selector comparable ecs a -> ecs -> List ( comparable, a )

Get all entities with a specific set of components.