bevy icon indicating copy to clipboard operation
bevy copied to clipboard

Adding a progress-bar widget

Open Weibye opened this issue 3 years ago • 5 comments

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 NodeBundle with a ProgressBarWidget-component attached, that has a child NodeBundle with a ProgressBarInner-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.

Weibye avatar Nov 07 '22 22:11 Weibye

@bzm3r review plz!

alice-i-cecile avatar Nov 07 '22 22:11 alice-i-cecile

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?

Weibye avatar Nov 08 '22 07:11 Weibye

I think in this PR: it's already going to be controversial, so let's do this right from the start.

alice-i-cecile avatar Nov 08 '22 13:11 alice-i-cecile

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.

AxiomaticSemantics avatar Nov 10 '22 22:11 AxiomaticSemantics

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 :)

Weibye avatar Nov 12 '22 08:11 Weibye