| Safe Haskell | None |
|---|---|
| Language | GHC2024 |
Mischief.ECS
Description
This library contains the ECS used by the Mischief Game Engine.
Synopsis
- module Mischief.ECS.Exports
- class (Typeable c, IsExclusive (IsExclusiveRel c)) => Component c where
- data From c = From {}
- type family IsExclusiveRel c :: Bool
- data Rel c = Rel {}
- newtype Res c = Res {
- comp :: c
- newtype Tick = Tick Word64
- require :: forall {k} (b :: k). RequiredBundle b => Set DefaultComponentType
- module Mischief.ECS.Components.Common
- data Entity
- check :: forall m w. MonadSystem w m => QueryFilter -> Entity -> m Bool
- mkGet :: forall qd out (m :: Type -> Type). Queryable qd out => Entity -> qd -> Query m out
- mkGet' :: forall qd out (m :: Type -> Type). Queryable qd out => Entity -> qd -> QueryFilter -> Query m out
- mkQuery :: forall qd out (m :: Type -> Type). Queryable qd out => qd -> Query m out
- mkQuery' :: forall qd out (m :: Type -> Type). Queryable qd out => qd -> QueryFilter -> Query m out
- query :: MonadSystem w m => Query m out -> m [out]
- queryOne :: MonadSystem w m => Query m out -> m (Maybe out)
- query_ :: MonadSystem w m => Query m out -> m ()
- runWhenOne :: Typeable a => Query System a -> (a -> System b) -> System ()
- runWhenQ :: Typeable a => Query System a -> ([a] -> System b) -> System ()
- single :: MonadSystem w m => Query m out -> m (Maybe out)
- data Query (m :: Type -> Type) a
- data QueryFilter where
- NoFilter :: QueryFilter
- With :: forall a. ToFilterComponent a => a -> QueryFilter
- Without :: forall a. ToFilterComponent a => a -> QueryFilter
- Changed :: forall a. ToFilterComponent a => a -> (Tick -> Tick -> Bool) -> (Tick -> Tick -> Bool) -> QueryFilter
- And :: QueryFilter -> QueryFilter -> QueryFilter
- Or :: QueryFilter -> QueryFilter -> QueryFilter
- data Any = Any
- data C (a :: k) = C
- data E = E
- data Has (a :: k) = Has
- newtype HasR (a :: k) b = HasR b
- data M (a :: k) = M
- newtype MR (a :: k) b = MR b
- newtype Q a = Q a
- data Q' a b = Q' a b
- newtype R (a :: k) b = R b
- newtype R' (a :: k) b = R' b
- module Mischief.ECS.World.Query.TH
- insert :: HasCallStack => forall b. Bundle b => b -> Entity -> System ()
- insertIfNeq :: BundleEq b => b -> Entity -> System ()
- insertNew :: Bundle b => b -> Entity -> System ()
- remove :: Collectable c ToRemove => c -> Entity -> System ()
- despawn :: Entity -> System ()
- spawn :: (HasCallStack, Bundle b) => b -> System Entity
- spawnDefer :: Bundle b => b -> ParSystem Entity
- spawn_ :: (HasCallStack, Bundle b) => b -> System ()
- insertRes :: (Component r, Bundle r) => r -> System ()
- res :: forall c m w. (MonadSystem w m, Component c) => m (Maybe c)
- resOrInsert :: (Component r, Bundle r) => r -> System r
- resOrInsertM :: (Component r, Bundle r) => System r -> System r
- class Typeable e => Event e
- runWhen :: Typeable a => System (Maybe a) -> (a -> System b) -> System ()
- class (GetWorld w, MonadReader w a, Applicative a, MonadFail a, Functor a, Monad a, MonadIO a, PrimMonad a, PrimState a ~ RealWorld, MonadThrow a, SystemAny a) => MonadSystem w (a :: Type -> Type)
- data ParSystem a
- data System a
- data Time
- data TimePlugin
- defer :: MonadSystem w m => System a -> m ()
- delay :: MonadSystem w m => Float -> System a -> m ()
- flush :: System ()
- runAfter :: MonadSystem w m => IO a -> (a -> System ()) -> m ()
- addPlugin :: Plugin p => App -> IO ()
- newApp :: IO App
- runApp :: App -> IO ()
- data App
- dep :: Plugin p => Dependency
- data Dependency
- class Typeable p => Plugin p where
- deps :: [Dependency]
- init :: System ()
- scheduleEntity :: forall {k} (sch :: k). Schedule sch => System Entity
- data PostStartup
- data PostUpdate
- data PreStartup
- data PreUpdate
- class Typeable s => Schedule (s :: k)
- data Startup
- data StartupSchedule = StartupSchedule
- data Update
- data UpdateSchedule = UpdateSchedule
- after :: ToSystems a => a -> SystemConfig -> SystemConfig
- before :: ToSystems a => a -> SystemConfig -> SystemConfig
- order :: forall {k} (sc :: k) a b. (Schedule sc, ToSystems a, ToSystems b) => (a, b) -> System ()
- schedule :: forall {k} (sc :: k). Schedule sc => SystemConfig -> System ()
- systems :: ToSystems a => a -> SystemConfig
- unschedule :: forall {k} (sc :: k) a. (Schedule sc, ToSystems a) => a -> System ()
- unschedule' :: forall {k} (sc :: k) a. (Schedule sc, ToSystems a) => a -> System ()
- module Mischief.ECS.Log
- expect :: (HasCallStack, Unwrappable f) => Text -> f a -> a
- mapLeft :: (a -> c) -> Either a b -> Either c b
- unwrap :: (HasCallStack, Unwrappable f) => f a -> a
- module Mischief.ECS.Events
- data Hook (a :: k)
- newtype HookContext = HookContext {}
- data HookContextRel = HookContextRel {}
- data HookRel (a :: k)
- module Mischief.ECS.Hooks
- bundle :: Bundle b => b -> BundleBuilder
- bundleEq :: BundleEq b => b -> BundleEqBuilder
- type Bundle b = Collectable b (BundleData ErasedComponent)
- type BundleBuilder = BundleData ErasedComponent
- type BundleEq b = Collectable b (BundleData ErasedComponentEq)
- type BundleEqBuilder = BundleData ErasedComponentEq
- data Timer
- module Mischief.ECS.World.Query.Pipe
- newtype Observer e = Observer (e -> System ())
- newtype FixedFrequency = FixedFrequency Float
- data FixedPlugin
- data FixedPostUpdate
- data FixedPreUpdate
- data FixedUpdate
- (&) :: a -> (a -> b) -> b
- data ChildOf = ChildOf
- class Queryable qd output | qd -> output
- data Before = Before
- module Mischief.ECS.Repeater
- meta :: Component c => System Entity
Learn You an ECS for Great Mischief!
The official Mischief book.
You can read chapters and subchapters in any order.
The Startup Guide (1.1) is heavily recommended if this is your first time using Mischief.
1. Introduction
2. Guides
module Mischief.ECS.Exports
class (Typeable c, IsExclusive (IsExclusiveRel c)) => Component c where Source #
The Component typeclass.
Minimal complete definition
Nothing
Associated Types
type IsExclusiveRel c :: Bool Source #
Set whether the relationships this component is used in are exclusive or not.
type IsExclusiveRel c = 'False
Methods
required :: Set DefaultComponentType Source #
List of components required by this one.
All required components must be Default
Example
data A = A instanceComponentA whererequired=require@(B, C) data B = BIntderiving (Component,Generic,Default) data C = CStringderiving (Component) instanceDefaultC wheredef= C "Default String"
onAddRel :: [HookRel c] Source #
onSetRel :: [HookRel c] Source #
onRemoveRel :: [HookRel c] Source #
Instances
Instances
| Functor From Source # | |
| (Component c, Queryable q out) => RelQuery 'False (MR c (Q q)) (Maybe [From out]) Source # | |
Defined in Mischief.ECS.World.Query.Queryable | |
| (Component c, Queryable q out) => RelQuery 'False (MR c (Q' q QueryFilter)) (Maybe [From out]) Source # | |
Defined in Mischief.ECS.World.Query.Queryable Methods relRunQueryEntity :: MR c (Q' q QueryFilter) -> World -> Entity -> IO (Maybe (Maybe [From out])) Source # relRunQueryInternal :: MR c (Q' q QueryFilter) -> [ArchetypeId] -> World -> IO [(Entity, Bool, Maybe [From out])] Source # relQueryTypes :: MR c (Q' q QueryFilter) -> Set (TypeRep, TypeQuery) Source # | |
| (Component c, Queryable q out) => RelQuery 'False (R c (Q q)) [From out] Source # | |
Defined in Mischief.ECS.World.Query.Queryable | |
| (Component c, Queryable q out) => RelQuery 'False (R c (Q' q QueryFilter)) [From out] Source # | |
Defined in Mischief.ECS.World.Query.Queryable Methods relRunQueryEntity :: R c (Q' q QueryFilter) -> World -> Entity -> IO (Maybe [From out]) Source # relRunQueryInternal :: R c (Q' q QueryFilter) -> [ArchetypeId] -> World -> IO [(Entity, Bool, [From out])] Source # relQueryTypes :: R c (Q' q QueryFilter) -> Set (TypeRep, TypeQuery) Source # | |
| (Component c, Queryable q out) => RelQuery 'True (MR c (Q q)) (Maybe (From out)) Source # | |
Defined in Mischief.ECS.World.Query.Queryable | |
| (Component c, Queryable q out) => RelQuery 'True (MR c (Q' q QueryFilter)) (Maybe (From out)) Source # | |
Defined in Mischief.ECS.World.Query.Queryable Methods relRunQueryEntity :: MR c (Q' q QueryFilter) -> World -> Entity -> IO (Maybe (Maybe (From out))) Source # relRunQueryInternal :: MR c (Q' q QueryFilter) -> [ArchetypeId] -> World -> IO [(Entity, Bool, Maybe (From out))] Source # relQueryTypes :: MR c (Q' q QueryFilter) -> Set (TypeRep, TypeQuery) Source # | |
| (Component c, Queryable q out) => RelQuery 'True (R c (Q q)) (From out) Source # | |
| (Component c, Queryable q out) => RelQuery 'True (R c (Q' q QueryFilter)) (From out) Source # | |
Defined in Mischief.ECS.World.Query.Queryable Methods relRunQueryEntity :: R c (Q' q QueryFilter) -> World -> Entity -> IO (Maybe (From out)) Source # relRunQueryInternal :: R c (Q' q QueryFilter) -> [ArchetypeId] -> World -> IO [(Entity, Bool, From out)] Source # relQueryTypes :: R c (Q' q QueryFilter) -> Set (TypeRep, TypeQuery) Source # | |
| Show c => Show (From c) Source # | |
| Eq c => Eq (From c) Source # | |
| Collectable c (BundleData ErasedComponent) => EraseIntoStorage (From c) (BundleData ErasedComponent) Source # | |
Defined in Mischief.ECS.Components Methods erase :: From c -> BundleData ErasedComponent Source # | |
| Collectable c (BundleData ErasedComponentEq) => EraseIntoStorage (From c) (BundleData ErasedComponentEq) Source # | |
Defined in Mischief.ECS.Components Methods erase :: From c -> BundleData ErasedComponentEq Source # | |
type family IsExclusiveRel c :: Bool Source #
Set whether the relationships this component is used in are exclusive or not.
Instances
| type IsExclusiveRel FixedSchedule Source # | |
Defined in Mischief.ECS.App.Schedules | |
| type IsExclusiveRel ScheduleLabel Source # | |
Defined in Mischief.ECS.App.Schedules | |
| type IsExclusiveRel Schedules Source # | |
Defined in Mischief.ECS.App.Schedules | |
| type IsExclusiveRel StartupSchedule Source # | |
Defined in Mischief.ECS.App.Schedules | |
| type IsExclusiveRel UpdateSchedule Source # | |
Defined in Mischief.ECS.App.Schedules | |
| type IsExclusiveRel LastSystemTick Source # | |
Defined in Mischief.ECS.App.SystemDef | |
| type IsExclusiveRel SystemTick Source # | |
Defined in Mischief.ECS.App.SystemDef | |
| type IsExclusiveRel ScheduledIn Source # | |
Defined in Mischief.ECS.App.Systems | |
| type IsExclusiveRel SystemFunction Source # | |
Defined in Mischief.ECS.App.Systems | |
| type IsExclusiveRel Systems Source # | |
Defined in Mischief.ECS.App.Systems | |
| type IsExclusiveRel ComponentArchetypes Source # | |
Defined in Mischief.ECS.Components | |
| type IsExclusiveRel ComponentPairs Source # | |
Defined in Mischief.ECS.Components | |
| type IsExclusiveRel ComponentType Source # | |
Defined in Mischief.ECS.Components | |
| type IsExclusiveRel DefaultValue Source # | |
Defined in Mischief.ECS.Components | |
| type IsExclusiveRel IsExclusiveRelationship Source # | |
Defined in Mischief.ECS.Components | |
| type IsExclusiveRel RequiredBy Source # | |
Defined in Mischief.ECS.Components | |
| type IsExclusiveRel Requires Source # | |
Defined in Mischief.ECS.Components | |
| type IsExclusiveRel Name Source # | |
Defined in Mischief.ECS.Components.Common | |
| type IsExclusiveRel ComponentAddHooks Source # | |
Defined in Mischief.ECS.Components.Spawn | |
| type IsExclusiveRel ComponentAddHooksRel Source # | |
Defined in Mischief.ECS.Components.Spawn | |
| type IsExclusiveRel ComponentRemoveHooks Source # | |
Defined in Mischief.ECS.Components.Spawn | |
| type IsExclusiveRel ComponentRemoveHooksRel Source # | |
Defined in Mischief.ECS.Components.Spawn | |
| type IsExclusiveRel ComponentSetHooks Source # | |
Defined in Mischief.ECS.Components.Spawn | |
| type IsExclusiveRel ComponentSetHooksRel Source # | |
Defined in Mischief.ECS.Components.Spawn | |
| type IsExclusiveRel FixedExtra Source # | |
Defined in Mischief.ECS.Fixed | |
| type IsExclusiveRel FixedFrequency Source # | |
Defined in Mischief.ECS.Fixed | |
| type IsExclusiveRel FixedTime Source # | |
Defined in Mischief.ECS.Fixed | |
| type IsExclusiveRel ChildOf Source # | |
Defined in Mischief.ECS.Relationships.ChildOf | |
| type IsExclusiveRel Before Source # | |
Defined in Mischief.ECS.Relationships.Order | |
| type IsExclusiveRel Visited Source # | |
Defined in Mischief.ECS.Relationships.Order | |
| type IsExclusiveRel Repeater Source # | |
Defined in Mischief.ECS.Repeater | |
| type IsExclusiveRel VirtualTime Source # | |
Defined in Mischief.ECS.Time | |
| type IsExclusiveRel (Observer e) Source # | |
Defined in Mischief.ECS.Observer | |
| type IsExclusiveRel (EventProxy e) Source # | |
Defined in Mischief.ECS.Observer | |
Type used for querying and inserting relationships.
Instances
| Functor Rel Source # | |
| Component c => RelQuery 'False (MR c Any) (Maybe [Rel c]) Source # | |
Defined in Mischief.ECS.World.Query.Queryable | |
| Component c => RelQuery 'False (R c Any) [Rel c] Source # | |
| Component c => RelQuery 'True (MR c Any) (Maybe (Rel c)) Source # | |
Defined in Mischief.ECS.World.Query.Queryable | |
| Component c => RelQuery 'True (R c Any) (Rel c) Source # | |
| Show c => Show (Rel c) Source # | |
| Eq c => Eq (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 (Rel c)) Source # | |
Defined in Mischief.ECS.World.Query.Queryable | |
| Component c => Queryable (R c Entity) (Rel c) Source # | |
Instances
| Functor Res Source # | |
| Show c => Show (Res c) Source # | |
| Eq c => Eq (Res c) Source # | |
| Component c => EraseIntoStorage (Res c) (BundleData ErasedComponent) Source # | |
Defined in Mischief.ECS.Components Methods erase :: Res c -> BundleData ErasedComponent Source # | |
| (Component c, Eq c) => EraseIntoStorage (Res c) (BundleData ErasedComponentEq) Source # | |
Defined in Mischief.ECS.Components Methods erase :: Res c -> BundleData ErasedComponentEq Source # | |
| Component c => Queryable (MRes c) (Maybe (Res c)) Source # | |
| Component c => Queryable (c -> Res c) (Res c) Source # | |
require :: forall {k} (b :: k). RequiredBundle b => Set DefaultComponentType Source #
UNLIFTED
Points to an unique entity. The first Word# is an id, the second is a generation.
It is guaranteed that there can't be two alive entities with the same id.
Instances
| Show Entity Source # | |
| Eq Entity Source # | |
| Ord Entity Source # | |
| Queryable E Entity Source # | |
| ListToOutgoing (Maybe Entity) Source # | |
Defined in Mischief.ECS.Relationships.Graph | |
| ListToOutgoing [Entity] Source # | |
Defined in Mischief.ECS.Relationships.Graph Methods listToOutgoing :: [Entity] -> [Entity] Source # | |
| Component c => ToFilterComponent (R c Entity) Source # | |
Defined in Mischief.ECS.World.Query.QueryFilter Methods toFilterComponent :: R c Entity -> FilterComponent Source # | |
| Component c => Queryable (HasR c Entity) Bool Source # | |
| Component c => Queryable (MR c Entity) (Maybe (Rel c)) Source # | |
Defined in Mischief.ECS.World.Query.Queryable | |
| Component c => Queryable (R c Entity) (Rel c) Source # | |
check :: forall m w. MonadSystem w m => QueryFilter -> Entity -> m Bool Source #
mkGet :: forall qd out (m :: Type -> Type). Queryable qd out => Entity -> qd -> Query m out Source #
mkGet' :: forall qd out (m :: Type -> Type). Queryable qd out => Entity -> qd -> QueryFilter -> Query m out Source #
mkQuery' :: forall qd out (m :: Type -> Type). Queryable qd out => qd -> QueryFilter -> Query m out Source #
queryOne :: MonadSystem w m => Query m out -> m (Maybe out) Source #
Run a Query, returning an arbitrary element produced by it, or nothing if the query was null.
runWhenOne :: Typeable a => Query System a -> (a -> System b) -> System () Source #
Same as runWhen, but runs when the provided query is not empty. Picks an arbitrary element to pass forward.
runWhenQ :: Typeable a => Query System a -> ([a] -> System b) -> System () Source #
Same as runWhen, but runs when the provided query is not empty.
single :: MonadSystem w m => Query m out -> m (Maybe out) Source #
Run a Query, returning an element only if it was the only result.
data Query (m :: Type -> Type) a Source #
A Query is a chain of operations which return a list of values when ran.
Instances
| MonadSystem w m => Applicative (Query m) Source # | |
| MonadSystem w m => Functor (Query m) Source # | |
| MonadSystem w m => Monad (Query m) Source # | |
data QueryFilter where Source #
Constructors
| NoFilter :: QueryFilter | |
| With :: forall a. ToFilterComponent a => a -> QueryFilter | |
| Without :: forall a. ToFilterComponent a => a -> QueryFilter | |
| Changed :: forall a. ToFilterComponent a => a -> (Tick -> Tick -> Bool) -> (Tick -> Tick -> Bool) -> QueryFilter | |
| And :: QueryFilter -> QueryFilter -> QueryFilter | |
| Or :: QueryFilter -> QueryFilter -> QueryFilter |
Instances
| Semigroup QueryFilter Source # | |
Defined in Mischief.ECS.World.Query.QueryFilter Methods (<>) :: QueryFilter -> QueryFilter -> QueryFilter # sconcat :: NonEmpty QueryFilter -> QueryFilter # stimes :: Integral b => b -> QueryFilter -> QueryFilter # | |
| (Component c, Queryable q out) => RelQuery 'False (MR c (Q' q QueryFilter)) (Maybe [From out]) Source # | |
Defined in Mischief.ECS.World.Query.Queryable Methods relRunQueryEntity :: MR c (Q' q QueryFilter) -> World -> Entity -> IO (Maybe (Maybe [From out])) Source # relRunQueryInternal :: MR c (Q' q QueryFilter) -> [ArchetypeId] -> World -> IO [(Entity, Bool, Maybe [From out])] Source # relQueryTypes :: MR c (Q' q QueryFilter) -> Set (TypeRep, TypeQuery) Source # | |
| (Component c, Queryable q out) => RelQuery 'False (R c (Q' q QueryFilter)) [From out] Source # | |
Defined in Mischief.ECS.World.Query.Queryable Methods relRunQueryEntity :: R c (Q' q QueryFilter) -> World -> Entity -> IO (Maybe [From out]) Source # relRunQueryInternal :: R c (Q' q QueryFilter) -> [ArchetypeId] -> World -> IO [(Entity, Bool, [From out])] Source # relQueryTypes :: R c (Q' q QueryFilter) -> Set (TypeRep, TypeQuery) Source # | |
| (Component c, Queryable q out) => RelQuery 'True (MR c (Q' q QueryFilter)) (Maybe (From out)) Source # | |
Defined in Mischief.ECS.World.Query.Queryable Methods relRunQueryEntity :: MR c (Q' q QueryFilter) -> World -> Entity -> IO (Maybe (Maybe (From out))) Source # relRunQueryInternal :: MR c (Q' q QueryFilter) -> [ArchetypeId] -> World -> IO [(Entity, Bool, Maybe (From out))] Source # relQueryTypes :: MR c (Q' q QueryFilter) -> Set (TypeRep, TypeQuery) Source # | |
| (Component c, Queryable q out) => RelQuery 'True (R c (Q' q QueryFilter)) (From out) Source # | |
Defined in Mischief.ECS.World.Query.Queryable Methods relRunQueryEntity :: R c (Q' q QueryFilter) -> World -> Entity -> IO (Maybe (From out)) Source # relRunQueryInternal :: R c (Q' q QueryFilter) -> [ArchetypeId] -> World -> IO [(Entity, Bool, From out)] Source # relQueryTypes :: R c (Q' q QueryFilter) -> Set (TypeRep, TypeQuery) Source # | |
| (Component c, Queryable q out) => Queryable (HasR c (Q' q QueryFilter)) Bool Source # | |
Defined in Mischief.ECS.World.Query.Queryable Methods runQueryEntity :: HasR c (Q' q QueryFilter) -> World -> Entity -> IO (Maybe Bool) Source # runQueryInternal :: HasR c (Q' q QueryFilter) -> [ArchetypeId] -> World -> IO [(Entity, Bool, Bool)] Source # queryTypes :: HasR c (Q' q QueryFilter) -> Set (TypeRep, TypeQuery) Source # | |
Wildcard used when querying for relationships to indicate that you're querying for relationships with any target.
In the case of exclusive relationships, Any returns a single relationship rather than a list of relationships.
Constructors
| Any |
Instances
| Component c => RelQuery 'False (MR c Any) (Maybe [Rel c]) Source # | |
Defined in Mischief.ECS.World.Query.Queryable | |
| Component c => RelQuery 'False (R c Any) [Rel c] Source # | |
| Component c => RelQuery 'True (MR c Any) (Maybe (Rel c)) Source # | |
Defined in Mischief.ECS.World.Query.Queryable | |
| Component c => RelQuery 'True (R c Any) (Rel c) Source # | |
| Component c => ToFilterComponent (R c Any) Source # | |
Defined in Mischief.ECS.World.Query.QueryFilter Methods toFilterComponent :: R c Any -> FilterComponent Source # | |
| Component c => Queryable (HasR c Any) Bool Source # | |
| RelQuery (IsExclusiveRel c) (MR c Any) out => Queryable (MR c Any) out Source # | |
| RelQuery (IsExclusiveRel c) (R c Any) out => Queryable (R c Any) out Source # | |
Used to query for a component or to remove a component. Forces queries to only include entities which have the component.
Example
Querying:
x <- query (C @Name)
Removing:
remove (C @Name)
Quasi Notation
None, you just write the component name directly. For instance:
x <- [q|Name|]
Constructors
| C |
Instances
| Component c => ToFilterComponent (C c) Source # | |
Defined in Mischief.ECS.World.Query.QueryFilter Methods toFilterComponent :: C c -> FilterComponent Source # | |
| Component c => Queryable (C c) c Source # | |
Defined in Mischief.ECS.World.Query.Queryable | |
Used to query for the Entity.
Example
x <- query E
Quasi Notation
Entity
entity
E
e
For instance:
x <- [q|Entity|]
Constructors
| E |
Used in queries to return a Bool which indicates whether a component exists on the entity or not.
Example
x <- query (Has @Name)
Quasi Notation
Has
has
H
h
For instance:
x <- [q|Has Name|]
Constructors
| Has |
newtype HasR (a :: k) b Source #
Exactly like R, except that it returns a Bool depending on whether the entity has such a relationship or not.
Example
x <- query (HasR @Likes Any)
Quasi Notation
Has
has
H
h
For instance:
x <- [q|Has Likes -> *|]
Constructors
| HasR b |
Instances
| Component c => Queryable (HasR c Entity) Bool Source # | |
| Component c => Queryable (HasR c Any) Bool Source # | |
| (Component c, Queryable q out) => Queryable (HasR c (Q q)) Bool Source # | |
| (Component c, Queryable q out) => Queryable (HasR c (Q' q QueryFilter)) Bool Source # | |
Defined in Mischief.ECS.World.Query.Queryable Methods runQueryEntity :: HasR c (Q' q QueryFilter) -> World -> Entity -> IO (Maybe Bool) Source # runQueryInternal :: HasR c (Q' q QueryFilter) -> [ArchetypeId] -> World -> IO [(Entity, Bool, Bool)] Source # queryTypes :: HasR c (Q' q QueryFilter) -> Set (TypeRep, TypeQuery) Source # | |
Used to query for a component that an entity may or may not have.
Example
x <- query (M @Name)
Quasi Notation
Maybe
maybe
M
m
For instance:
x <- [q|Maybe Name|]
Constructors
| M |
newtype MR (a :: k) b Source #
Exactly like R, except that it wraps the result in a Maybe, also including entities that don't have such a relationship.
Example
x <- query (MR @Likes Any)
Quasi Notation
Maybe
maybe
M
m
For instance:
x <- [q|Maybe Likes -> *|]
Constructors
| MR b |
Instances
| Component c => RelQuery 'False (MR c Any) (Maybe [Rel c]) Source # | |
Defined in Mischief.ECS.World.Query.Queryable | |
| (Component c, Queryable q out) => RelQuery 'False (MR c (Q q)) (Maybe [From out]) Source # | |
Defined in Mischief.ECS.World.Query.Queryable | |
| (Component c, Queryable q out) => RelQuery 'False (MR c (Q' q QueryFilter)) (Maybe [From out]) Source # | |
Defined in Mischief.ECS.World.Query.Queryable Methods relRunQueryEntity :: MR c (Q' q QueryFilter) -> World -> Entity -> IO (Maybe (Maybe [From out])) Source # relRunQueryInternal :: MR c (Q' q QueryFilter) -> [ArchetypeId] -> World -> IO [(Entity, Bool, Maybe [From out])] Source # relQueryTypes :: MR c (Q' q QueryFilter) -> Set (TypeRep, TypeQuery) Source # | |
| Component c => RelQuery 'True (MR c Any) (Maybe (Rel c)) Source # | |
Defined in Mischief.ECS.World.Query.Queryable | |
| (Component c, Queryable q out) => RelQuery 'True (MR c (Q q)) (Maybe (From out)) Source # | |
Defined in Mischief.ECS.World.Query.Queryable | |
| (Component c, Queryable q out) => RelQuery 'True (MR c (Q' q QueryFilter)) (Maybe (From out)) Source # | |
Defined in Mischief.ECS.World.Query.Queryable Methods relRunQueryEntity :: MR c (Q' q QueryFilter) -> World -> Entity -> IO (Maybe (Maybe (From out))) Source # relRunQueryInternal :: MR c (Q' q QueryFilter) -> [ArchetypeId] -> World -> IO [(Entity, Bool, Maybe (From out))] Source # relQueryTypes :: MR c (Q' q QueryFilter) -> Set (TypeRep, TypeQuery) Source # | |
| RelQuery (IsExclusiveRel c) (MR c Any) out => Queryable (MR c Any) out Source # | |
| RelQuery (IsExclusiveRel c) (MR c (Q q)) out => Queryable (MR c (Q q)) out Source # | |
| RelQuery (IsExclusiveRel c) (MR c (Q' q f)) out => Queryable (MR c (Q' q f)) out Source # | |
| Component c => Queryable (MR c Entity) (Maybe (Rel c)) Source # | |
Defined in Mischief.ECS.World.Query.Queryable | |
Used when writing transitive queries. See R.
Constructors
| Q a |
Instances
| (Component c, Queryable q out) => RelQuery 'False (MR c (Q q)) (Maybe [From out]) Source # | |
Defined in Mischief.ECS.World.Query.Queryable | |
| (Component c, Queryable q out) => RelQuery 'False (R c (Q q)) [From out] Source # | |
Defined in Mischief.ECS.World.Query.Queryable | |
| (Component c, Queryable q out) => RelQuery 'True (MR c (Q q)) (Maybe (From out)) Source # | |
Defined in Mischief.ECS.World.Query.Queryable | |
| (Component c, Queryable q out) => RelQuery 'True (R c (Q q)) (From out) Source # | |
| (Component c, Queryable q out) => Queryable (HasR c (Q q)) Bool Source # | |
| RelQuery (IsExclusiveRel c) (MR c (Q q)) out => Queryable (MR c (Q q)) out Source # | |
| RelQuery (IsExclusiveRel c) (R c (Q q)) out => Queryable (R c (Q q)) out Source # | |
Used when writing transitive queries with filters. See R.
Constructors
| Q' a b |
Instances
| (Component c, Queryable q out) => RelQuery 'False (MR c (Q' q QueryFilter)) (Maybe [From out]) Source # | |
Defined in Mischief.ECS.World.Query.Queryable Methods relRunQueryEntity :: MR c (Q' q QueryFilter) -> World -> Entity -> IO (Maybe (Maybe [From out])) Source # relRunQueryInternal :: MR c (Q' q QueryFilter) -> [ArchetypeId] -> World -> IO [(Entity, Bool, Maybe [From out])] Source # relQueryTypes :: MR c (Q' q QueryFilter) -> Set (TypeRep, TypeQuery) Source # | |
| (Component c, Queryable q out) => RelQuery 'False (R c (Q' q QueryFilter)) [From out] Source # | |
Defined in Mischief.ECS.World.Query.Queryable Methods relRunQueryEntity :: R c (Q' q QueryFilter) -> World -> Entity -> IO (Maybe [From out]) Source # relRunQueryInternal :: R c (Q' q QueryFilter) -> [ArchetypeId] -> World -> IO [(Entity, Bool, [From out])] Source # relQueryTypes :: R c (Q' q QueryFilter) -> Set (TypeRep, TypeQuery) Source # | |
| (Component c, Queryable q out) => RelQuery 'True (MR c (Q' q QueryFilter)) (Maybe (From out)) Source # | |
Defined in Mischief.ECS.World.Query.Queryable Methods relRunQueryEntity :: MR c (Q' q QueryFilter) -> World -> Entity -> IO (Maybe (Maybe (From out))) Source # relRunQueryInternal :: MR c (Q' q QueryFilter) -> [ArchetypeId] -> World -> IO [(Entity, Bool, Maybe (From out))] Source # relQueryTypes :: MR c (Q' q QueryFilter) -> Set (TypeRep, TypeQuery) Source # | |
| (Component c, Queryable q out) => RelQuery 'True (R c (Q' q QueryFilter)) (From out) Source # | |
Defined in Mischief.ECS.World.Query.Queryable Methods relRunQueryEntity :: R c (Q' q QueryFilter) -> World -> Entity -> IO (Maybe (From out)) Source # relRunQueryInternal :: R c (Q' q QueryFilter) -> [ArchetypeId] -> World -> IO [(Entity, Bool, From out)] Source # relQueryTypes :: R c (Q' q QueryFilter) -> Set (TypeRep, TypeQuery) Source # | |
| (Component c, Queryable q out) => Queryable (HasR c (Q' q QueryFilter)) Bool Source # | |
Defined in Mischief.ECS.World.Query.Queryable Methods runQueryEntity :: HasR c (Q' q QueryFilter) -> World -> Entity -> IO (Maybe Bool) Source # runQueryInternal :: HasR c (Q' q QueryFilter) -> [ArchetypeId] -> World -> IO [(Entity, Bool, Bool)] Source # queryTypes :: HasR c (Q' q QueryFilter) -> Set (TypeRep, TypeQuery) Source # | |
| RelQuery (IsExclusiveRel c) (MR c (Q' q f)) out => Queryable (MR c (Q' q f)) out Source # | |
| RelQuery (IsExclusiveRel c) (R c (Q' q f)) out => Queryable (R c (Q' q f)) out Source # | |
Used to query for a relationships. Can be used in three different ways:
1. R c e
Queries for a relationship with a specific target. Forces queries to only include entities which have such a relationship.
Example
x <- query (R @Likes alice)
x :: [Result (Rel Likes)]
Quasi Notation
It is written with an arrow like so:
x <- [q|Likes -> alice|]
2. R c Any
Queries for all relationships with any target. Forces queries to only include entities which have at least one such relationship.
Example
x <- query (R @Likes Any)
x :: [[Result (Rel Likes)]]
Quasi Notation
x <- [q|Likes -> *|]
3. R c q
Runs a transitive query on the targets of all such relationships.
q can either be Q d or Q' d f, depending if you want to also run a filter or not.
Similar to the previous case, it will limit the query to only entities which have such a relationship with at least one entity which matches the transitive query.
Example
x <- query (R @Likes (Q (C @Name))
x <- query (R @Likes (Q' (C @Name) (With (C @Enemy))))
x :: [[Result Name]]
Quasi Notation
You just write the given query in the () following the arrow. / can be used to give it a filter.
For instance:
x <- [q|Likes -> (Name)|]
x <- [q|Likes -> (Name / With Enemy)|]
Constructors
| R b |
Instances
| Component c => RelQuery 'False (R c Any) [Rel c] Source # | |
| (Component c, Queryable q out) => RelQuery 'False (R c (Q q)) [From out] Source # | |
Defined in Mischief.ECS.World.Query.Queryable | |
| (Component c, Queryable q out) => RelQuery 'False (R c (Q' q QueryFilter)) [From out] Source # | |
Defined in Mischief.ECS.World.Query.Queryable Methods relRunQueryEntity :: R c (Q' q QueryFilter) -> World -> Entity -> IO (Maybe [From out]) Source # relRunQueryInternal :: R c (Q' q QueryFilter) -> [ArchetypeId] -> World -> IO [(Entity, Bool, [From out])] Source # relQueryTypes :: R c (Q' q QueryFilter) -> Set (TypeRep, TypeQuery) Source # | |
| Component c => RelQuery 'True (R c Any) (Rel c) Source # | |
| (Component c, Queryable q out) => RelQuery 'True (R c (Q q)) (From out) Source # | |
| (Component c, Queryable q out) => RelQuery 'True (R c (Q' q QueryFilter)) (From out) Source # | |
Defined in Mischief.ECS.World.Query.Queryable Methods relRunQueryEntity :: R c (Q' q QueryFilter) -> World -> Entity -> IO (Maybe (From out)) Source # relRunQueryInternal :: R c (Q' q QueryFilter) -> [ArchetypeId] -> World -> IO [(Entity, Bool, From out)] Source # relQueryTypes :: R c (Q' q QueryFilter) -> Set (TypeRep, TypeQuery) Source # | |
| Component c => ToFilterComponent (R c Entity) Source # | |
Defined in Mischief.ECS.World.Query.QueryFilter Methods toFilterComponent :: R c Entity -> FilterComponent Source # | |
| Component c => ToFilterComponent (R c Any) Source # | |
Defined in Mischief.ECS.World.Query.QueryFilter Methods toFilterComponent :: R c Any -> FilterComponent Source # | |
| RelQuery (IsExclusiveRel c) (R c Any) out => Queryable (R c Any) out Source # | |
| RelQuery (IsExclusiveRel c) (R c (Q q)) out => Queryable (R c (Q q)) out Source # | |
| RelQuery (IsExclusiveRel c) (R c (Q' q f)) out => Queryable (R c (Q' q f)) out Source # | |
| Component c => Queryable (R c Entity) (Rel c) Source # | |
newtype R' (a :: k) b Source #
Constructors
| R' b |
module Mischief.ECS.World.Query.TH
insert :: HasCallStack => forall b. Bundle b => b -> Entity -> System () Source #
Insert a bundle of components on an Entity.
If the entity already contains these components, their values will be updated in-place instead of causing an archetype change.
insertNew :: Bundle b => b -> Entity -> System () Source #
Insert a bundle of components on an Entity.
Only the components that the entity doesn't already have will be inserted, and the rest ignored.
despawn :: Entity -> System () Source #
Despawn an entity. This will trigger the OnRemove events and hooks on all its components.
spawn :: (HasCallStack, Bundle b) => b -> System Entity Source #
Spawn an entity given a bundle of components.
spawnDefer :: Bundle b => b -> ParSystem Entity Source #
Spawn an entity given a bundle of components, inside a ParSystem.
This will immediately reserve and return an Entity index which can be used, while defering the actual spawn.
spawn_ :: (HasCallStack, Bundle b) => b -> System () Source #
Same as spawn but discards the returned entity.
insertRes :: (Component r, Bundle r) => r -> System () Source #
Insert a resource into the World. If the resource already exists, its value will be overwritten.
res :: forall c m w. (MonadSystem w m, Component c) => m (Maybe c) Source #
Get the value of a resource from the World.
resOrInsert :: (Component r, Bundle r) => r -> System r Source #
Get the value of a resource, or insert a resource if it doesn't exist.
resOrInsertM :: (Component r, Bundle r) => System r -> System r Source #
Same as resOrInsert but allows the default resource to be produced by a System.
class Typeable e => Event e Source #
Event typeclass.
Instances
| (Typeable c, Typeable k) => Event (OnAdd c) Source # | |
Defined in Mischief.ECS.Events Methods eraseEvent :: OnAdd c -> ErasedEvent Source # | |
| (Typeable c, Typeable k) => Event (OnAddRel c) Source # | |
Defined in Mischief.ECS.Events Methods eraseEvent :: OnAddRel c -> ErasedEvent Source # | |
| (Typeable c, Typeable k) => Event (OnRemove c) Source # | |
Defined in Mischief.ECS.Events Methods eraseEvent :: OnRemove c -> ErasedEvent Source # | |
| (Typeable c, Typeable k) => Event (OnRemoveRel c) Source # | |
Defined in Mischief.ECS.Events Methods eraseEvent :: OnRemoveRel c -> ErasedEvent Source # | |
| (Typeable c, Typeable k) => Event (OnSet c) Source # | |
Defined in Mischief.ECS.Events Methods eraseEvent :: OnSet c -> ErasedEvent Source # | |
| (Typeable c, Typeable k) => Event (OnSetRel c) Source # | |
Defined in Mischief.ECS.Events Methods eraseEvent :: OnSetRel c -> ErasedEvent Source # | |
runWhen :: Typeable a => System (Maybe a) -> (a -> System b) -> System () Source #
Primitive that allows you to set a system to run at every sync point until it returns a Just a, at which point
it will run the second system with the obtained a and stop running.
It will run once on the spot, meaning it has no overhead if the first system immediately succeed.
You should only use this in one-time logic, such as Events or the Startup schedule. You should not use it in logic that runs continuously, such as in Update, as it will keep queueing up a new system to check without removing the old one.
class (GetWorld w, MonadReader w a, Applicative a, MonadFail a, Functor a, Monad a, MonadIO a, PrimMonad a, PrimState a ~ RealWorld, MonadThrow a, SystemAny a) => MonadSystem w (a :: Type -> Type) Source #
Typeclass that can be used to generalize systems to both and System.ParSystem
Used mainly by queries and other operations which don't mutate the World.
Instances
| MonadSystem ParWorld ParSystem Source # | |
Defined in Mischief.ECS.World | |
A variant of System that contains a ParWorld instead of World.
Parallel systems will only be able to run systems that are either specifically intended for them or
are made to work with any (such as queries).MonadSystem
To run a normal System (), you need to defer!
Instances
| MonadThrow ParSystem Source # | |
Defined in Mischief.ECS.World Methods throwM :: (HasCallStack, Exception e) => e -> ParSystem a # | |
| Applicative ParSystem Source # | |
| Functor ParSystem Source # | |
| Monad ParSystem Source # | |
| MonadFail ParSystem Source # | |
Defined in Mischief.ECS.World | |
| MonadIO ParSystem Source # | |
Defined in Mischief.ECS.World | |
| SystemAny ParSystem Source # | |
| PrimMonad ParSystem Source # | |
| MonadSystem ParWorld ParSystem Source # | |
Defined in Mischief.ECS.World | |
| MonadReader ParWorld ParSystem Source # | |
| type PrimState ParSystem Source # | |
A System is a monad that mutates the World.
It can be added to a certain schedule and ordered with other systems.
It also offers IO access via liftIO.
Read the tutorial on systems for more details.
Instances
| MonadThrow System Source # | |
Defined in Mischief.ECS.World Methods throwM :: (HasCallStack, Exception e) => e -> System a # | |
| Applicative System Source # | |
| Functor System Source # | |
| Monad System Source # | |
| MonadFail System Source # | |
Defined in Mischief.ECS.World | |
| MonadIO System Source # | |
Defined in Mischief.ECS.World | |
| SystemAny System Source # | |
| PrimMonad System Source # | |
| EraseIntoStorage (System ()) Systems Source # | |
| EraseIntoStorage (System ()) [System ()] Source # | |
| type PrimState System Source # | |
Defined in Mischief.ECS.World | |
data TimePlugin Source #
Plugin that keeps track of time. Enables calling delta, elapsed, and so on.
Note that these methods are context-dependent. For instance, if used in a Fixed schedule, delta will always return the time as inferred from the fixed frequency.
Instances
| Plugin TimePlugin Source # | |
Defined in Mischief.ECS.Time | |
defer :: MonadSystem w m => System a -> m () Source #
Defer a System. This will put it in the current deferred queue which is typically flushed in-between scheduled systems.
This is useful for executing mutations in parallel systems.
You can manually flush the queue with flush.
delay :: MonadSystem w m => Float -> System a -> m () Source #
Delay a system by a given amount of seconds.
Example:
delay 1.5 $ insert (Health 100) player
runAfter :: MonadSystem w m => IO a -> (a -> System ()) -> m () Source #
Run an IO action asynchronously before running a System with its output. Useful when performing significant IO such as reading / loading files.
dep :: Plugin p => Dependency Source #
data Dependency Source #
Instances
| Show Dependency Source # | |
Defined in Mischief.ECS.App.Plugins Methods showsPrec :: Int -> Dependency -> ShowS # show :: Dependency -> String # showList :: [Dependency] -> ShowS # | |
| Eq Dependency Source # | |
Defined in Mischief.ECS.App.Plugins | |
| Ord Dependency Source # | |
Defined in Mischief.ECS.App.Plugins Methods compare :: Dependency -> Dependency -> Ordering # (<) :: Dependency -> Dependency -> Bool # (<=) :: Dependency -> Dependency -> Bool # (>) :: Dependency -> Dependency -> Bool # (>=) :: Dependency -> Dependency -> Bool # max :: Dependency -> Dependency -> Dependency # min :: Dependency -> Dependency -> Dependency # | |
class Typeable p => Plugin p where Source #
Minimal complete definition
Nothing
Instances
| Plugin FixedPlugin Source # | |
Defined in Mischief.ECS.Fixed | |
| Plugin TimePlugin Source # | |
Defined in Mischief.ECS.Time | |
data PostStartup Source #
Instances
| Schedule PostStartup Source # | |
Defined in Mischief.ECS.App.Schedules | |
data PostUpdate Source #
Instances
| Schedule PostUpdate Source # | |
Defined in Mischief.ECS.App.Schedules | |
data PreStartup Source #
Instances
| Schedule PreStartup Source # | |
Defined in Mischief.ECS.App.Schedules | |
class Typeable s => Schedule (s :: k) Source #
Instances
| Schedule First Source # | |
Defined in Mischief.ECS.App.Schedules | |
| Schedule Init Source # | |
Defined in Mischief.ECS.App.Schedules | |
| Schedule Last Source # | |
Defined in Mischief.ECS.App.Schedules | |
| Schedule PostStartup Source # | |
Defined in Mischief.ECS.App.Schedules | |
| Schedule PostUpdate Source # | |
Defined in Mischief.ECS.App.Schedules | |
| Schedule PreStartup Source # | |
Defined in Mischief.ECS.App.Schedules | |
| Schedule PreUpdate Source # | |
Defined in Mischief.ECS.App.Schedules | |
| Schedule Startup Source # | |
Defined in Mischief.ECS.App.Schedules | |
| Schedule Update Source # | |
Defined in Mischief.ECS.App.Schedules | |
| Schedule Fixed Source # | |
Defined in Mischief.ECS.Fixed | |
| Schedule FixedFirst Source # | |
Defined in Mischief.ECS.Fixed | |
| Schedule FixedLast Source # | |
Defined in Mischief.ECS.Fixed | |
| Schedule FixedPostUpdate Source # | |
Defined in Mischief.ECS.Fixed | |
| Schedule FixedPreUpdate Source # | |
Defined in Mischief.ECS.Fixed | |
| Schedule FixedUpdate Source # | |
Defined in Mischief.ECS.Fixed | |
data StartupSchedule Source #
Constructors
| StartupSchedule |
Instances
| Component StartupSchedule Source # | |||||
Defined in Mischief.ECS.App.Schedules Associated Types
Methods required :: Set DefaultComponentType Source # onAdd :: [Hook StartupSchedule] Source # onSet :: [Hook StartupSchedule] Source # onRemove :: [Hook StartupSchedule] Source # onAddRel :: [HookRel StartupSchedule] Source # | |||||
| type IsExclusiveRel StartupSchedule Source # | |||||
Defined in Mischief.ECS.App.Schedules | |||||
data UpdateSchedule Source #
Constructors
| UpdateSchedule |
Instances
| Component UpdateSchedule Source # | |||||
Defined in Mischief.ECS.App.Schedules Associated Types
Methods required :: Set DefaultComponentType Source # onAdd :: [Hook UpdateSchedule] Source # onSet :: [Hook UpdateSchedule] Source # onRemove :: [Hook UpdateSchedule] Source # onAddRel :: [HookRel UpdateSchedule] Source # onSetRel :: [HookRel UpdateSchedule] Source # | |||||
| type IsExclusiveRel UpdateSchedule Source # | |||||
Defined in Mischief.ECS.App.Schedules | |||||
after :: ToSystems a => a -> SystemConfig -> SystemConfig Source #
before :: ToSystems a => a -> SystemConfig -> SystemConfig Source #
order :: forall {k} (sc :: k) a b. (Schedule sc, ToSystems a, ToSystems b) => (a, b) -> System () Source #
systems :: ToSystems a => a -> SystemConfig Source #
unschedule :: forall {k} (sc :: k) a. (Schedule sc, ToSystems a) => a -> System () Source #
Disconnect a system from a schedule. This will keep the system's entity alive, as well as all its other relationships and data,
so that if scheduled again it will work the same as before. Use this if you plan to dynamically schedule and unschedule a system. Otherwise check unschedule'.
unschedule' :: forall {k} (sc :: k) a. (Schedule sc, ToSystems a) => a -> System () Source #
Disconnect a system rom a schedule. This will despawn the system's entity, losing all its data such as ordering with other systems.
Use this if you want to disable a scheduled system for good. Otherwise check unschedule.
module Mischief.ECS.Log
expect :: (HasCallStack, Unwrappable f) => Text -> f a -> a Source #
unwrap :: (HasCallStack, Unwrappable f) => f a -> a Source #
module Mischief.ECS.Events
newtype HookContext Source #
Constructors
| HookContext | |
data HookContextRel Source #
Constructors
| HookContextRel | |
module Mischief.ECS.Hooks
bundle :: Bundle b => b -> BundleBuilder Source #
bundleEq :: BundleEq b => b -> BundleEqBuilder Source #
type Bundle b = Collectable b (BundleData ErasedComponent) Source #
type BundleEq b = Collectable b (BundleData ErasedComponentEq) Source #
Instances
| Typeable e => Component (Observer e) Source # | |||||
Defined in Mischief.ECS.Observer Associated Types
| |||||
| type IsExclusiveRel (Observer e) Source # | |||||
Defined in Mischief.ECS.Observer | |||||
newtype FixedFrequency Source #
Resource determining the frequency at which Fixed schedules are ran. Defaults to 0.03 (30fps).
Constructors
| FixedFrequency Float |
Instances
| Default FixedFrequency Source # | |||||
Defined in Mischief.ECS.Fixed Methods def :: FixedFrequency # | |||||
| Component FixedFrequency Source # | |||||
Defined in Mischief.ECS.Fixed Associated Types
Methods required :: Set DefaultComponentType Source # onAdd :: [Hook FixedFrequency] Source # onSet :: [Hook FixedFrequency] Source # onRemove :: [Hook FixedFrequency] Source # onAddRel :: [HookRel FixedFrequency] Source # onSetRel :: [HookRel FixedFrequency] Source # | |||||
| type IsExclusiveRel FixedFrequency Source # | |||||
Defined in Mischief.ECS.Fixed | |||||
data FixedPlugin Source #
Plugin that enables running systems in Fixed schedules such as FixedUpdate and FixedPostUpdate.
Overwrite the FixedFrequency resource to change the frequency at which Fixed schedules are ran.
Instances
| Plugin FixedPlugin Source # | |
Defined in Mischief.ECS.Fixed | |
data FixedPostUpdate Source #
Instances
| Show FixedPostUpdate Source # | |
Defined in Mischief.ECS.Fixed Methods showsPrec :: Int -> FixedPostUpdate -> ShowS # show :: FixedPostUpdate -> String # showList :: [FixedPostUpdate] -> ShowS # | |
| Schedule FixedPostUpdate Source # | |
Defined in Mischief.ECS.Fixed | |
data FixedPreUpdate Source #
Instances
| Show FixedPreUpdate Source # | |
Defined in Mischief.ECS.Fixed Methods showsPrec :: Int -> FixedPreUpdate -> ShowS # show :: FixedPreUpdate -> String # showList :: [FixedPreUpdate] -> ShowS # | |
| Schedule FixedPreUpdate Source # | |
Defined in Mischief.ECS.Fixed | |
data FixedUpdate Source #
Instances
| Show FixedUpdate Source # | |
Defined in Mischief.ECS.Fixed Methods showsPrec :: Int -> FixedUpdate -> ShowS # show :: FixedUpdate -> String # showList :: [FixedUpdate] -> ShowS # | |
| Schedule FixedUpdate Source # | |
Defined in Mischief.ECS.Fixed | |
(&) :: a -> (a -> b) -> b infixl 1 #
& is a reverse application operator. This provides notational
convenience. Its precedence is one higher than that of the forward
application operator $, which allows & to be nested in $.
This is a version of , where flip idid is specialized from a -> a to (a -> b) -> (a -> b)
which by the associativity of (->) is (a -> b) -> a -> b.
flipping this yields a -> (a -> b) -> b which is the type signature of &
Examples
>>>5 & (+1) & show"6"
>>>sqrt $ [1 / n^2 | n <- [1..1000]] & sum & (*6)3.1406380562059946
Since: base-4.8.0.0
Constructors
| ChildOf |
Instances
| Show ChildOf Source # | |||||
| Component ChildOf Source # | |||||
Defined in Mischief.ECS.Relationships.ChildOf Associated Types
| |||||
| type IsExclusiveRel ChildOf Source # | |||||
Defined in Mischief.ECS.Relationships.ChildOf | |||||
class Queryable qd output | qd -> output Source #
Minimal complete definition
Instances
| Queryable E Entity Source # | |
| Queryable () () Source # | |
Defined in Mischief.ECS.World.Query.Queryable | |
| Component c => Queryable (C c) c Source # | |
Defined in Mischief.ECS.World.Query.Queryable | |
| Component c => Queryable (Has c) Bool Source # | |
| Component c => Queryable (HasRes c) Bool Source # | |
| Component c => Queryable (M c) (Maybe c) Source # | |
| Component c => Queryable (MRes c) (Maybe (Res c)) Source # | |
| Component c => Queryable (c -> Res c) (Res c) Source # | |
| (Queryable q0 o0, Queryable q1 o1) => Queryable (q0, q1) (o0, o1) Source # | |
Defined in Mischief.ECS.World.Query.Queryable | |
| Component c => Queryable (HasR c Entity) Bool Source # | |
| Component c => Queryable (HasR c Any) Bool Source # | |
| (Component c, Queryable q out) => Queryable (HasR c (Q q)) Bool Source # | |
| (Component c, Queryable q out) => Queryable (HasR c (Q' q QueryFilter)) Bool Source # | |
Defined in Mischief.ECS.World.Query.Queryable Methods runQueryEntity :: HasR c (Q' q QueryFilter) -> World -> Entity -> IO (Maybe Bool) Source # runQueryInternal :: HasR c (Q' q QueryFilter) -> [ArchetypeId] -> World -> IO [(Entity, Bool, Bool)] Source # queryTypes :: HasR c (Q' q QueryFilter) -> Set (TypeRep, TypeQuery) Source # | |
| RelQuery (IsExclusiveRel c) (MR c Any) out => Queryable (MR c Any) out Source # | |
| RelQuery (IsExclusiveRel c) (MR c (Q q)) out => Queryable (MR c (Q q)) out Source # | |
| RelQuery (IsExclusiveRel c) (MR c (Q' q f)) out => Queryable (MR c (Q' q f)) out Source # | |
| RelQuery (IsExclusiveRel c) (R c Any) out => Queryable (R c Any) out Source # | |
| RelQuery (IsExclusiveRel c) (R c (Q q)) out => Queryable (R c (Q q)) out Source # | |
| RelQuery (IsExclusiveRel c) (R c (Q' q f)) out => Queryable (R c (Q' q f)) out Source # | |
| RelQuery 'False (R c e) out => Queryable (R' c e) out Source # | |
Defined in Mischief.ECS.World.Query.Queryable | |
| Component c => Queryable (MR c Entity) (Maybe (Rel c)) Source # | |
Defined in Mischief.ECS.World.Query.Queryable | |
| Component c => Queryable (R c Entity) (Rel c) Source # | |
| (Queryable q0 o0, Queryable q1 o1, Queryable q2 o2) => Queryable (q0, q1, q2) (o0, o1, o2) Source # | |
Defined in Mischief.ECS.World.Query.Queryable | |
| (Queryable q0 o0, Queryable q1 o1, Queryable q2 o2, Queryable q3 o3) => Queryable (q0, q1, q2, q3) (o0, o1, o2, o3) Source # | |
Defined in Mischief.ECS.World.Query.Queryable | |
| (Queryable q0 o0, Queryable q1 o1, Queryable q2 o2, Queryable q3 o3, Queryable q4 o4) => Queryable (q0, q1, q2, q3, q4) (o0, o1, o2, o3, o4) Source # | |
Defined in Mischief.ECS.World.Query.Queryable | |
| (Queryable q0 o0, Queryable q1 o1, Queryable q2 o2, Queryable q3 o3, Queryable q4 o4, Queryable q5 o5) => Queryable (q0, q1, q2, q3, q4, q5) (o0, o1, o2, o3, o4, o5) Source # | |
Defined in Mischief.ECS.World.Query.Queryable Methods runQueryEntity :: (q0, q1, q2, q3, q4, q5) -> World -> Entity -> IO (Maybe (o0, o1, o2, o3, o4, o5)) Source # runQueryInternal :: (q0, q1, q2, q3, q4, q5) -> [ArchetypeId] -> World -> IO [(Entity, Bool, (o0, o1, o2, o3, o4, o5))] Source # queryTypes :: (q0, q1, q2, q3, q4, q5) -> Set (TypeRep, TypeQuery) Source # | |
| (Queryable q0 o0, Queryable q1 o1, Queryable q2 o2, Queryable q3 o3, Queryable q4 o4, Queryable q5 o5, Queryable q6 o6) => Queryable (q0, q1, q2, q3, q4, q5, q6) (o0, o1, o2, o3, o4, o5, o6) Source # | |
Defined in Mischief.ECS.World.Query.Queryable Methods runQueryEntity :: (q0, q1, q2, q3, q4, q5, q6) -> World -> Entity -> IO (Maybe (o0, o1, o2, o3, o4, o5, o6)) Source # runQueryInternal :: (q0, q1, q2, q3, q4, q5, q6) -> [ArchetypeId] -> World -> IO [(Entity, Bool, (o0, o1, o2, o3, o4, o5, o6))] Source # queryTypes :: (q0, q1, q2, q3, q4, q5, q6) -> Set (TypeRep, TypeQuery) Source # | |
| (Queryable q0 o0, Queryable q1 o1, Queryable q2 o2, Queryable q3 o3, Queryable q4 o4, Queryable q5 o5, Queryable q6 o6, Queryable q7 o7) => Queryable (q0, q1, q2, q3, q4, q5, q6, q7) (o0, o1, o2, o3, o4, o5, o6, o7) Source # | |
Defined in Mischief.ECS.World.Query.Queryable Methods runQueryEntity :: (q0, q1, q2, q3, q4, q5, q6, q7) -> World -> Entity -> IO (Maybe (o0, o1, o2, o3, o4, o5, o6, o7)) Source # runQueryInternal :: (q0, q1, q2, q3, q4, q5, q6, q7) -> [ArchetypeId] -> World -> IO [(Entity, Bool, (o0, o1, o2, o3, o4, o5, o6, o7))] Source # queryTypes :: (q0, q1, q2, q3, q4, q5, q6, q7) -> Set (TypeRep, TypeQuery) Source # | |
| (Queryable q0 o0, Queryable q1 o1, Queryable q2 o2, Queryable q3 o3, Queryable q4 o4, Queryable q5 o5, Queryable q6 o6, Queryable q7 o7, Queryable q8 o8) => Queryable (q0, q1, q2, q3, q4, q5, q6, q7, q8) (o0, o1, o2, o3, o4, o5, o6, o7, o8) Source # | |
Defined in Mischief.ECS.World.Query.Queryable Methods runQueryEntity :: (q0, q1, q2, q3, q4, q5, q6, q7, q8) -> World -> Entity -> IO (Maybe (o0, o1, o2, o3, o4, o5, o6, o7, o8)) Source # runQueryInternal :: (q0, q1, q2, q3, q4, q5, q6, q7, q8) -> [ArchetypeId] -> World -> IO [(Entity, Bool, (o0, o1, o2, o3, o4, o5, o6, o7, o8))] Source # queryTypes :: (q0, q1, q2, q3, q4, q5, q6, q7, q8) -> Set (TypeRep, TypeQuery) Source # | |
| (Queryable q0 o0, Queryable q1 o1, Queryable q2 o2, Queryable q3 o3, Queryable q4 o4, Queryable q5 o5, Queryable q6 o6, Queryable q7 o7, Queryable q8 o8, Queryable q9 o9) => Queryable (q0, q1, q2, q3, q4, q5, q6, q7, q8, q9) (o0, o1, o2, o3, o4, o5, o6, o7, o8, o9) Source # | |
Defined in Mischief.ECS.World.Query.Queryable Methods runQueryEntity :: (q0, q1, q2, q3, q4, q5, q6, q7, q8, q9) -> World -> Entity -> IO (Maybe (o0, o1, o2, o3, o4, o5, o6, o7, o8, o9)) Source # runQueryInternal :: (q0, q1, q2, q3, q4, q5, q6, q7, q8, q9) -> [ArchetypeId] -> World -> IO [(Entity, Bool, (o0, o1, o2, o3, o4, o5, o6, o7, o8, o9))] Source # queryTypes :: (q0, q1, q2, q3, q4, q5, q6, q7, q8, q9) -> Set (TypeRep, TypeQuery) Source # | |
| (Queryable q0 o0, Queryable q1 o1, Queryable q2 o2, Queryable q3 o3, Queryable q4 o4, Queryable q5 o5, Queryable q6 o6, Queryable q7 o7, Queryable q8 o8, Queryable q9 o9, Queryable q10 o10) => Queryable (q0, q1, q2, q3, q4, q5, q6, q7, q8, q9, q10) (o0, o1, o2, o3, o4, o5, o6, o7, o8, o9, o10) Source # | |
Defined in Mischief.ECS.World.Query.Queryable Methods runQueryEntity :: (q0, q1, q2, q3, q4, q5, q6, q7, q8, q9, q10) -> World -> Entity -> IO (Maybe (o0, o1, o2, o3, o4, o5, o6, o7, o8, o9, o10)) Source # runQueryInternal :: (q0, q1, q2, q3, q4, q5, q6, q7, q8, q9, q10) -> [ArchetypeId] -> World -> IO [(Entity, Bool, (o0, o1, o2, o3, o4, o5, o6, o7, o8, o9, o10))] Source # queryTypes :: (q0, q1, q2, q3, q4, q5, q6, q7, q8, q9, q10) -> Set (TypeRep, TypeQuery) Source # | |
| (Queryable q0 o0, Queryable q1 o1, Queryable q2 o2, Queryable q3 o3, Queryable q4 o4, Queryable q5 o5, Queryable q6 o6, Queryable q7 o7, Queryable q8 o8, Queryable q9 o9, Queryable q10 o10, Queryable q11 o11) => Queryable (q0, q1, q2, q3, q4, q5, q6, q7, q8, q9, q10, q11) (o0, o1, o2, o3, o4, o5, o6, o7, o8, o9, o10, o11) Source # | |
Defined in Mischief.ECS.World.Query.Queryable Methods runQueryEntity :: (q0, q1, q2, q3, q4, q5, q6, q7, q8, q9, q10, q11) -> World -> Entity -> IO (Maybe (o0, o1, o2, o3, o4, o5, o6, o7, o8, o9, o10, o11)) Source # runQueryInternal :: (q0, q1, q2, q3, q4, q5, q6, q7, q8, q9, q10, q11) -> [ArchetypeId] -> World -> IO [(Entity, Bool, (o0, o1, o2, o3, o4, o5, o6, o7, o8, o9, o10, o11))] Source # queryTypes :: (q0, q1, q2, q3, q4, q5, q6, q7, q8, q9, q10, q11) -> Set (TypeRep, TypeQuery) Source # | |
| (Queryable q0 o0, Queryable q1 o1, Queryable q2 o2, Queryable q3 o3, Queryable q4 o4, Queryable q5 o5, Queryable q6 o6, Queryable q7 o7, Queryable q8 o8, Queryable q9 o9, Queryable q10 o10, Queryable q11 o11, Queryable q12 o12) => Queryable (q0, q1, q2, q3, q4, q5, q6, q7, q8, q9, q10, q11, q12) (o0, o1, o2, o3, o4, o5, o6, o7, o8, o9, o10, o11, o12) Source # | |
Defined in Mischief.ECS.World.Query.Queryable Methods runQueryEntity :: (q0, q1, q2, q3, q4, q5, q6, q7, q8, q9, q10, q11, q12) -> World -> Entity -> IO (Maybe (o0, o1, o2, o3, o4, o5, o6, o7, o8, o9, o10, o11, o12)) Source # runQueryInternal :: (q0, q1, q2, q3, q4, q5, q6, q7, q8, q9, q10, q11, q12) -> [ArchetypeId] -> World -> IO [(Entity, Bool, (o0, o1, o2, o3, o4, o5, o6, o7, o8, o9, o10, o11, o12))] Source # queryTypes :: (q0, q1, q2, q3, q4, q5, q6, q7, q8, q9, q10, q11, q12) -> Set (TypeRep, TypeQuery) Source # | |
| (Queryable q0 o0, Queryable q1 o1, Queryable q2 o2, Queryable q3 o3, Queryable q4 o4, Queryable q5 o5, Queryable q6 o6, Queryable q7 o7, Queryable q8 o8, Queryable q9 o9, Queryable q10 o10, Queryable q11 o11, Queryable q12 o12, Queryable q13 o13) => Queryable (q0, q1, q2, q3, q4, q5, q6, q7, q8, q9, q10, q11, q12, q13) (o0, o1, o2, o3, o4, o5, o6, o7, o8, o9, o10, o11, o12, o13) Source # | |
Defined in Mischief.ECS.World.Query.Queryable Methods runQueryEntity :: (q0, q1, q2, q3, q4, q5, q6, q7, q8, q9, q10, q11, q12, q13) -> World -> Entity -> IO (Maybe (o0, o1, o2, o3, o4, o5, o6, o7, o8, o9, o10, o11, o12, o13)) Source # runQueryInternal :: (q0, q1, q2, q3, q4, q5, q6, q7, q8, q9, q10, q11, q12, q13) -> [ArchetypeId] -> World -> IO [(Entity, Bool, (o0, o1, o2, o3, o4, o5, o6, o7, o8, o9, o10, o11, o12, o13))] Source # queryTypes :: (q0, q1, q2, q3, q4, q5, q6, q7, q8, q9, q10, q11, q12, q13) -> Set (TypeRep, TypeQuery) Source # | |
| (Queryable q0 o0, Queryable q1 o1, Queryable q2 o2, Queryable q3 o3, Queryable q4 o4, Queryable q5 o5, Queryable q6 o6, Queryable q7 o7, Queryable q8 o8, Queryable q9 o9, Queryable q10 o10, Queryable q11 o11, Queryable q12 o12, Queryable q13 o13, Queryable q14 o14) => Queryable (q0, q1, q2, q3, q4, q5, q6, q7, q8, q9, q10, q11, q12, q13, q14) (o0, o1, o2, o3, o4, o5, o6, o7, o8, o9, o10, o11, o12, o13, o14) Source # | |
Defined in Mischief.ECS.World.Query.Queryable Methods runQueryEntity :: (q0, q1, q2, q3, q4, q5, q6, q7, q8, q9, q10, q11, q12, q13, q14) -> World -> Entity -> IO (Maybe (o0, o1, o2, o3, o4, o5, o6, o7, o8, o9, o10, o11, o12, o13, o14)) Source # runQueryInternal :: (q0, q1, q2, q3, q4, q5, q6, q7, q8, q9, q10, q11, q12, q13, q14) -> [ArchetypeId] -> World -> IO [(Entity, Bool, (o0, o1, o2, o3, o4, o5, o6, o7, o8, o9, o10, o11, o12, o13, o14))] Source # queryTypes :: (q0, q1, q2, q3, q4, q5, q6, q7, q8, q9, q10, q11, q12, q13, q14) -> Set (TypeRep, TypeQuery) Source # | |
Constructors
| Before |
Instances
| Component Before Source # | |||||
Defined in Mischief.ECS.Relationships.Order Associated Types
| |||||
| type IsExclusiveRel Before Source # | |||||
Defined in Mischief.ECS.Relationships.Order | |||||
module Mischief.ECS.Repeater