docs/bevy/examples/helpers/scene.rs 941 B · 32 lines · raw · history

1 /// Helpers to create a [`Node`] appropriate for the outer main UI node as a `Scene`.
2 use bevy::prelude::*;
3
4 /// Returns a [`Node`] appropriate for the outer main UI node as a `Scene`.
5 ///
6 /// This UI is in the bottom left corner and has flex column support
7 pub fn bottom_left_scene() -> impl Scene {
8 bsn! {
9 Node {
10 flex_direction: FlexDirection::Column,
11 position_type: PositionType::Absolute,
12 row_gap: px(6),
13 left: px(10),
14 bottom: px(10),
15 }
16 }
17 }
18
19 /// Returns a [`Node`] appropriate for the outer main UI node as a `Scene`.
20 ///
21 /// This UI is in the top left corner and has flex column support
22 pub fn top_left_scene() -> impl Scene {
23 bsn! {
24 Node {
25 flex_direction: FlexDirection::Column,
26 position_type: PositionType::Absolute,
27 row_gap: px(6),
28 left: px(10),
29 top: px(10),
30 }
31 }
32 }