Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- data Map c
- data Cache (n :: Nat) s
- data Unique c
- data Global c
- class Cachable s
- data ReadOnly s
- setReadOnly :: forall w m s c. (Has w m c, Storage c ~ ReadOnly s, Elem s ~ c, ExplSet m s) => Entity -> c -> SystemT w m ()
- destroyReadOnly :: forall w m s c. (Has w m c, Storage c ~ ReadOnly s, Elem s ~ c, ExplDestroy m s) => Entity -> Proxy c -> SystemT w m ()
Documentation
A map based on Strict
. O(log(n)) for most operations.
Instances
MonadIO m => ExplDestroy m (Map c) Source # | |
Defined in Apecs.Stores explDestroy :: Map c -> Int -> m () Source # | |
(MonadIO m, Typeable c) => ExplGet m (Map c) Source # | |
MonadIO m => ExplInit m (Map c) Source # | |
Defined in Apecs.Stores | |
MonadIO m => ExplMembers m (Map c) Source # | |
Defined in Apecs.Stores | |
MonadIO m => ExplSet m (Map c) Source # | |
Cachable (Map s) Source # | |
Defined in Apecs.Stores | |
type Elem (Map c) Source # | |
Defined in Apecs.Stores |
data Cache (n :: Nat) s Source #
A cache around another store. Caches store their members in a fixed-size vector, so read/write operations become O(1). Caches can provide huge performance boosts, especially when working with large numbers of components.
The cache size is given as a type-level argument.
Note that iterating over a cache is linear in cache size, so sparsely populated caches might decrease performance. In general, the exact size of the cache does not matter as long as it reasonably approximates the number of components present.
The cache uses entity (-2) internally to represent missing entities. If you manually manipulate Entity values, be careful that you do not use (-2)
The actual cache is not necessarily the given argument, but the next biggest power of two. This is allows most operations to be expressed as bit masks, for a large potential performance boost.
Instances
(MonadIO m, ExplDestroy m s) => ExplDestroy m (Cache n s) Source # | |
Defined in Apecs.Stores explDestroy :: Cache n s -> Int -> m () Source # | |
(MonadIO m, ExplGet m s) => ExplGet m (Cache n s) Source # | |
(MonadIO m, ExplInit m s, KnownNat n, Cachable s) => ExplInit m (Cache n s) Source # | |
Defined in Apecs.Stores | |
(MonadIO m, ExplMembers m s) => ExplMembers m (Cache n s) Source # | |
Defined in Apecs.Stores | |
(MonadIO m, ExplSet m s) => ExplSet m (Cache n s) Source # | |
(KnownNat n, Cachable s) => Cachable (Cache n s) Source # | |
Defined in Apecs.Stores | |
type Elem (Cache n s) Source # | |
Defined in Apecs.Stores |
A Unique contains zero or one component.
Writing to it overwrites both the previous component and its owner.
Its main purpose is to be a Map
optimized for when only ever one component inhabits it.
Instances
MonadIO m => ExplDestroy m (Unique c) Source # | |
Defined in Apecs.Stores explDestroy :: Unique c -> Int -> m () Source # | |
(MonadIO m, Typeable c) => ExplGet m (Unique c) Source # | |
MonadIO m => ExplInit m (Unique c) Source # | |
Defined in Apecs.Stores | |
MonadIO m => ExplMembers m (Unique c) Source # | |
Defined in Apecs.Stores | |
MonadIO m => ExplSet m (Unique c) Source # | |
type Elem (Unique c) Source # | |
Defined in Apecs.Stores |
A Global
contains exactly one component.
The initial value is mempty
from the component's Monoid
instance.
Querying a Global
at any Entity yields this one component, effectively sharing the component between all entities.
A Global component can be read with
or get
0
or even get
1
.
The convenience entity get
undefinedglobal
is defined as -1, and can be used to make operations on a global more explicit, i.e. 'Time t <- get global'.
You also can read and write Globals during a cmap
over other components.
Wrapper that makes a store read-only by hiding its ExplSet
and ExplDestroy
instances.
This is primarily used to protect the EntityCounter
from accidental overwrites.
Use setReadOnly
and destroyReadOnly
to override.
Instances
ExplGet m s => ExplGet m (ReadOnly s) Source # | |
(Functor m, ExplInit m s) => ExplInit m (ReadOnly s) Source # | |
Defined in Apecs.Stores | |
ExplMembers m s => ExplMembers m (ReadOnly s) Source # | |
Defined in Apecs.Stores | |
type Elem (ReadOnly s) Source # | |
Defined in Apecs.Stores |