3 ms·
If you don't need JavaScript, then you might be interested in https://github.com/DioxusLabs/blitz https://github.com/DioxusLabs/blitz. It pulls in Servo/Firefo
by nicoburns 1y ago
If you don't need JavaScript, then you might be interested in https://github.com/DioxusLabs/blitz https://github.com/DioxusLabs/blitz.
It pulls in Servo/Firefox's CSS engine Stylo (and Servo's HTML parser html5ever) and pairs it with our own layout engine (which we are implementing mostly as libraries: Taffy [0] for box-level layout and Parley [1] for text/inline layout) and DOM implementation. Rendering and networking are abstracted behind traits (with default implementations available) and you can drive it using your own event loop.
Minimal binary sizes are around 5mb (although more typical build would be more like 10-15mb).
[0]: https://github.com/DioxusLabs/taffy https://github.com/DioxusLabs/taffy
[1]: https://github.com/linebender/parley https://github.com/linebender/parley
- enzyme1234 1y agowould this be a good fit for rendering a game UI? showing various stat/dialogue displays, an inventory/equip screen with draggable items, menus, etc. All I really want is html+css to do styling and layout and I'd rather have the interaction logic in the game code than javascript anyway
- nicoburns 1y agoI think it would, modulo that it's not really "ready" yet. We do have a couple of PoC examples of integrating with the Bevy game engine. Both of these use Dioxus Native, which wraps Blitz with Dioxus (which is a React-like framework but in Rust rather than JavaScript - https://github.com/DioxusLabs/dioxus https://github.com/DioxusLabs/dioxus), but you could do DOM tree creation and event handling manually if you wanted to. - This first one includes Bevy inside a window setup by Dioxus Native (using a `<canvas>` element similar to how you might on the web). Here the event loop is controled by Dioxus Native and the Bevy game is rendered to a texture which is then included in Blitz's scene. https://github.com/DioxusLabs/dioxus/tree/main/examples/10-integrations/bevy https://github.com/DioxusLabs/dioxus/tree/main/examples/10-i... - This second one does it the other way around and embeds a Dioxus Native document inside a window setup by Bevy. Here the event loop is controlled by Bevy and the Blitz document is rendered to a texture with which Bevy can then do whatever it likes (generally you might just render it on top of the games, but someone tried mapping it into 3d space https://github.com/rectalogic/bevy_blitz https://github.com/rectalogic/bevy_blitz) https://github.com/DioxusLabs/dioxus/tree/main/examples/10-integrations/native-headless-in-bevy https://github.com/DioxusLabs/dioxus/tree/main/examples/10-i... The latter is probably what I would recommended for game UI. Both approaches probably need more work (and Blitz could do with more complete event handling support) before I would consider them "production ready".