Skip to content

Commit

Permalink
fix formatting via cargo fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
emwebb committed Nov 30, 2024
1 parent 8a231dd commit a44deaf
Show file tree
Hide file tree
Showing 2 changed files with 80 additions and 67 deletions.
140 changes: 74 additions & 66 deletions examples/ui/systems/menu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,21 +25,24 @@ pub fn setup(
commands.spawn(Camera2d).insert(Menu);
// ui
commands
.spawn((Node {
width: Val::Percent(100.0),
height: Val::Percent(100.0),
position_type: PositionType::Absolute,
flex_direction: FlexDirection::ColumnReverse,
align_items: AlignItems::Center,
justify_content: JustifyContent::FlexStart,
..default()
},
BackgroundColor(Color::NONE)))
.spawn((
Node {
width: Val::Percent(100.0),
height: Val::Percent(100.0),
position_type: PositionType::Absolute,
flex_direction: FlexDirection::ColumnReverse,
align_items: AlignItems::Center,
justify_content: JustifyContent::FlexStart,
..default()
},
BackgroundColor(Color::NONE),
))
.insert(Menu)
.with_children(|parent| {
// Header
parent
.spawn((Node {
.spawn((
Node {
width: Val::Percent(100.0),
height: Val::Percent(25.0),
justify_content: JustifyContent::Center,
Expand All @@ -49,52 +52,56 @@ pub fn setup(
BackgroundColor(css::DARK_GRAY.into()),
))
.with_children(|parent| {
parent.spawn((Text(choose_language),
TextFont{
font: font.0.clone(),
font_size: 64.0,
..default()
},
TextColor(Color::WHITE),
));});
parent.spawn((
Text(choose_language),
TextFont {
font: font.0.clone(),
font_size: 64.0,
..default()
},
TextColor(Color::WHITE),
));
});
// Content
parent
.spawn(Node {
width: Val::Percent(100.0),
height: Val::Percent(75.0),
justify_content: JustifyContent::Center,
align_items: AlignItems::Center,
margin: UiRect::all(Val::Auto),
..default()
width: Val::Percent(100.0),
height: Val::Percent(75.0),
justify_content: JustifyContent::Center,
align_items: AlignItems::Center,
margin: UiRect::all(Val::Auto),
..default()
})
.with_children(|parent| {
parent
.spawn((
PreviousButton,
Node {
width: Val::Percent(10.0),
height: Val::Percent(20.0),
min_width: Val::Px(64.0),
min_height: Val::Px(64.0),
justify_content: JustifyContent::Center,
align_items: AlignItems::Center,
..default()
width: Val::Percent(10.0),
height: Val::Percent(20.0),
min_width: Val::Px(64.0),
min_height: Val::Px(64.0),
justify_content: JustifyContent::Center,
align_items: AlignItems::Center,
..default()
},
BackgroundColor(css::GRAY.into()),
Button
Button,
))
.with_children(|parent| {
parent.spawn((Text("<".to_string()),
TextFont{
font: font.0.clone(),
font_size: 64.0,
..default()
},
TextColor(Color::WHITE),
parent.spawn((
Text("<".to_string()),
TextFont {
font: font.0.clone(),
font_size: 64.0,
..default()
},
TextColor(Color::WHITE),
));
});
parent
.spawn((Node{
.spawn((
Node {
width: Val::Percent(80.0),
height: Val::Percent(20.0),
min_width: Val::Px(256.0),
Expand All @@ -106,39 +113,40 @@ pub fn setup(
BackgroundColor(css::GRAY.into()),
))
.with_children(|parent| {
parent.spawn((Text(locale),
TextFont{
font: font.0.clone(),
font_size: 64.0,
..default()
},
TextColor(Color::WHITE),
parent.spawn((
Text(locale),
TextFont {
font: font.0.clone(),
font_size: 64.0,
..default()
},
TextColor(Color::WHITE),
));
});
parent
.spawn((
NextButton,
Node {
width: Val::Percent(10.0),
height: Val::Percent(20.0),
min_width: Val::Px(64.0),
min_height: Val::Px(64.0),
justify_content: JustifyContent::Center,
align_items: AlignItems::Center,
..default()
},
BackgroundColor(css::GRAY.into()),
Button
,
))
.with_children(|parent| {
parent.spawn((Text(">".to_string()),
TextFont{
font: font.0.clone(),
font_size: 64.0,
width: Val::Percent(10.0),
height: Val::Percent(20.0),
min_width: Val::Px(64.0),
min_height: Val::Px(64.0),
justify_content: JustifyContent::Center,
align_items: AlignItems::Center,
..default()
},
TextColor(Color::WHITE),
BackgroundColor(css::GRAY.into()),
Button,
))
.with_children(|parent| {
parent.spawn((
Text(">".to_string()),
TextFont {
font: font.0.clone(),
font_size: 64.0,
..default()
},
TextColor(Color::WHITE),
));
});
});
Expand Down
7 changes: 6 additions & 1 deletion src/assets/bundle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,12 @@ async fn load(data: Data, load_context: &mut LoadContext<'_>) -> Result<BundleAs
path = parent.join(path);
}
}
let loaded = load_context.loader().immediate().with_unknown_type().load(path).await?;
let loaded = load_context
.loader()
.immediate()
.with_unknown_type()
.load(path)
.await?;
let resource = loaded.get::<ResourceAsset>().unwrap();
if let Err(errors) = bundle.add_resource(resource.0.clone()) {
warn_span!("add_resource").in_scope(|| {
Expand Down

0 comments on commit a44deaf

Please sign in to comment.