
Version 0.2 supports Bevy 0.10, 0.1 supports Bevy 0.9.
Same implementation as this borders PR: https://github.com/bevyengine/bevy/pull/7795
No support for border styles due to the limitations of the current Bevy UI renderer.
Version 0.2 adds support for outlines. Outlines are similar to borders but drawn outside the node on the edge of the node boundary and occupy no space in the UI layout.
#
Add the dependency to your bevy project:
cargo add bevy_ui_borders
To display a bordered UI node:
* Add the BordersPlugin plugin to your app.
* Spawn an entity with a BorderBundle and a NodeBundle where the border field of its Style component is set to a non-zero thickness.
To draw a white UI node with a red border:
```rust use bevy::prelude::; use bevy_ui_borders::;
fn spawnexample(mut commands: Commands) {
commands.spawn(Camera2dBundle::default());
commands.spawn((
NodeBundle {
style: Style {
size: Size::new(Val::Px(100.), Val::Px(100.)),
margin: UiRect::all(Val::Px(100.)),
border: UiRect::all(Val::Px(10.)),
..Default::default()
},
backgroundcolor: Color::WHITE.into(),
..Default::default()
},
BorderBundle::new(Color::RED),
));
}
fn main() {
App::new()
.addplugins(DefaultPlugins)
.addplugin(BordersPlugin)
.addstartupsystem(spawn_example)
.run();
}
``
* You also useBorderedNodeBundleandOutlinedNodeBundleinstead of of aNodeBudle` bundle tuple
to spawn bordered and outlined UI nodes.
#
cargo --run --example minimal
cargo --run --example tiles
cargo --run --example outlines