apecs-0.4.1.1: Fast ECS framework for game programming

Safe HaskellNone
LanguageHaskell2010

Apecs.System

Synopsis

Documentation

runSystem :: System w a -> w -> IO a Source #

Run a system with a game world

runWith :: w -> System w a -> IO a Source #

Run a system with a game world

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

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

Writes a component to a given entity. Will overwrite existing components. The type was originally 'Entity c -> c -> System w ()', but is relaxed to 'Entity e' so you don't always have to write 'set . cast'

exists :: forall w c. Get w c => Entity -> Proxy c -> System w 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 cx cy. (Get w cx, Members w cx, Set w cy) => (cx -> cy) -> System w () Source #

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

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

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

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

Monadically iterates over all entites with a cx

cfold :: forall w c a. (Members w c, Get w c) => (a -> c -> a) -> a -> System w 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 c a. (Members w c, Get w c) => (a -> c -> System w a) -> a -> System w a Source #

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

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

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

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

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

destroy :: forall w c. Destroy w c => Entity -> Proxy c -> System w () 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 c. (Get w c, Set w c) => Entity -> (c -> c) -> System w () Source #

Applies a function, if possible.

count :: forall w c. Members w c => c -> System w Int Source #

Counts the number of entities with a c