Adding a progress-bar widget
Objective
- On our way to solve #5604 we need a lot of different widgets.
- This attempts to add a progress-bar widget
- Which can be used for loading indicators, health / mana-bars.
Solution
https://user-images.githubusercontent.com/13300393/200424470-89ad311c-fd54-482c-a984-5dab902c8929.mp4
- Same as #6236, the general design-approach here is "Widgets as lose collections of hierarchies of bundles".
- For the loading-bar widget to work, the user needs to create a
NodeBundlewith aProgressBarWidget-component attached, that has a childNodeBundlewith aProgressBarInner-component. - It is completely up to the user to make sure these requirements are met.
Changelog
Added
- Progress bar widget
Notes
- Please critique this general approach. I know how we can setup a lot of other widgets the same way, but I have not yet any clear answers for the bigger-picture problems such as "widget composition" and "widget styling".
- My gut feeling says it will be easier to tackle those problems once we have some real uses of various widgets in Bevy.
@bzm3r review plz!
widgets really feel like they belong in their own bevy_widgets crate?
We should also setup a new category of examples for widgets IMO. Should these two things happen in this PR, or somewhere else?
I think in this PR: it's already going to be controversial, so let's do this right from the start.
I'd like to see support for generics for min, max, progress values if that is reasonable. (Most of my use of progress bars are based on {u,i}N values)
This implementation should likely be coordinating with the proposed UI slider widget WRT internal representation of progress.
I'd like to see support for generics for min, max, progress values if that is reasonable. (Most of my use of progress bars are based on {u,i}N values)
I'm not too versed in generic rust yet, so I'm not entirely sure how that would look but if you'd provide a code snippet of what that would look like, I'm happy to include it :)