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

Apecs.TH

Synopsis

Documentation

makeWorld :: String -> [Name] -> Q [Dec] Source #

The typical way to create a world record, associated Has instances, and initialization function.

makeWorld "MyWorld" [''Component1, ''Component2, ...]

turns into

data MyWorld = MyWorld Component1 Component2 ... EntityCounter
instance MyWorld `Has` Component1 where ...
instance MyWorld `Has` Component2 where ...
...
instance MyWorld `Has` EntityCounter where ...

initMyWorld :: IO MyWorld
initMyWorld = MyWorld <$> initStore <*> initStore <*> ... <*> initStore

makeWorldNoEC :: String -> [Name] -> Q [Dec] Source #

Same as makeWorld, but does not include an EntityCounter You don't typically want to use this, but it's exposed in case you know what you're doing.

makeWorldAndComponents :: String -> [Name] -> Q [Dec] Source #

Calls makeWorld and makeMapComponents, i.e. makes a world and also defines Component instances with a Map store.

makeMapComponents :: [Name] -> Q [Dec] Source #

Creates Component instances with Map stores