Expand description
§Woodpecker UI
Woodpecker UI is a Bevy ECS driven user interface crate. Its designed to be easy to use and work seamlessly with the bevy game engine.
§Features
- ECS first UI
- Easy to use widget systems
- Flexable UI rendering using vello
- Taffy layouting
- Cosmic Text for text layouting
- A few helper widgets to get you started
§Example:
fn startup(
mut commands: Commands,
mut ui_context: ResMut<WoodpeckerContext>,
mut meshes: ResMut<Assets<Mesh>>,
mut materials: ResMut<Assets<ColorMaterial>>,
) {
commands.spawn(Camera2dBundle::default());
let material_red = materials.add(Color::Srgba(Srgba::RED.with_alpha(0.5)));
commands.spawn(MaterialMesh2dBundle {
mesh: Mesh2dHandle(meshes.add(Circle { radius: 50.0 })),
material: material_red,
transform: Transform::from_xyz(0.0, 0.0, 0.0),
..default()
});
let root = commands
.spawn((WoodpeckerAppBundle {
styles: WoodpeckerStyle {
padding: Edge::all(10.0),
..default()
},
children: WidgetChildren::default().with_child::<Slider>(SliderBundle {
slider: Slider {
start: 0.0,
end: 1.0,
value: 0.5,
},
on_changed: On::run(
|event: Listener<OnChange<SliderChanged>>,
mut material_assets: ResMut<Assets<ColorMaterial>>,
query: Query<&Handle<ColorMaterial>>| {
for material in query.iter() {
material_assets.get_mut(material).unwrap().color.set_alpha(event.data.value)
}
},
),
..default()
}),
..default()
},))
.id();
ui_context.set_root_widget(root);
}
Modules§
- prelude
- A module that exports all publicly exposed types.
Structs§
- Current
Widget - Wraps an entity and lets woodpecker know this is the current widget entity. Note: This is used to pass the current widget entity to the update and render systems.
- Default
Font - A bevy resource used as the default font.
- Parent
Widget - Wraps an entity and lets woodpecker know its a parent.
- Previous
Resource - Previous resource
- Render
Settings - Defines useful render settings
- WoodpeckerUI
Plugin - The Woodpecker UI bevy Plugin Add this to bevy to use.
- Woodpecker
View - A marker for woodpecker UI views.
Traits§
- Widget
Register Ext - A trait that gives us some extra functionality for register widgets in bevy.