summaryrefslogtreecommitdiff
path: root/engine-ecs/src/entity.rs
diff options
context:
space:
mode:
Diffstat (limited to 'engine-ecs/src/entity.rs')
-rw-r--r--engine-ecs/src/entity.rs22
1 files changed, 9 insertions, 13 deletions
diff --git a/engine-ecs/src/entity.rs b/engine-ecs/src/entity.rs
index 9ef9da0..b9829e1 100644
--- a/engine-ecs/src/entity.rs
+++ b/engine-ecs/src/entity.rs
@@ -3,16 +3,12 @@ use std::borrow::Cow;
use std::ops::Deref;
use std::sync::LazyLock;
-use crate::Component;
use crate::component::storage::archetype::{
Archetype,
Entity as ArchetypeEntity,
MatchingComponentIter as ArchetypeMatchingComponentIter,
};
-use crate::component::{
- Handle as ComponentHandle,
- HandleMut as ComponentHandleMut,
-};
+use crate::component::{Handle as ComponentHandle, HandleMut as ComponentHandleMut};
use crate::pair::{
ComponentOrWildcard,
MultipleWithWildcard as PairMultipleWithWildcard,
@@ -20,7 +16,7 @@ use crate::pair::{
WithWildcard as PairWithWildcard,
};
use crate::uid::Uid;
-use crate::{EntityComponentRef, World};
+use crate::{Component, EntityComponentRef, World};
pub mod obtainer;
@@ -288,22 +284,22 @@ impl<'a> Iterator for MatchingComponentIter<'a>
pub struct Declaration
{
uid: LazyLock<Uid>,
- create_func: fn(&mut World),
+ spawn_func: fn(&mut World),
}
impl Declaration
{
- pub(crate) fn create(&self, world: &mut World)
+ pub(crate) fn spawn(&self, world: &mut World)
{
- (self.create_func)(world);
+ (self.spawn_func)(world);
}
#[doc(hidden)]
- pub const fn new(create_func: fn(&mut World)) -> Self
+ pub const fn new(spawn_func: fn(&mut World)) -> Self
{
Self {
uid: LazyLock::new(|| Uid::new_unique()),
- create_func,
+ spawn_func,
}
}
}
@@ -324,7 +320,7 @@ macro_rules! declare_entity {
($visibility: vis $ident: ident, $components: expr) => {
$visibility static $ident: $crate::entity::Declaration =
$crate::entity::Declaration::new(|world| {
- world.create_entity_with_uid(*$ident, $components);
+ world.spawn_with_uid(*$ident, $components);
});
}
}
@@ -333,5 +329,5 @@ macro_rules! declare_entity {
#[derive(Debug, Clone, Component)]
pub struct Name
{
- pub name: Cow<'static, str>
+ pub name: Cow<'static, str>,
}