JMS55 / bevy_dioxus

Apache License 2.0
56 stars 8 forks source link

Static UI as assets #10

Open JMS55 opened 8 months ago

JMS55 commented 8 months ago

Composing UI, especially reactive UI, as code is good. But for some types of games, it would be nice to generate static UI visually in the editor.

Open questions:

  1. How do we map hand-written rsx syntax in an asset file -> dioxus UI element/templates at runtime?
  2. Can we support defining the template by hand, and then passing in code-defined props and ECS-data-via-hooks to make the parts of the UI dynamic?
  3. Do we need to hookup a VirtualDom to for asset-based UIs (assuming we don't hydrate the static asset with dynamic parts)? It might suffice to simply spawn the appropriate entities once, and skip setting up mutations.
JMS55 commented 8 months ago

We can parse rust-code-as-a-string into rsx with syn::parse_str::\<T>(), where T: BodyNode.