| Copyright | (C) 2020 Sophie Taylor |
|---|---|
| License | AGPL-3.0-or-later |
| Maintainer | Sophie Taylor <sophie@spacekitteh.moe> |
| Stability | experimental |
| Portability | GHC |
| Safe Haskell | None |
| Language | GHC2021 |
Games.ECS.Entity
Description
In an ECS, an entity is understood in two senses:
- An identifying token, used to specify an individual, and
- The individual it refers to, that is, the set of components it has.
Here, we implement entities in the first sense.
Synopsis
- newtype Entity = EntRef {}
- class HasEntityReferences c where
- newtype EntitySet = EntitySet IntSet
- theEntitySet :: Iso' EntitySet IntSet
- singletonEntitySet :: Entity -> EntitySet
- asIntersection :: Iso' IntersectionOfEntities EntitySet
- newtype IntersectionOfEntities = Intersect IntSet
- class IsEntityStore a where
- knownEntities :: Fold a Entity
- blankEntityStorage :: a
- class HasEntitySet a where
Documentation
A reference to an entity in the ECS.
Instances
class HasEntityReferences c where Source #
A helper class for finding embedded entity references in components.
Methods
getEntityReferences :: Fold c Entity Source #
Instances
| HasEntityReferences Entity Source # | |
Defined in Games.ECS.Entity | |
| HasEntityReferences EntitySet Source # | |
Defined in Games.ECS.Entity | |
An efficient storage for a collection of entities.
asIntersection :: Iso' IntersectionOfEntities EntitySet Source #
Helper Iso' for selecting entities which satisfy predicates.
newtype IntersectionOfEntities Source #
A helper Monoid for selecting entities which satisfy multiple predicates.
Instances
| Monoid IntersectionOfEntities Source # | |
Defined in Games.ECS.Entity | |
| Semigroup IntersectionOfEntities Source # | |
Defined in Games.ECS.Entity Methods (<>) :: IntersectionOfEntities -> IntersectionOfEntities -> IntersectionOfEntities # sconcat :: NonEmpty IntersectionOfEntities -> IntersectionOfEntities # stimes :: Integral b => b -> IntersectionOfEntities -> IntersectionOfEntities # | |
| Show IntersectionOfEntities Source # | |
Defined in Games.ECS.Entity Methods showsPrec :: Int -> IntersectionOfEntities -> ShowS # show :: IntersectionOfEntities -> String # showList :: [IntersectionOfEntities] -> ShowS # | |
| Eq IntersectionOfEntities Source # | |
Defined in Games.ECS.Entity Methods (==) :: IntersectionOfEntities -> IntersectionOfEntities -> Bool # (/=) :: IntersectionOfEntities -> IntersectionOfEntities -> Bool # | |
| HasEntitySet IntersectionOfEntities Source # | |
Defined in Games.ECS.Entity | |
| IsEntityStore IntersectionOfEntities Source # | |
Defined in Games.ECS.Entity | |
class IsEntityStore a where Source #
Generalisation of an EntitySet.
Instances
| IsEntityStore IntSet Source # | |
Defined in Games.ECS.Entity | |
| IsEntityStore EntitySet Source # | |
Defined in Games.ECS.Entity | |
| IsEntityStore IntersectionOfEntities Source # | |
Defined in Games.ECS.Entity | |
| IsEntityStore (HashSet Entity) Source # | |
Defined in Games.ECS.Entity | |
class HasEntitySet a where Source #
For types which may have one or more EntitySet.
Instances
| HasEntitySet EntitySet Source # | |
| HasEntitySet IntersectionOfEntities Source # | |
Defined in Games.ECS.Entity | |
| HasEntitySet (UniqueStore a) Source # | |
Defined in Games.ECS.Component | |
| HasEntitySet (ComponentStore c) Source # | |
Defined in Games.ECS.Component.Store | |
| HasEntitySet (InternedComponentStore c) Source # | |
Defined in Games.ECS.Component.Store | |