| Safe Haskell | None |
|---|---|
| Language | GHC2024 |
Mischief.ECS.Components
Synopsis
- class (Typeable c, IsExclusive (RelExclusivity c)) => Component c where
- type RelExclusivity c :: Exclusivity
- required :: Set DefaultComponentType
- hooks :: Hooks c
- data ComponentId = ComponentId (# Word#, Maybe Entity #)
- data Exclusivity
- newtype ComponentArchetypes = ComponentArchetypes {
- inner :: Set ArchetypeId
- data ComponentPairs = ComponentPairs {
- any :: Set ArchetypeId
- pairs :: Map Entity (Set ArchetypeId)
- newtype DefaultValue = DefaultValue ErasedComponent
- data Requires = Requires
- data RequiredBy = RequiredBy
- data ComponentType where
- ComponentType :: forall c. Component c => Proxy c -> ComponentType
- data ErasedComponent where
- ErasedComponent :: forall c. Component c => c -> ErasedComponent
- tryGetComponent :: Component c => ErasedComponent -> Maybe c
- data DefaultComponentType where
- DefaultComponentType :: forall c. (Component c, Default c) => Proxy c -> DefaultComponentType
- newtype ArchetypeId = ArchetypeId {}
- newtype BundleData e = BundleData {
- elements :: Set (BundleElement e)
- data BundleElement e = BundleElement {
- rep :: ComponentRep
- component :: e
- data ComponentTicks = ComponentTicks {}
- data ComponentData = ComponentData {}
- newtype Components = Components {
- components :: HashMap TypeRep Word
- emptyComponents :: IO Components
- getComponentId :: TypeRep -> Components -> IO (Maybe ComponentId)
- newtype Pair = Pair (ComponentType, Entity)
- data Rel c = Rel {}
- data ComponentRep
- newtype Tick = Tick (Int, Int)
- data ErasedComponentEq where
- ErasedComponentEq :: forall c. (Component c, Eq c) => c -> ErasedComponentEq
- class IsExclusive (e :: Exclusivity) where
- isExclusive :: Bool
- isPair :: ComponentId -> Bool
- setCompIdTarget :: Maybe Entity -> ComponentId -> ComponentId
Component
class (Typeable c, IsExclusive (RelExclusivity c)) => Component c where Source #
The Component typeclass.
Minimal complete definition
Nothing
Methods
Instances
data ComponentId Source #
Unique id for components and component pairs.
Constructors
| ComponentId (# Word#, Maybe Entity #) |
Instances
| Eq ComponentId Source # | |
Defined in Mischief.ECS.Components | |
| Ord ComponentId Source # | |
Defined in Mischief.ECS.Components Methods compare :: ComponentId -> ComponentId -> Ordering # (<) :: ComponentId -> ComponentId -> Bool # (<=) :: ComponentId -> ComponentId -> Bool # (>) :: ComponentId -> ComponentId -> Bool # (>=) :: ComponentId -> ComponentId -> Bool # max :: ComponentId -> ComponentId -> ComponentId # min :: ComponentId -> ComponentId -> ComponentId # | |
data Exclusivity Source #
Meta
newtype ComponentArchetypes Source #
Meta component with a set of all archetypes that a components is part of.
Constructors
| ComponentArchetypes | |
Fields
| |
Instances
| Default ComponentArchetypes Source # | |||||
Defined in Mischief.ECS.Components Methods | |||||
| Show ComponentArchetypes Source # | |||||
Defined in Mischief.ECS.Components Methods showsPrec :: Int -> ComponentArchetypes -> ShowS # show :: ComponentArchetypes -> String # showList :: [ComponentArchetypes] -> ShowS # | |||||
| Component ComponentArchetypes Source # | |||||
Defined in Mischief.ECS.Components Associated Types
| |||||
| type RelExclusivity ComponentArchetypes Source # | |||||
Defined in Mischief.ECS.Components | |||||
data ComponentPairs Source #
Meta component with a set of all archetypes containing pairs made with this component.
Constructors
| ComponentPairs | |
Fields
| |
Instances
| Default ComponentPairs Source # | |||||
Defined in Mischief.ECS.Components Methods def :: ComponentPairs # | |||||
| Generic ComponentPairs Source # | |||||
Defined in Mischief.ECS.Components Associated Types
Methods from :: ComponentPairs -> Rep ComponentPairs x # to :: Rep ComponentPairs x -> ComponentPairs # | |||||
| Show ComponentPairs Source # | |||||
Defined in Mischief.ECS.Components Methods showsPrec :: Int -> ComponentPairs -> ShowS # show :: ComponentPairs -> String # showList :: [ComponentPairs] -> ShowS # | |||||
| Component ComponentPairs Source # | |||||
Defined in Mischief.ECS.Components Associated Types
| |||||
| type Rep ComponentPairs Source # | |||||
Defined in Mischief.ECS.Components type Rep ComponentPairs = D1 ('MetaData "ComponentPairs" "Mischief.ECS.Components" "mischief-ecs-0.0.0.0-inplace" 'False) (C1 ('MetaCons "ComponentPairs" 'PrefixI 'True) (S1 ('MetaSel ('Just "any") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Set ArchetypeId)) :*: S1 ('MetaSel ('Just "pairs") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Map Entity (Set ArchetypeId))))) | |||||
| type RelExclusivity ComponentPairs Source # | |||||
Defined in Mischief.ECS.Components | |||||
newtype DefaultValue Source #
Meta component with the erased default value of this component. Added to components required by other components.
Constructors
| DefaultValue ErasedComponent |
Instances
| Component DefaultValue Source # | |||||
Defined in Mischief.ECS.Components Associated Types
| |||||
| type RelExclusivity DefaultValue Source # | |||||
Defined in Mischief.ECS.Components | |||||
Meta relationship.
Constructors
| Requires |
Instances
| Component Requires Source # | |||||
Defined in Mischief.ECS.Components Associated Types
| |||||
| type RelExclusivity Requires Source # | |||||
Defined in Mischief.ECS.Components | |||||
data RequiredBy Source #
Meta relationship.
Constructors
| RequiredBy |
Instances
| Component RequiredBy Source # | |||||
Defined in Mischief.ECS.Components Associated Types
| |||||
| type RelExclusivity RequiredBy Source # | |||||
Defined in Mischief.ECS.Components | |||||
data ComponentType where Source #
Constructors
| ComponentType :: forall c. Component c => Proxy c -> ComponentType |
Instances
| Show ComponentType Source # | |||||
Defined in Mischief.ECS.Components Methods showsPrec :: Int -> ComponentType -> ShowS # show :: ComponentType -> String # showList :: [ComponentType] -> ShowS # | |||||
| Eq ComponentType Source # | |||||
Defined in Mischief.ECS.Components Methods (==) :: ComponentType -> ComponentType -> Bool # (/=) :: ComponentType -> ComponentType -> Bool # | |||||
| Ord ComponentType Source # | |||||
Defined in Mischief.ECS.Components Methods compare :: ComponentType -> ComponentType -> Ordering # (<) :: ComponentType -> ComponentType -> Bool # (<=) :: ComponentType -> ComponentType -> Bool # (>) :: ComponentType -> ComponentType -> Bool # (>=) :: ComponentType -> ComponentType -> Bool # max :: ComponentType -> ComponentType -> ComponentType # min :: ComponentType -> ComponentType -> ComponentType # | |||||
| Component ComponentType Source # | |||||
Defined in Mischief.ECS.Components Associated Types
| |||||
| GetRep ComponentType Source # | |||||
Defined in Mischief.ECS.Components Methods getRep :: ComponentType -> TypeRep Source # | |||||
| type RelExclusivity ComponentType Source # | |||||
Defined in Mischief.ECS.Components | |||||
Erasure
data ErasedComponent where Source #
Type for component erasure.
Constructors
| ErasedComponent :: forall c. Component c => c -> ErasedComponent |
Instances
| GetRep ErasedComponent Source # | |
Defined in Mischief.ECS.Components Methods getRep :: ErasedComponent -> TypeRep Source # | |
| EraseIntoStorage () (BundleData ErasedComponent) Source # | |
Defined in Mischief.ECS.Components Methods erase :: () -> BundleData ErasedComponent Source # | |
| Component c => EraseIntoStorage c (BundleData ErasedComponent) Source # | |
Defined in Mischief.ECS.Components Methods erase :: c -> BundleData ErasedComponent Source # | |
| EraseIntoStorage (BundleData ErasedComponent) (BundleData ErasedComponent) Source # | |
Defined in Mischief.ECS.Components Methods erase :: BundleData ErasedComponent -> BundleData ErasedComponent Source # | |
| Component c => EraseIntoStorage (Rel c) (BundleData ErasedComponent) Source # | |
Defined in Mischief.ECS.Components Methods erase :: Rel c -> BundleData ErasedComponent Source # | |
tryGetComponent :: Component c => ErasedComponent -> Maybe c Source #
Try to get the inner data of a ErasedComponent.
data DefaultComponentType where Source #
Constructors
| DefaultComponentType :: forall c. (Component c, Default c) => Proxy c -> DefaultComponentType |
Instances
| Show DefaultComponentType Source # | |
Defined in Mischief.ECS.Components Methods showsPrec :: Int -> DefaultComponentType -> ShowS # show :: DefaultComponentType -> String # showList :: [DefaultComponentType] -> ShowS # | |
| Eq DefaultComponentType Source # | |
Defined in Mischief.ECS.Components Methods (==) :: DefaultComponentType -> DefaultComponentType -> Bool # (/=) :: DefaultComponentType -> DefaultComponentType -> Bool # | |
| Ord DefaultComponentType Source # | |
Defined in Mischief.ECS.Components Methods compare :: DefaultComponentType -> DefaultComponentType -> Ordering # (<) :: DefaultComponentType -> DefaultComponentType -> Bool # (<=) :: DefaultComponentType -> DefaultComponentType -> Bool # (>) :: DefaultComponentType -> DefaultComponentType -> Bool # (>=) :: DefaultComponentType -> DefaultComponentType -> Bool # max :: DefaultComponentType -> DefaultComponentType -> DefaultComponentType # min :: DefaultComponentType -> DefaultComponentType -> DefaultComponentType # | |
| GetRep DefaultComponentType Source # | |
Defined in Mischief.ECS.Components Methods getRep :: DefaultComponentType -> TypeRep Source # | |
Archetypes
newtype ArchetypeId Source #
Unique id corresponding to an archetype.
Constructors
| ArchetypeId | |
Instances
| Show ArchetypeId Source # | |
Defined in Mischief.ECS.Components Methods showsPrec :: Int -> ArchetypeId -> ShowS # show :: ArchetypeId -> String # showList :: [ArchetypeId] -> ShowS # | |
| Eq ArchetypeId Source # | |
Defined in Mischief.ECS.Components | |
| Ord ArchetypeId Source # | |
Defined in Mischief.ECS.Components Methods compare :: ArchetypeId -> ArchetypeId -> Ordering # (<) :: ArchetypeId -> ArchetypeId -> Bool # (<=) :: ArchetypeId -> ArchetypeId -> Bool # (>) :: ArchetypeId -> ArchetypeId -> Bool # (>=) :: ArchetypeId -> ArchetypeId -> Bool # max :: ArchetypeId -> ArchetypeId -> ArchetypeId # min :: ArchetypeId -> ArchetypeId -> ArchetypeId # | |
Bundles
newtype BundleData e Source #
Data extracted from a Bundle.
Constructors
| BundleData | |
Fields
| |
Instances
| EraseIntoStorage () (BundleData ErasedComponent) Source # | |
Defined in Mischief.ECS.Components Methods erase :: () -> BundleData ErasedComponent Source # | |
| Component c => EraseIntoStorage c (BundleData ErasedComponent) Source # | |
Defined in Mischief.ECS.Components Methods erase :: c -> BundleData ErasedComponent Source # | |
| (Component c, Eq c) => EraseIntoStorage c (BundleData ErasedComponentEq) Source # | |
Defined in Mischief.ECS.Components Methods erase :: c -> BundleData ErasedComponentEq Source # | |
| Semigroup (BundleData e) Source # | |
Defined in Mischief.ECS.Components Methods (<>) :: BundleData e -> BundleData e -> BundleData e # sconcat :: NonEmpty (BundleData e) -> BundleData e # stimes :: Integral b => b -> BundleData e -> BundleData e # | |
| Show (BundleData e) Source # | |
Defined in Mischief.ECS.Components Methods showsPrec :: Int -> BundleData e -> ShowS # show :: BundleData e -> String # showList :: [BundleData e] -> ShowS # | |
| EraseIntoStorage (BundleData ErasedComponent) (BundleData ErasedComponent) Source # | |
Defined in Mischief.ECS.Components Methods erase :: BundleData ErasedComponent -> BundleData ErasedComponent Source # | |
| Component c => EraseIntoStorage (Rel c) (BundleData ErasedComponent) Source # | |
Defined in Mischief.ECS.Components Methods erase :: Rel c -> BundleData ErasedComponent Source # | |
| (Component c, Eq c) => EraseIntoStorage (Rel c) (BundleData ErasedComponentEq) Source # | |
Defined in Mischief.ECS.Components Methods erase :: Rel c -> BundleData ErasedComponentEq Source # | |
data BundleElement e Source #
Element of a 'BundleData e'.
Constructors
| BundleElement | |
Fields
| |
Instances
| Show (BundleElement a) Source # | |
Defined in Mischief.ECS.Components Methods showsPrec :: Int -> BundleElement a -> ShowS # show :: BundleElement a -> String # showList :: [BundleElement a] -> ShowS # | |
| Eq (BundleElement a) Source # | |
Defined in Mischief.ECS.Components Methods (==) :: BundleElement a -> BundleElement a -> Bool # (/=) :: BundleElement a -> BundleElement a -> Bool # | |
| Ord (BundleElement a) Source # | |
Defined in Mischief.ECS.Components Methods compare :: BundleElement a -> BundleElement a -> Ordering # (<) :: BundleElement a -> BundleElement a -> Bool # (<=) :: BundleElement a -> BundleElement a -> Bool # (>) :: BundleElement a -> BundleElement a -> Bool # (>=) :: BundleElement a -> BundleElement a -> Bool # max :: BundleElement a -> BundleElement a -> BundleElement a # min :: BundleElement a -> BundleElement a -> BundleElement a # | |
Tables
data ComponentTicks Source #
Change ticks for a specific component.
Constructors
| ComponentTicks | |
Instances
| Show ComponentTicks Source # | |
Defined in Mischief.ECS.Components Methods showsPrec :: Int -> ComponentTicks -> ShowS # show :: ComponentTicks -> String # showList :: [ComponentTicks] -> ShowS # | |
data ComponentData Source #
Data for a component that's stored in a table.
Constructors
| ComponentData | |
Fields | |
Storage
newtype Components Source #
Contains data and methods for assigning ComponentIds to new components (via their TypeRep).
Constructors
| Components | |
Fields
| |
emptyComponents :: IO Components Source #
Construct an empty Components.
getComponentId :: TypeRep -> Components -> IO (Maybe ComponentId) Source #
Get the id of a component through IO.
Utils
Type used for querying and inserting relationships.
Instances
| Component c => Updateable' 'False (Result (Rel c)) Source # | |
Defined in Mischief.ECS.World.Insert | |
| Component c => GetResultComponentId' 'False (Result (Rel c)) Source # | |
Defined in Mischief.ECS.World.Query Methods getResultComponentId' :: MonadSystem w m => Result (Rel c) -> m (Maybe ComponentId) Source # | |
| DeepValue' 'False (Result (Rel c)) c Source # | |
Defined in Mischief.ECS.Tables Methods deepValue' :: Result (Rel c) -> c Source # | |
| Component c => Settable' 'False (Result (Rel c)) c Source # | |
| Component c => RelQuery 'Exclusive (MR c Any) (Maybe (Result (Rel c))) Source # | |
Defined in Mischief.ECS.World.Query.Queryable | |
| Component c => RelQuery 'Exclusive (R c Any) (Result (Rel c)) Source # | |
Defined in Mischief.ECS.World.Query.Queryable | |
| Component c => RelQuery 'Inclusive (MR c Any) (Maybe [Result (Rel c)]) Source # | |
Defined in Mischief.ECS.World.Query.Queryable | |
| Component c => RelQuery 'Inclusive (R c Any) [Result (Rel c)] Source # | |
Defined in Mischief.ECS.World.Query.Queryable | |
| Show c => Show (Rel c) Source # | |
| Component c => EraseIntoStorage (Rel c) (BundleData ErasedComponent) Source # | |
Defined in Mischief.ECS.Components Methods erase :: Rel c -> BundleData ErasedComponent Source # | |
| (Component c, Eq c) => EraseIntoStorage (Rel c) (BundleData ErasedComponentEq) Source # | |
Defined in Mischief.ECS.Components Methods erase :: Rel c -> BundleData ErasedComponentEq Source # | |
| Component c => Queryable (MR c Entity) (Maybe (Result (Rel c))) Source # | |
Defined in Mischief.ECS.World.Query.Queryable | |
| Component c => Queryable (R c Entity) (Result (Rel c)) Source # | |
Defined in Mischief.ECS.World.Query.Queryable | |
data ComponentRep Source #
Constructors
| ComponentRep ComponentType | |
| PairRep (ComponentType, Entity) |
Instances
| Show ComponentRep Source # | |
Defined in Mischief.ECS.Components Methods showsPrec :: Int -> ComponentRep -> ShowS # show :: ComponentRep -> String # showList :: [ComponentRep] -> ShowS # | |
| Eq ComponentRep Source # | |
Defined in Mischief.ECS.Components | |
| Ord ComponentRep Source # | |
Defined in Mischief.ECS.Components Methods compare :: ComponentRep -> ComponentRep -> Ordering # (<) :: ComponentRep -> ComponentRep -> Bool # (<=) :: ComponentRep -> ComponentRep -> Bool # (>) :: ComponentRep -> ComponentRep -> Bool # (>=) :: ComponentRep -> ComponentRep -> Bool # max :: ComponentRep -> ComponentRep -> ComponentRep # min :: ComponentRep -> ComponentRep -> ComponentRep # | |
data ErasedComponentEq where Source #
Constructors
| ErasedComponentEq :: forall c. (Component c, Eq c) => c -> ErasedComponentEq |
Instances
| (Component c, Eq c) => EraseIntoStorage c (BundleData ErasedComponentEq) Source # | |
Defined in Mischief.ECS.Components Methods erase :: c -> BundleData ErasedComponentEq Source # | |
| (Component c, Eq c) => EraseIntoStorage (Rel c) (BundleData ErasedComponentEq) Source # | |
Defined in Mischief.ECS.Components Methods erase :: Rel c -> BundleData ErasedComponentEq Source # | |
class IsExclusive (e :: Exclusivity) where Source #
Methods
isExclusive :: Bool Source #
Instances
| IsExclusive 'Exclusive Source # | |
Defined in Mischief.ECS.Components Methods isExclusive :: Bool Source # | |
| IsExclusive 'Inclusive Source # | |
Defined in Mischief.ECS.Components Methods isExclusive :: Bool Source # | |
isPair :: ComponentId -> Bool Source #
setCompIdTarget :: Maybe Entity -> ComponentId -> ComponentId Source #