summaryrefslogtreecommitdiff
path: root/ecs/src/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'ecs/src/lib.rs')
-rw-r--r--ecs/src/lib.rs26
1 files changed, 26 insertions, 0 deletions
diff --git a/ecs/src/lib.rs b/ecs/src/lib.rs
index 339a314..fc97d42 100644
--- a/ecs/src/lib.rs
+++ b/ecs/src/lib.rs
@@ -26,6 +26,7 @@ use crate::type_name::TypeName;
pub mod actions;
pub mod component;
pub mod event;
+pub mod flags;
pub mod lock;
pub mod system;
pub mod tuple;
@@ -166,6 +167,16 @@ impl World
}
self.perform_queued_actions();
+
+ let flags = self
+ .data
+ .flags
+ .read_nonblock()
+ .expect("Failed to aquire lock to flags");
+
+ if flags.stop {
+ break;
+ }
}
}
@@ -187,11 +198,26 @@ impl World
}
#[derive(Debug, Default)]
+struct WorldFlags
+{
+ stop: bool,
+}
+
+impl TypeName for WorldFlags
+{
+ fn type_name(&self) -> &'static str
+ {
+ type_name::<Self>()
+ }
+}
+
+#[derive(Debug, Default)]
pub struct WorldData
{
events: HashMap<EventId, Vec<usize>>,
component_storage: Arc<Lock<ComponentStorage>>,
action_queue: Lock<ActionQueue>,
+ flags: Lock<WorldFlags>,
}
#[derive(Debug, Default)]