apecs-0.9.3: Fast Entity-Component-System library for game programming
Safe HaskellNone
LanguageHaskell2010

Apecs.System

Synopsis

Documentation

runSystem :: SystemT w m a -> w -> m a Source #

Run a system in a game world

runWith :: w -> SystemT w m a -> m a Source #

Run a system in a game world

get :: forall w m c. Get w m c => Entity -> SystemT w m c Source #

Read a Component

set :: forall w m c. Set w m c => Entity -> c -> SystemT w m () Source #

Writes a Component to a given Entity. Will overwrite existing Components.

($=) :: forall w m c. Set w m c => Entity -> c -> SystemT w m () infixr 2 Source #

set operator

Writes a Component to a given Entity. Will overwrite existing Components.

exists :: forall w m c. Get w m c => Entity -> Proxy c -> SystemT w m Bool Source #

Returns whether the given entity has component c

destroy :: forall w m c. Destroy w m c => Entity -> Proxy c -> SystemT w m () Source #

Destroys component c for the given entity.

modify :: forall w m cx cy. (Get w m cx, Set w m cy) => Entity -> (cx -> cy) -> SystemT w m () Source #

Applies a function, if possible.

($~) :: forall w m cx cy. (Get w m cx, Set w m cy) => Entity -> (cx -> cy) -> SystemT w m () infixr 2 Source #

modify operator

Applies a function, if possible.

cmap :: forall w m cx cy. (Get w m cx, Members w m cx, Set w m cy) => (cx -> cy) -> SystemT w m () Source #

Maps a function over all entities with a cx, and writes their cy.

cmapIf :: forall w m cp cx cy. (Get w m cx, Get w m cp, Members w m cx, Set w m cy) => (cp -> Bool) -> (cx -> cy) -> SystemT w m () Source #

Conditional cmap, that first tests whether the argument satisfies some property. The entity needs to have both a cx and cp component.

cmapM :: forall w m cx cy. (Get w m cx, Set w m cy, Members w m cx) => (cx -> SystemT w m cy) -> SystemT w m () Source #

Monadically iterates over all entites with a cx, and writes their cy.

cmapM_ :: forall w m c. (Get w m c, Members w m c) => (c -> SystemT w m ()) -> SystemT w m () Source #

Monadically iterates over all entites with a cx

cfold :: forall w m c a. (Members w m c, Get w m c) => (a -> c -> a) -> a -> SystemT w m a Source #

Fold over the game world; for example, cfold max (minBound :: Foo) will find the maximum value of Foo. Strict in the accumulator.

cfoldM :: forall w m c a. (Members w m c, Get w m c) => (a -> c -> SystemT w m a) -> a -> SystemT w m a Source #

Monadically fold over the game world. Strict in the accumulator.

cfoldM_ :: forall w m c a. (Members w m c, Get w m c) => (a -> c -> SystemT w m a) -> a -> SystemT w m () Source #

Monadically fold over the game world. Strict in the accumulator.