summaryrefslogtreecommitdiff
path: root/ecs/src
diff options
context:
space:
mode:
Diffstat (limited to 'ecs/src')
-rw-r--r--ecs/src/lib.rs18
1 files changed, 13 insertions, 5 deletions
diff --git a/ecs/src/lib.rs b/ecs/src/lib.rs
index 95519c9..741b555 100644
--- a/ecs/src/lib.rs
+++ b/ecs/src/lib.rs
@@ -176,17 +176,25 @@ impl World
}
}
- /// A event loop which runs until a stop is issued with [`Flags::stop`].
- ///
- /// # Panics
- /// Will panic if a internal lock cannot be acquired.
- pub fn event_loop<EventSeq: EventSequence>(&self)
+ /// Prepares the world. Should be called before manually emitting events and after
+ /// creating entities, registering systems & adding extensions. You do not need to
+ /// call this function if you use [`event_loop`].
+ pub fn prepare(&self)
{
self.data
.component_storage
.write_nonblock()
.expect("Failed to acquire read-write component storage lock")
.make_archetype_lookup_entries();
+ }
+
+ /// A event loop which runs until a stop is issued with [`Flags::stop`].
+ ///
+ /// # Panics
+ /// Will panic if a internal lock cannot be acquired.
+ pub fn event_loop<EventSeq: EventSequence>(&self)
+ {
+ self.prepare();
let event_seq = EventSeq::ids();