# Lumecs
> Experimental GUI backed by Bevy ECS + usual suspects
## Example
> The infamous counter
```rust
use lumecs::prelude::*;
struct Counter {
count: usize,
}
#[derive(Debug, Clone)]
enum Message {
Increment,
Decrement,
}
impl Runner<'_> for Counter {
type M = Message;
fn update(&mut self, message: Message) {
match message {
Message::Increment => self.count = self.count.saturating_add(1),
Message::Decrement => self.count = self.count.saturating_sub(1),
}
}
fn view(&self) -> impl Widget<'_, Self::M> {
Root::flex_column()
.gap(10.0)
.align_items_center()
.justify_content_center()
.child(Text::new(format!("Count: {}", self.count)).font_size(24.0))
.child(
Container::flex_row()
.gap(10.0)
.child(
Container::flex()
.background_color("#ffcccc")
.padding(5.0)
.on_click(Message::Decrement)
.child(Text::new("Decrement").color("#111111")),
)
.child(
Container::flex()
.background_color("#ccffcc")
.padding(5.0)
.on_click(Message::Increment)
.child(Text::new("Increment").color("#111111")),
),
)
}
}
fn main() {
let counter = Counter { count: 0 };
run(counter).expect("Failed to run the application");
}
```
## Used crates
- Data storage: [`bevy_ecs`]
- Text rendering: [`parley`] & [`glifo`]
- Layout calculations: [`taffy`]
- Rendering: [`vello`], [`vello_hybrid`] & [`wgpu`]
- Windowing: [`winit`]
[`bevy_ecs`]: https://crates.io/crates/bevy_ecs
[`glifo`]: https://crates.io/crates/glifo
[`parley`]: https://crates.io/crates/parley
[`taffy`]: https://crates.io/crates/taffy
[`vello_hybrid`]: https://crates.io/crates/vello_hybrid
[`vello`]: https://crates.io/crates/vello
[`wgpu`]: https://crates.io/crates/wgpu
[`winit`]: https://crates.io/crates/winit
#### License
<sup>
Licensed under either of <a href="LICENSE-APACHE">Apache License, Version
2.0</a> or <a href="LICENSE-MIT">MIT license</a> at your option.
</sup>
<br>
<sub>
Unless you explicitly state otherwise, any contribution intentionally submitted
for inclusion in this crate by you, as defined in the Apache-2.0 license, shall
be dual licensed as above, without any additional terms or conditions.
</sub>