Crates.io | specs-hierarchy |
lib.rs | specs-hierarchy |
version | 0.6.0 |
source | src |
created_at | 2018-04-23 07:44:56.467756 |
updated_at | 2020-02-12 23:19:58.447112 |
description | Scene graph type hierarchy abstraction for use with specs |
homepage | https://github.com/rustgd/specs-hierarchy.git |
repository | https://github.com/rustgd/specs-hierarchy.git |
max_upload_size | |
id | 61906 |
size | 63,594 |
specs-hierarchy
Scene graph type hierarchy abstraction for use with specs
.
Builds up a Hierarchy
resource, by querying a user supplied Parent
component.
Requires the component to be Tracked
.
Will send modification events on an internal EventChannel
. Note that Removed
events
does not mean the Parent
component was removed from the component storage, just that the
Entity
will no longer be considered to be a part of the Hierarchy
. This is because the user
may wish to either remove only the component, the complete Entity
, or something completely
different. When an Entity
that is a parent gets removed from the hierarchy, the full tree of
children below it will also be removed from the hierarchy.
# Cargo.toml
[dependencies]
specs-hierarchy = "0.5.1"
use specs::prelude::{Component, DenseVecStorage, Entity, FlaggedStorage};
use specs_hierarchy::{Hierarchy, Parent as HParent};
/// Component for defining a parent entity.
///
/// The entity with this component *has* a parent, rather than *is* a parent.
#[derive(Debug, Clone, Eq, Ord, PartialEq, PartialOrd)]
pub struct Parent {
/// The parent entity
pub entity: Entity,
}
impl Component for Parent {
type Storage = FlaggedStorage<Self, DenseVecStorage<Self>>;
}
impl HParent for Parent {
fn parent_entity(&self) -> Entity {
self.entity
}
}
Licensed under either of
at your option.
We are a community project that welcomes contribution from anyone. If you're interested in helping out, you can contact
us either through GitHub, or via gitter
.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.