diff options
author | HampusM <hampus@hampusmat.com> | 2024-11-11 00:11:22 +0100 |
---|---|---|
committer | HampusM <hampus@hampusmat.com> | 2024-11-11 00:11:22 +0100 |
commit | daf0bc236df25c0e9f44bc3e30839c16cda3f638 (patch) | |
tree | 7475e4e58686dd34366e641ec32f5a9374d66533 /ecs/src/event/component.rs | |
parent | 17f63d9859e1c82a30c07bf110cf2b9872e2427e (diff) |
refactor(ecs): use same ID for entities & components
Diffstat (limited to 'ecs/src/event/component.rs')
-rw-r--r-- | ecs/src/event/component.rs | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/ecs/src/event/component.rs b/ecs/src/event/component.rs index 40cd20d..8b066a7 100644 --- a/ecs/src/event/component.rs +++ b/ecs/src/event/component.rs @@ -5,7 +5,8 @@ use std::marker::PhantomData; use ecs_macros::Component; -use crate::component::{Component, Id as ComponentId}; +use crate::component::Component; +use crate::uid::Uid; use crate::event::{Event, Id}; use crate::tuple::{ReduceElement as TupleReduceElement, With as TupleWith}; @@ -50,7 +51,7 @@ where where Self: Sized, { - Id::new::<Added<ComponentForId>, _>(Some(ComponentId::of::<ComponentT>())) + Id::new::<Added<ComponentForId>, _>(Some(ComponentT::id())) } } @@ -93,18 +94,18 @@ where where Self: Sized, { - Id::new::<Removed<ComponentForId>, _>(Some(ComponentId::of::<ComponentT>())) + Id::new::<Removed<ComponentForId>, _>(Some(ComponentT::id())) } } #[must_use] -pub fn create_added_id(component_id: ComponentId) -> Id +pub fn create_added_id(component_id: Uid) -> Id { Id::new::<Added<ComponentForId>, _>(Some(component_id)) } #[must_use] -pub fn create_removed_id(component_id: ComponentId) -> Id +pub fn create_removed_id(component_id: Uid) -> Id { Id::new::<Removed<ComponentForId>, _>(Some(component_id)) } |