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

Remove dependency on bevy_window from bevy_text #8820

Open
alice-i-cecile opened this issue Jun 11, 2023 · 1 comment
Open

Remove dependency on bevy_window from bevy_text #8820

alice-i-cecile opened this issue Jun 11, 2023 · 1 comment
Labels
A-UI Graphical user interfaces, styles, layouts, and widgets C-Performance A change motivated by improving speed, memory usage or compile times 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

@alice-i-cecile
Copy link
Member

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

This dependency is very tenuous: it only exists due to the reliance of Text2D on the window's scale factor.
It creates two small problems however:

  1. It lengthens compile times by forcing these to be run in sequence.
  2. It won't work well in a headless environment, or with an alternative windowing backend.

Options

  1. Remove Text2D completely, by eliminating special-casing of world-space UI (World-space UI #5476).
  2. Put all of Text2D behind an on-by-default feature flag.
  3. Only put the "try and get the window's scale factor" code behind said feature flag.
  4. Somehow communicate that information to bevy_text without a dependency.

Ultimately my preference is for 1: if we can manage that it will be a huge simplification.

3 seems strictly better than 2. 4 would be interesting, but I genuinely don't see how to do it unless we create a resource upstream of both crates that they can each read/write to.

Additional context

This is a write-up of a request by AbleHeathen on Discord.

@alice-i-cecile alice-i-cecile added C-Performance A change motivated by improving speed, memory usage or compile times A-UI Graphical user interfaces, styles, layouts, and widgets C-Usability A targeted quality-of-life change that makes Bevy easier to use labels Jun 11, 2023
@tim-blackbird
Copy link
Contributor

It's important to note that bevy_window is also an indirect dependency of bevy_text through bevy_render.

@alice-i-cecile alice-i-cecile added the X-Controversial There is active debate or serious implications around merging this PR label Jun 11, 2023
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-Performance A change motivated by improving speed, memory usage or compile times 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

2 participants