Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bytestring-net/bevy_lunex
Blazingly fast path based retained layout engine for Bevy entities, built around vanilla Bevy ECS.
https://github.com/bytestring-net/bevy_lunex
bevy bevy-lunex framework layout lunex rust ui
Last synced: 9 days ago
JSON representation
Blazingly fast path based retained layout engine for Bevy entities, built around vanilla Bevy ECS.
- Host: GitHub
- URL: https://github.com/bytestring-net/bevy_lunex
- Owner: bytestring-net
- License: apache-2.0
- Created: 2023-06-26T20:44:39.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-10-28T11:34:03.000Z (11 days ago)
- Last Synced: 2024-10-29T22:54:00.449Z (10 days ago)
- Topics: bevy, bevy-lunex, framework, layout, lunex, rust, ui
- Language: Rust
- Homepage: https://bytestring-net.github.io/bevy_lunex/
- Size: 82.4 MB
- Stars: 563
- Watchers: 6
- Forks: 23
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- License: LICENSE-APACHE
Awesome Lists containing this project
- awesome-bevy - Lunex
README
![image](https://github.com/bytestring-net/bevy_lunex/blob/main/promo/bevy_lunex.png?raw=true)
#
Blazingly fast ***path based*** retained ***layout engine*** for Bevy entities, built around vanilla **Bevy ECS**. It gives you the ability to make ***your own custom UI*** using regular ECS like every other part of your app.
* **Any aspect ratio:** Lunex is designed to support ALL window sizes out of the box without deforming. The built in layout types react nicely and intuitively to aspect ratio changes.
* **Optimized:** Unlike immediate mode GUI systems, Bevy_Lunex is a retained layout engine. This means the layout is calculated and stored, reducing the need for constant recalculations and offering potential performance benefits, especially for static or infrequently updated UIs.
* **ECS focused:** Since it's built with ECS, you can extend or customize the behavior of your UI by simply adding or modifying components. The interactivity is done by regular systems and events.
* **Worldspace UI:** One of the features of Bevy_Lunex is its support for both 2D and 3D UI elements, leveraging Bevy's `Transform` component. This opens up a wide range of possibilities for developers looking to integrate UI elements seamlessly into both flat and spatial environments. Diegetic UI is no problem.
* **Custom cursor:** You can style your cursor with any image you want! Lunex also provides easy drop-in components for mouse interactivity.
##
![image](https://github.com/bytestring-net/bevy_lunex/blob/main/promo/bevypunk_1.png?raw=true)
![image](https://github.com/bytestring-net/bevy_lunex/blob/main/promo/bevypunk_3.jpeg?raw=true)
> *Try out the live WASM demo on [`Itch.io`](https://idedary.itch.io/bevypunk) or [`GitHub Pages`](https://idedary.github.io/Bevypunk/) (Limited performance & stutter due to running on a single thread). For best experience compile the project natively. You can find [source code here](https://github.com/IDEDARY/Bevypunk).*
## Syntax Example
This is an example of a clickable Button created from scratch using predefined components.
As you can see, ECS modularity is the focus here. The library will also greatly benefit from upcoming
BSN (Bevy Scene Notation) addition that Cart is working on.```rust
commands.spawn((// #=== UI DEFINITION ===#
// This specifies the name and hierarchy of the node
UiLink::::path("Menu/Button"),// Here you can define the layout using the provided units (per state like Base, Hover, Selected, etc.)
UiLayout::window().pos(Rl((50.0, 50.0))).size((Rh(45.0), Rl(60.0))).pack::(),// #=== CUSTOMIZATION ===#
// Give it a background image
UiImage2dBundle { texture: assets.load("images/button.png"), ..default() },// Make the background image resizable
ImageScaleMode::Sliced(TextureSlicer { border: BorderRect::square(32.0), ..default() }),// This is required to control our hover animation
UiAnimator::::new().forward_speed(5.0).backward_speed(1.0),// This will set the base color to red
UiColor::new(Color::RED),// This will set hover color to yellow
UiColor::new(Color::YELLOW),// #=== INTERACTIVITY ===#
// This is required for hit detection (make it clickable)
PickableBundle::default(),// This will change cursor icon on mouse hover
OnHoverSetCursor::new(CursorIcon::Pointer),// If we click on this, it will emmit UiClick event we can listen to
UiClickEmitter::SELF,
));
```## Documentation
There is a Lunex book for detailed explanations about the concepts used in Lunex. You can find it here: [`Bevy Lunex book`](https://bytestring-net.github.io/bevy_lunex/).
For production ready example/template check out [`Bevypunk source code`](https://github.com/IDEDARY/Bevypunk).
## Versions
| Bevy | Bevy Lunex |
|--------|-----------------|
| ^ 0.14 | 0.2.0 - 0.2.4 |
| 0.13.2 | 0.1.0 |
| 0.12.1 | 0.0.10 - 0.0.11 |
| 0.12.0 | 0.0.7 - 0.0.9 |
| 0.11.2 | 0.0.1 - 0.0.6 |> ***Any version below 0.0.X is EXPERIMENTAL and is not intended for practical use***
## Contributing
Any contribution submitted by you will be dual licensed as mentioned below, without any additional terms or conditions. If you have the need to discuss this, please contact me.
## Licensing
Released under both [APACHE](./LICENSE-APACHE) and [MIT](./LICENSE-MIT) licenses. Pick one that suits you the most!