-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
[rustweek] inventory example #19251
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
[rustweek] inventory example #19251
Conversation
| let Ok(mut background_color) = buttons.get_mut(trigger.target()) else { | ||
| return; | ||
| }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit/food for thoughts: We may consider returning a Result ? using ? would help reducing noise. but I'm not a fan of the default behaviour of panicking if a result is panicking.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- @extrawurst had the same kind of boilerplate for Adding context menu example #19245 ; some coordination on implementation may be fruitful.
|
This was deemed "not useful enough" to add to the examples. Will re-open with a different PR. |
| name = "Inventory" | ||
| description = "Display a Player's Inventory in a grid" | ||
| category = "Usage" | ||
| wasm = false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just tested with the Bevy CLI, it works on the web!
bevy run --example=inventory web --open
| wasm = false | |
| wasm = true |
|
I think this example is useful and we should have it. It would be nice to extend it with more functionality in a future PR. |
BenjaminBrienen
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
some CI stuff is todo
|
There is also #20718. |
|
I haven't received any indication that this PR is desired as an example, and have received indication that a fuller "baldur's gate" style inventory would be preferred over this. So I am again re-closing this and will leave it to whatever #20718 or future work can get merged. |
Objective
Add an example displaying a Player's Inventory in a Grid.
I chose to not handle advanced inventory behavior like user-reordering, splitting stacks, etc. Instead leaving that to a different example.
Testing
Showcase
screenshot-2025-05-17-at-02.53.22.mp4