bevy_bundletree

Crates.iobevy_bundletree
lib.rsbevy_bundletree
version0.1.2
sourcesrc
created_at2024-05-18 22:34:17.560031
updated_at2024-07-15 01:36:59.746251
descriptionSpawn trees of bundles in the Bevy game engine.
homepagehttps://github.com/Katsutoshii/bevy_bundletree
repositoryhttps://github.com/Katsutoshii/bevy_bundletree
max_upload_size
id1244532
size604,421
Josiah Putman (Katsutoshii)

documentation

https://docs.rs/bevy_bundletree/latest/bevy_bundletree

README

bevy_bundletree

License Crates.io Docs

Spawn trees of bundles in Bevy to make UI Code more ergonomic.

Usage

Define an enum to represent all possible bundles in your tree and derive IntoBundleTree and BundleEnum.

use bevy::prelude::*;
use bevy_bundletree::*;

#[derive(IntoBundleTree, BundleEnum)]
enum UiNode {
    Node(NodeBundle),
    Text(TextBundle),
    Button(ButtonBundle),
}
fn setup(mut commands: Commands) {
    let tree: BundleTree<UiNode> = NodeBundle::default().with_children([
        TextBundle::default().into_tree(),
        ButtonBundle::default().into_tree()]);
    commands.spawn_tree(tree);
}
Commit count: 8

cargo fmt