summaryrefslogtreecommitdiff
path: root/ecs/src/lib.rs
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2024-06-08 20:47:35 +0200
committerHampusM <hampus@hampusmat.com>2024-06-15 16:32:24 +0200
commit69d90ece7f54996f0f51fc120a38d37717c5248e (patch)
treefe2de83e81648762778c1a77041293526c3db9d0 /ecs/src/lib.rs
parentbef61b765de52d14a52c3df86f8b3766846be272 (diff)
perf(ecs): store components using archetypes
Diffstat (limited to 'ecs/src/lib.rs')
-rw-r--r--ecs/src/lib.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/ecs/src/lib.rs b/ecs/src/lib.rs
index 1983f66..0dd1c02 100644
--- a/ecs/src/lib.rs
+++ b/ecs/src/lib.rs
@@ -83,6 +83,8 @@ impl World
) where
EventT: Event,
{
+ system.prepare(&self.data);
+
self.systems.push(system.into_type_erased());
self.data
@@ -159,6 +161,12 @@ impl World
/// Will panic if a internal lock cannot be acquired.
pub fn event_loop<EventSeq: EventSequence>(&self)
{
+ self.data
+ .component_storage
+ .write_nonblock()
+ .expect("Failed to acquire read-write component storage lock")
+ .make_archetype_lookup_entries();
+
let event_seq = EventSeq::ids();
loop {