-
-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make World
interface more convenient.
#57
Comments
What are your thoughts on having an alternative let entity_id = world.spawn();
world.insert(entity_id, ComponentA);
world.insert(entity_id, ComponentB); could potentially be cleaner if written like let entity_id = world.spawn_entity((ComponentA, ComponentB)); I'm not set on the |
That seems reasonable. We could just change I don't think it would immediately help with #5 though since we want it to be semantically equivalent to inserting the components individually. We still need command batching to make that efficient. |
ok cool. I think bevy by default (I might be very wrong) lets one spawn an entity with multiple components in one call so I am for a new |
Hey @rj00a have you been working on this? I'm very interested in the new |
World::get
should take aQ: ReadOnlyQuery
instead of aComponent
.World::get_mut
should take aQ: Query
instead of aComponent
.(&mut A, &mut A)
is a valid query. Checking for self-aliasing is somewhat expensive, and we wouldn't want to pay for that on every call. We could store aHashSet<TypeId>
in theWorld
to cache queries that are known not to self-alias. We can also optimize this for simple queries like&mut C
to skip going to the cache.single
andsingle_mut
methods for accessing singletons.World::iter
method for iterating over aQ: ReadOnlyQuery
.World::iter_mut
method for iterating over aQ: Query
. It will need to use the same self-alias checking as above.The
iter
methods should not construct a cached query on every invocation.The text was updated successfully, but these errors were encountered: