apecs-0.3.0.2: A fast ECS for game engine 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. Has w c => Entity -> System w c Source #

set :: forall w c. Has 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. Has w c => Entity -> 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 world cx cy. (Has world cx, Has world cy) => (cx -> cy) -> System world () Source #

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

cmapM :: forall world c a. Has world c => (c -> System world a) -> System world [a] Source #

Monadically iterates over all entites with a cx

cmapM_ :: forall world c a. Has world c => (c -> System world a) -> System world () Source #

Monadically iterates over all entites with a cx

getAll :: forall world c. Has world c => System world [c] Source #

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

destroy :: forall w c. Has w c => Entity -> 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. Has w c => Entity -> (c -> c) -> System w () Source #

Applies a function, if possible.

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

Counts the number of entities with a c