Skip to content
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

[Merged by Bors] - Added example of entity sorting by components #1817

Closed
wants to merge 9 commits into from

Conversation

YohDeadfall
Copy link
Member

We discussed with @alice-i-cecile privately on iterators and agreed that making a custom ordered iterator over query makes no sense since materialization is required anyway and it's better to reuse existing components or code. Therefore, just adding an example to the documentation as requested.

Fixes #1470.

@YohDeadfall YohDeadfall closed this Apr 4, 2021
@YohDeadfall YohDeadfall deleted the sort-example branch April 4, 2021 15:35
@YohDeadfall YohDeadfall restored the sort-example branch April 4, 2021 15:35
@YohDeadfall YohDeadfall reopened this Apr 4, 2021
@YohDeadfall
Copy link
Member Author

Since there were large changes and the original code doesn't exist anymore, where should I put the example?

@alice-i-cecile alice-i-cecile added C-Docs An addition or correction to our documentation A-ECS Entities, components, systems, and events help wanted labels Apr 4, 2021
@alice-i-cecile
Copy link
Member

I would include this example as part of docs on QueryIter.

@cart
Copy link
Member

cart commented Apr 13, 2021

I think including a complicated sort in the query iter doc comments is a bit distracting. It forces users to mentally break down what the sort is doing, which feels pretty tangential to the goal of teaching them how to query for something. Imo using contains with a comment explaining why accomplishes the same goal with less headache.

@cart
Copy link
Member

cart commented Apr 13, 2021

Or alternatively simplify the sort by only sorting a single item, not using reverse, and using sort_by_key

Copy link
Member

@alice-i-cecile alice-i-cecile left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the for loop example a lot! That's very clear for beginners

@cart
Copy link
Member

cart commented Apr 19, 2021

bors r+

bors bot pushed a commit that referenced this pull request Apr 19, 2021
We discussed with @alice-i-cecile privately on iterators and agreed that making a custom ordered iterator over query makes no sense since materialization is required anyway and it's better to reuse existing components or code. Therefore, just adding an example to the documentation as requested.

Fixes #1470.

Co-authored-by: Carter Anderson <mcanders1@gmail.com>
@bors bors bot changed the title Added example of entity sorting by components [Merged by Bors] - Added example of entity sorting by components Apr 19, 2021
@bors bors bot closed this Apr 19, 2021
@YohDeadfall YohDeadfall deleted the sort-example branch April 20, 2021 05:14
ostwilkens pushed a commit to ostwilkens/bevy that referenced this pull request Jul 27, 2021
We discussed with @alice-i-cecile privately on iterators and agreed that making a custom ordered iterator over query makes no sense since materialization is required anyway and it's better to reuse existing components or code. Therefore, just adding an example to the documentation as requested.

Fixes bevyengine#1470.

Co-authored-by: Carter Anderson <mcanders1@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-ECS Entities, components, systems, and events C-Docs An addition or correction to our documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Ordered iteration over Queries
4 participants