Copyright | (c) Matt Hunzinger 2025 |
---|---|
License | BSD-style (see the LICENSE file in the distribution) |
Maintainer | matt@hunzinger.me |
Stability | provisional |
Portability | non-portable (GHC extensions) |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Aztecs.ECS.World.Archetype
Description
Synopsis
- data Archetype = Archetype {}
- empty :: Archetype
- singleton :: EntityID -> Archetype
- lookupComponent :: Component a => EntityID -> ComponentID -> Archetype -> Maybe a
- lookupComponents :: Component a => ComponentID -> Archetype -> Map EntityID a
- lookupComponentsAsc :: Component a => ComponentID -> Archetype -> [a]
- lookupComponentsAscMaybe :: forall a. Component a => ComponentID -> Archetype -> Maybe [a]
- lookupStorage :: Component a => ComponentID -> Archetype -> Maybe (StorageT a)
- member :: ComponentID -> Archetype -> Bool
- remove :: EntityID -> Archetype -> (IntMap Dynamic, Archetype)
- removeStorages :: EntityID -> Archetype -> (IntMap DynamicStorage, Archetype)
- insertComponent :: forall a. Component a => EntityID -> ComponentID -> a -> Archetype -> Archetype
- insertComponents :: EntityID -> IntMap Dynamic -> Archetype -> Archetype
- insertAscList :: forall a. Component a => ComponentID -> [a] -> Archetype -> Archetype
- map :: forall a. Component a => (a -> a) -> ComponentID -> Archetype -> ([a], Archetype)
- mapM :: forall m a. (Monad m, Component a) => (a -> m a) -> ComponentID -> Archetype -> m ([a], Archetype)
- zipMap :: forall a b c. Component c => [a] -> (a -> c -> (b, c)) -> ComponentID -> Archetype -> ([(b, c)], Archetype)
- zipMapM :: forall m a b c. (Applicative m, Component c) => [a] -> (a -> c -> m (b, c)) -> ComponentID -> Archetype -> m ([(b, c)], Archetype)
Documentation
Archetype of entities and components. An archetype is guranteed to contain one of each stored component per entity.
Since: 0.9
Constructors
Archetype | |
Instances
Monoid Archetype Source # | |
Semigroup Archetype Source # | |
Generic Archetype Source # | |
Show Archetype Source # | |
NFData Archetype Source # | |
Defined in Aztecs.ECS.World.Archetype | |
type Rep Archetype Source # | |
Defined in Aztecs.ECS.World.Archetype type Rep Archetype = D1 ('MetaData "Archetype" "Aztecs.ECS.World.Archetype" "aztecs-0.12.0-GlKmPfHNl6i8JdqwU1RE4N" 'False) (C1 ('MetaCons "Archetype" 'PrefixI 'True) (S1 ('MetaSel ('Just "storages") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (IntMap DynamicStorage)) :*: S1 ('MetaSel ('Just "entities") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (Set EntityID)))) |
lookupComponent :: Component a => EntityID -> ComponentID -> Archetype -> Maybe a Source #
Lookup a component by its EntityID
and ComponentID
.
Since: 0.9
lookupComponents :: Component a => ComponentID -> Archetype -> Map EntityID a Source #
Lookup all components by their ComponentID
.
Since: 0.9
lookupComponentsAsc :: Component a => ComponentID -> Archetype -> [a] Source #
Lookup all components by their ComponentID
, in ascending order by their EntityID
.
Since: 0.9
lookupComponentsAscMaybe :: forall a. Component a => ComponentID -> Archetype -> Maybe [a] Source #
Lookup all components by their ComponentID
, in ascending order by their EntityID
.
Since: 0.9
lookupStorage :: Component a => ComponentID -> Archetype -> Maybe (StorageT a) Source #
Lookup a component Storage
by its ComponentID
.
Since: 0.9
member :: ComponentID -> Archetype -> Bool Source #
True
if this archetype contains an entity with the provided ComponentID
.
Since: 0.9
remove :: EntityID -> Archetype -> (IntMap Dynamic, Archetype) Source #
Remove an entity from an archetype, returning its components.
Since: 0.9
removeStorages :: EntityID -> Archetype -> (IntMap DynamicStorage, Archetype) Source #
Remove an entity from an archetype, returning its component storages.
Since: 0.9
insertComponent :: forall a. Component a => EntityID -> ComponentID -> a -> Archetype -> Archetype Source #
Insert a component into the archetype. This assumes the archetype contains one of each stored component per entity.
Since: 0.9
insertComponents :: EntityID -> IntMap Dynamic -> Archetype -> Archetype Source #
Insert a map of component storages and their EntityID
into the archetype.
Since: 0.9
insertAscList :: forall a. Component a => ComponentID -> [a] -> Archetype -> Archetype Source #
Insert a list of components into the archetype, sorted in ascending order by their EntityID
.
Since: 0.9
map :: forall a. Component a => (a -> a) -> ComponentID -> Archetype -> ([a], Archetype) Source #
Map a list of components with a function and a component storage.
Since: 0.11
mapM :: forall m a. (Monad m, Component a) => (a -> m a) -> ComponentID -> Archetype -> m ([a], Archetype) Source #
Map a list of components with a monadic function.
Since: 0.11
zipMap :: forall a b c. Component c => [a] -> (a -> c -> (b, c)) -> ComponentID -> Archetype -> ([(b, c)], Archetype) Source #
Zip a list of components with a function.
Since: 0.9
zipMapM :: forall m a b c. (Applicative m, Component c) => [a] -> (a -> c -> m (b, c)) -> ComponentID -> Archetype -> m ([(b, c)], Archetype) Source #
Zip a list of components with a monadic function .
Since: 0.9