summaryrefslogtreecommitdiff
path: root/ecs
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2024-12-16 14:37:27 +0100
committerHampusM <hampus@hampusmat.com>2024-12-16 15:01:36 +0100
commitf19ccb4fe2efd948b3e2276679c7dc11afb0142e (patch)
treea73fcc241039f92e099d9da145f548f7fd054556 /ecs
parent0f09a8a52d72c2e91166f54136846ea3907bb776 (diff)
fix(ecs): make World::default fn behave same as World::new fn
Diffstat (limited to 'ecs')
-rw-r--r--ecs/src/lib.rs16
1 files changed, 14 insertions, 2 deletions
diff --git a/ecs/src/lib.rs b/ecs/src/lib.rs
index 334fe69..3926344 100644
--- a/ecs/src/lib.rs
+++ b/ecs/src/lib.rs
@@ -55,7 +55,7 @@ pub use ecs_macros::{Component, Sole};
pub use crate::query::Query;
-#[derive(Debug, Default)]
+#[derive(Debug)]
pub struct World
{
data: WorldData,
@@ -68,7 +68,11 @@ impl World
#[must_use]
pub fn new() -> Self
{
- let mut world = Self::default();
+ let mut world = Self {
+ data: WorldData::default(),
+ stop: AtomicBool::new(false),
+ is_first_tick: AtomicBool::new(false),
+ };
world.add_sole(Stats::default()).ok();
@@ -469,6 +473,14 @@ impl World
}
}
+impl Default for World
+{
+ fn default() -> Self
+ {
+ Self::new()
+ }
+}
+
/// The result of calling [`World::step`].
pub enum StepResult
{