Trait amethyst::ecs::prelude::Component [−]
pub trait Component: Any {
type Storage: UnprotectedStorage<Self> + Send + Sync + Any;
}Abstract component type. Doesn't have to be Copy or even Clone.
Storages
Components are stored in separated collections for maximum
cache efficiency. The Storage associated type allows
to specify which collection should be used.
Depending on how many entities have this component and how
often it is accessed, you will want different storages.
The most common ones are VecStorage (use if almost every entity has that component),
DenseVecStorage (if you expect many entities to have the component) and
HashMapStorage (for very rare components).
Examples
use specs::prelude::*; pub struct Position { pub x: f32, pub y: f32, } impl Component for Position { type Storage = VecStorage<Self>; }
use specs::prelude::*; pub enum Light { // (Variants would have additional data) Directional, SpotLight, } impl Component for Light { type Storage = DenseVecStorage<Self>; }
use specs::prelude::*; use specs::storage::HashMapStorage; pub struct Camera { // In an ECS, the camera would not itself have a position; // you would just attach a `Position` component to the same // entity. matrix: [f32; 16], } impl Component for Camera { type Storage = HashMapStorage<Self>; }
Associated Types
type Storage: UnprotectedStorage<Self> + Send + Sync + Any
Associated storage type for this component.
Implementations on Foreign Types
impl<T> Component for SamplerControlSet<T> where
T: AnimationSampling, [src]
impl<T> Component for SamplerControlSet<T> where
T: AnimationSampling, type Storage = DenseVecStorage<SamplerControlSet<T>>
impl<T> Component for AnimationControl<T> where
T: AnimationSampling, [src]
impl<T> Component for AnimationControl<T> where
T: AnimationSampling, type Storage = DenseVecStorage<AnimationControl<T>>
impl<I, T> Component for AnimationSet<I, T> where
I: Eq + Hash + Send + Sync + 'static,
T: AnimationSampling, [src]
impl<I, T> Component for AnimationSet<I, T> where
I: Eq + Hash + Send + Sync + 'static,
T: AnimationSampling, type Storage = DenseVecStorage<AnimationSet<I, T>>
impl<T> Component for AnimationHierarchy<T> where
T: AnimationSampling, [src]
impl<T> Component for AnimationHierarchy<T> where
T: AnimationSampling, type Storage = DenseVecStorage<AnimationHierarchy<T>>
impl Component for Joint[src]
impl Component for Jointtype Storage = DenseVecStorage<Joint>
impl Component for Skin[src]
impl Component for Skintype Storage = DenseVecStorage<Skin>
impl<I, T> Component for AnimationControlSet<I, T> where
I: Send + Sync + 'static,
T: AnimationSampling, [src]
impl<I, T> Component for AnimationControlSet<I, T> where
I: Send + Sync + 'static,
T: AnimationSampling, type Storage = DenseVecStorage<AnimationControlSet<I, T>>
impl<A> Component for Handle<A> where
A: Asset, [src]
impl<A> Component for Handle<A> where
A: Asset, type Storage = <A as Asset>::HandleStorage
impl Component for Parent[src]
impl Component for Parenttype Storage = FlaggedStorage<Parent, DenseVecStorage<Parent>>
impl Component for Transform[src]
impl Component for Transformtype Storage = FlaggedStorage<Transform, DenseVecStorage<Transform>>
impl Component for GlobalTransform[src]
impl Component for GlobalTransformimpl Component for JointTransforms[src]
impl Component for JointTransformsimpl Component for Material[src]
impl Component for Materialtype Storage = DenseVecStorage<Material>
impl Component for Camera[src]
impl Component for Cameratype Storage = HashMapStorage<Camera>
impl Component for Transparent[src]
impl Component for Transparenttype Storage = NullStorage<Transparent>
impl Component for Light[src]
impl Component for Lighttype Storage = DenseVecStorage<Light>
impl Component for AudioListener[src]
impl Component for AudioListenertype Storage = HashMapStorage<AudioListener>
impl Component for AudioEmitter[src]
impl Component for AudioEmittertype Storage = BTreeStorage<AudioEmitter>
impl Component for FlyControlTag[src]
impl Component for FlyControlTagtype Storage = NullStorage<FlyControlTag>
impl Component for ArcBallControlTag[src]
impl Component for ArcBallControlTagtype Storage = HashMapStorage<ArcBallControlTag>
impl Component for UiImage[src]
impl Component for UiImagetype Storage = VecStorage<UiImage>
impl Component for UiTransform[src]
impl Component for UiTransformimpl Component for UiText[src]
impl Component for UiTexttype Storage = DenseVecStorage<UiText>
impl Component for TextEditing[src]
impl Component for TextEditingtype Storage = DenseVecStorage<TextEditing>
impl Component for UiResize[src]
impl Component for UiResizetype Storage = DenseVecStorage<UiResize>
impl Component for Anchored[src]
impl Component for Anchoredtype Storage = VecStorage<Anchored>
impl Component for MouseReactive[src]
impl Component for MouseReactivetype Storage = NullStorage<MouseReactive>
impl Component for Stretched[src]
impl Component for Stretchedtype Storage = FlaggedStorage<Stretched, VecStorage<Stretched>>
Implementors
impl Component for World type Storage = DenseVecStorage<World>;