feather icon indicating copy to clipboard operation
feather copied to clipboard

DynamicBundler, quill spawn entity shorthand

Open Defman opened this issue 4 years ago • 0 comments

A spawn function which is similar to hecs::World::spawn

trait DynamicBundle {
  fn add_to_builder(self, builder: &mut EntityBuilder);
}

// Should be a macro
impl<T1> DynamicBundle for (T1,) where T1: Component {}
impl<T1, T2> DynamicBundle for (T1, T2) where T1: Component, T2: Component {}

struct ECS {
  fn spawn(bundle: impl DynamicBundle) -> Entity;
  fn insert_event_with_components(event: impl Component, bundle: impl DynamicBundle) -> Entity;
}

Defman avatar Mar 04 '21 10:03 Defman