apecs-0.5.0.0: Fast ECS framework for game programming

Apecs.System

Synopsis

# Documentation

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

Run a system with a game world

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

Run a system with a game world

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

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. The type was originally 'Entity c -> c -> SystemT w m ()', but is relaxed to 'Entity e' so you don't always have to write 'set . cast'

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 Note that c is a phantom argument, used only to convey the type of the entity to be queried.

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.

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 a. (Get w m c, Members w m c) => (c -> SystemT w m a) -> 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.

getAll :: forall w m c. (Get w m c, Members w m c) => SystemT w m [c] Source #

Get all components c. Call as [(c,Entity)] to also read the entity index.

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

Destroys component c for the given entity. Note that c is a phantom argument, used only to convey the type of the entity to be destroyed.

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

Applies a function, if possible.

count :: forall w m c. Members w m c => Proxy c -> SystemT w m Int Source #

Counts the number of entities with a c