aztecs-0.12.0: A modular game engine and Entity-Component-System (ECS) for Haskell.
Copyright(c) Matt Hunzinger 2025
LicenseBSD-style (see the LICENSE file in the distribution)
Maintainermatt@hunzinger.me
Stabilityprovisional
Portabilitynon-portable (GHC extensions)
Safe HaskellSafe-Inferred
LanguageHaskell2010

Aztecs.ECS.World.Archetype

Description

 
Synopsis

Documentation

data Archetype Source #

Archetype of entities and components. An archetype is guranteed to contain one of each stored component per entity.

Since: 0.9

Constructors

Archetype 

Fields

Instances

Instances details
Monoid Archetype Source # 
Instance details

Defined in Aztecs.ECS.World.Archetype

Semigroup Archetype Source # 
Instance details

Defined in Aztecs.ECS.World.Archetype

Generic Archetype Source # 
Instance details

Defined in Aztecs.ECS.World.Archetype

Associated Types

type Rep Archetype :: Type -> Type #

Show Archetype Source # 
Instance details

Defined in Aztecs.ECS.World.Archetype

NFData Archetype Source # 
Instance details

Defined in Aztecs.ECS.World.Archetype

Methods

rnf :: Archetype -> () #

type Rep Archetype Source # 
Instance details

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))))

empty :: Archetype Source #

Empty archetype.

Since: 0.9

singleton :: EntityID -> Archetype Source #

Archetype with a single entity.

Since: 0.9

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