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

UI Style reuse: composition + assets #5516

Open
Weibye opened this issue Jul 31, 2022 · 4 comments
Open

UI Style reuse: composition + assets #5516

Weibye opened this issue Jul 31, 2022 · 4 comments
Labels
A-UI Graphical user interfaces, styles, layouts, and widgets C-Feature A new feature, making something new possible C-Usability A targeted quality-of-life change that makes Bevy easier to use X-Controversial There is active debate or serious implications around merging this PR

Comments

@Weibye
Copy link
Contributor

Weibye commented Jul 31, 2022

What problem does this solve or what need does it fill?

At the moment Style is incredibly verbose to use, just have a look at the UI example.
In order to improve ergonomics and reduce boilerplate when dealing with UI we need to do something about it and we should strive to achieve the level of UX that we see in other parts of the engine.

What solution would you like?

In order to do so we are going to need two related but IMO orthogonal features:

  1. Style composition: bevyengine/rfcs#1
  2. Style as assets

I don't know exactly what these would look like in implementation, but I'm hoping some of you have good ideas for design-approaches that we then split out into separate issues or PRs.

This issue should be about figuring out a scope and requirements for both of these features

What alternative(s) have you considered?

  • Leave style as is and keep verbose + cumbersome UX
  • Style inheritance
  • Others?

Additional context

We might find that we are blocked on other features like scenes or reflection on some of this but in that case it is good to know exactly where the blocker is so that we can push to unblock those 😄

@Weibye Weibye added C-Feature A new feature, making something new possible C-Usability A targeted quality-of-life change that makes Bevy easier to use labels Jul 31, 2022
@alice-i-cecile alice-i-cecile added A-UI Graphical user interfaces, styles, layouts, and widgets X-Controversial There is active debate or serious implications around merging this PR labels Jul 31, 2022
@alice-i-cecile
Copy link
Member

Style inheritance is going to be extremely controversial FYI. Personally, I'm hopeful for a compositional design, as laid out in bevyengine/rfcs#1

@Weibye Weibye changed the title UI Style reuse: Inheritance + assets UI Style reuse: composition + assets Aug 1, 2022
@Weibye
Copy link
Contributor Author

Weibye commented Aug 1, 2022

Style inheritance is going to be extremely controversial FYI. Personally, I'm hopeful for a compositional design, as laid out in bevyengine/rfcs#1

Good point, I've updated the issue to better reflect weighing the problem in this direction

@IceSentry
Copy link
Contributor

I think inheritance would be fine and not too controversial if it was opt in

@adsick
Copy link
Contributor

adsick commented Apr 6, 2023

Hello, I'm trying to experiment with reusable building blocks for UI, and while being relatively unfamiliar with Bevy I found this a little bit not clear: how to write reusable functions that allow for spawning bundles both as a standalone entity and as a child of another entity? Look at my code sample:
image
the only difference between these create_button functions is Commands and ChildBuilder types, everything else is the same, then I thought maybe there is an API that allow for using both Commands and ChildBuilder? Maybe it may improve Bevy? @alice-i-cecile what do you think?

the code that uses these functions is not particularly interesting, but I believe that we can do much better than this if we think a little bit of how to improve that API
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-UI Graphical user interfaces, styles, layouts, and widgets C-Feature A new feature, making something new possible C-Usability A targeted quality-of-life change that makes Bevy easier to use X-Controversial There is active debate or serious implications around merging this PR
Projects
None yet
Development

No branches or pull requests

4 participants