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

Display design requires bevy_ui components to implement Reflect #1

Open
wendivoid opened this issue Dec 19, 2021 · 0 comments
Open
Labels

Comments

@wendivoid
Copy link
Owner

The displays make it easy to customize the Heads up display elements using bevy scenes. This is stalled waiting on the ability to use the Ui Text component in scenes. This PR bevyengine/bevy#1395 gives some insight

I'm aware of two components that have containers in bevy:

  • Children: it works because Entity uses reflect_value, there are no dynamic types
  • Text: currently cannot be correctly reflected because of the sections field. Trying to deserialize any UI with text triggers the panic.

TL;DR: it's currently impossible to have containers of complex types in a scene

The finished System should use marker components that should be placed alongside a Text component, it specifies the index of the TextSection to update with the related Text represented by the component.

Currently i have somewhat hacked this behavior in using a TextField component That adds the ui::FocusPolicy & ui::CalculatedSize components. Then the text marker components add a Text component with the appropriate text.

pub struct FPSTextSection(pub usize);

Potential text elements to consider

  • Frames per second
  • Ammunition count
  • Used ammunition
  • Health Percentage
  • Active Weapon Name
  • Current Kill Count
  • Current Death Count
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant