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

Add tag to conveniently insert marker components #4

Merged
merged 5 commits into from
Jul 22, 2024

Conversation

TimJentzsch
Copy link
Owner

@TimJentzsch TimJentzsch commented Jul 22, 2024

Objective

Closes #3.

Sometimes, we need parts of the text to be updated dynamically, for example every frame.

We can just adjust the BBCode every frame to accomplish this, e.g. using the format! macro, but then we need to parse the BBCode every frame and reconstruct the UI hierarchy.
Needless to say, this doesn't scale very well.

Instead, we want to insert marker components to efficiently query for the Text components we need to change.

Solution

  • Add a new [m=foo] tag and BbcodeSettings.with_marker("foo", Foo) syntax, allowing the user to insert marker components on Text entities.
  • The marker components can then be used to efficiently update the Text (or style) in queries, as usual.
  • Additionally, constructing BbcodeSettings now uses a builder pattern, which will scale better in the future. (breaking change)

@TimJentzsch TimJentzsch merged commit f05e5a0 into main Jul 22, 2024
4 checks passed
@TimJentzsch TimJentzsch deleted the 3-marker-components branch July 22, 2024 17:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support marker components
1 participant