diff --git a/src/credits.rs b/src/credits.rs index 8e6dd59..aefd30e 100644 --- a/src/credits.rs +++ b/src/credits.rs @@ -83,28 +83,24 @@ fn init_credits_ui( }, )) .with_children(|parent| { - parent.spawn( - TextBundle { - text: Text { - sections: vec![ - TextSection { - value: "B a c k".into(), - style: TextStyle { - color: Color::WHITE, - font_size: 12.0, - font: font_handle.clone(), - }, - } - ], - ..default() - }, - style: Style { - margin: UiRect::all(Val::Px(20.0)), - ..default() - }, + parent.spawn(TextBundle { + text: Text { + sections: vec![TextSection { + value: "B a c k".into(), + style: TextStyle { + color: Color::WHITE, + font_size: 12.0, + font: font_handle.clone(), + }, + }], ..default() - } - ); + }, + style: Style { + margin: UiRect::all(Val::Px(20.0)), + ..default() + }, + ..default() + }); }); }); } diff --git a/src/game.rs b/src/game.rs index a6d794d..6040176 100644 --- a/src/game.rs +++ b/src/game.rs @@ -680,28 +680,24 @@ fn set_endgame( }, )) .with_children(|parent| { - parent.spawn( - TextBundle { - text: Text { - sections: vec![ - TextSection { - value: "N e w G a m e".into(), - style: TextStyle { - color: Color::WHITE, - font_size: 16.0, - font: font_handle.clone(), - }, - } - ], - ..default() - }, - style: Style { - margin: UiRect::all(Val::Px(20.0)), - ..default() - }, + parent.spawn(TextBundle { + text: Text { + sections: vec![TextSection { + value: "N e w G a m e".into(), + style: TextStyle { + color: Color::WHITE, + font_size: 16.0, + font: font_handle.clone(), + }, + }], ..default() - } - ); + }, + style: Style { + margin: UiRect::all(Val::Px(20.0)), + ..default() + }, + ..default() + }); }); // Quit button @@ -723,28 +719,24 @@ fn set_endgame( }, )) .with_children(|parent| { - parent.spawn( - TextBundle { - text: Text { - sections: vec![ - TextSection { - value: "Q u i t".into(), - style: TextStyle { - color: Color::WHITE, - font_size: 16.0, - font: font_handle.clone(), - }, - } - ], - ..default() - }, - style: Style { - margin: UiRect::all(Val::Px(20.0)), - ..default() - }, + parent.spawn(TextBundle { + text: Text { + sections: vec![TextSection { + value: "Q u i t".into(), + style: TextStyle { + color: Color::WHITE, + font_size: 16.0, + font: font_handle.clone(), + }, + }], ..default() - } - ); + }, + style: Style { + margin: UiRect::all(Val::Px(20.0)), + ..default() + }, + ..default() + }); }); }); }); diff --git a/src/menu.rs b/src/menu.rs index 3870d7b..8a92dd9 100644 --- a/src/menu.rs +++ b/src/menu.rs @@ -100,28 +100,24 @@ fn init_play_menu( }, )) .with_children(|parent| { - parent.spawn( - TextBundle { - text: Text { - sections: vec![ - TextSection { - value: "C o n t i n u e".into(), - style: TextStyle { - color: Color::WHITE, - font_size: 16.0, - font: font_handle.clone(), - }, - } - ], - ..default() - }, - style: Style { - margin: UiRect::all(Val::Px(20.0)), - ..default() - }, + parent.spawn(TextBundle { + text: Text { + sections: vec![TextSection { + value: "C o n t i n u e".into(), + style: TextStyle { + color: Color::WHITE, + font_size: 16.0, + font: font_handle.clone(), + }, + }], ..default() - } - ); + }, + style: Style { + margin: UiRect::all(Val::Px(20.0)), + ..default() + }, + ..default() + }); }); // Tutorial button @@ -143,28 +139,24 @@ fn init_play_menu( }, )) .with_children(|parent| { - parent.spawn( - TextBundle { - text: Text { - sections: vec![ - TextSection { - value: "T u t o r i a l".into(), - style: TextStyle { - color: Color::WHITE, - font_size: 16.0, - font: font_handle.clone(), - }, - } - ], - ..default() - }, - style: Style { - margin: UiRect::all(Val::Px(20.0)), - ..default() - }, + parent.spawn(TextBundle { + text: Text { + sections: vec![TextSection { + value: "T u t o r i a l".into(), + style: TextStyle { + color: Color::WHITE, + font_size: 16.0, + font: font_handle.clone(), + }, + }], ..default() - } - ); + }, + style: Style { + margin: UiRect::all(Val::Px(20.0)), + ..default() + }, + ..default() + }); }); // Credits button @@ -186,28 +178,24 @@ fn init_play_menu( }, )) .with_children(|parent| { - parent.spawn( - TextBundle { - text: Text { - sections: vec![ - TextSection { - value: "C r e d i t s".into(), - style: TextStyle { - color: Color::WHITE, - font_size: 16.0, - font: font_handle.clone(), - }, - } - ], - ..default() - }, - style: Style { - margin: UiRect::all(Val::Px(20.0)), - ..default() - }, + parent.spawn(TextBundle { + text: Text { + sections: vec![TextSection { + value: "C r e d i t s".into(), + style: TextStyle { + color: Color::WHITE, + font_size: 16.0, + font: font_handle.clone(), + }, + }], ..default() - } - ); + }, + style: Style { + margin: UiRect::all(Val::Px(20.0)), + ..default() + }, + ..default() + }); }); // Quit button @@ -229,28 +217,24 @@ fn init_play_menu( }, )) .with_children(|parent| { - parent.spawn( - TextBundle { - text: Text { - sections: vec![ - TextSection { - value: "Q u i t".into(), - style: TextStyle { - color: Color::WHITE, - font_size: 16.0, - font: font_handle.clone(), - }, - } - ], - ..default() - }, - style: Style { - margin: UiRect::all(Val::Px(20.0)), - ..default() - }, + parent.spawn(TextBundle { + text: Text { + sections: vec![TextSection { + value: "Q u i t".into(), + style: TextStyle { + color: Color::WHITE, + font_size: 16.0, + font: font_handle.clone(), + }, + }], ..default() - } - ); + }, + style: Style { + margin: UiRect::all(Val::Px(20.0)), + ..default() + }, + ..default() + }); }); }); } diff --git a/src/tutorial.rs b/src/tutorial.rs index 7402da0..46893dc 100644 --- a/src/tutorial.rs +++ b/src/tutorial.rs @@ -245,28 +245,24 @@ fn initialize_tutorial( }, )) .with_children(|parent| { - parent.spawn( - TextBundle { - text: Text { - sections: vec![ - TextSection { - value: "R e s t a r t".into(), - style: TextStyle { - color: Color::WHITE, - font_size: 8.0, - font: font_handle.clone(), - }, - } - ], - ..default() - }, - style: Style { - margin: UiRect::all(Val::Px(20.0)), - ..default() - }, + parent.spawn(TextBundle { + text: Text { + sections: vec![TextSection { + value: "R e s t a r t".into(), + style: TextStyle { + color: Color::WHITE, + font_size: 8.0, + font: font_handle.clone(), + }, + }], ..default() - } - ); + }, + style: Style { + margin: UiRect::all(Val::Px(20.0)), + ..default() + }, + ..default() + }); }); parent @@ -288,28 +284,24 @@ fn initialize_tutorial( }, )) .with_children(|parent| { - parent.spawn( - TextBundle { - text: Text { - sections: vec![ - TextSection { - value: "C o n t i n u e".into(), - style: TextStyle { - color: Color::WHITE, - font_size: 12.0, - font: font_handle.clone(), - }, - } - ], - ..default() - }, - style: Style { - margin: UiRect::all(Val::Px(20.0)), - ..default() - }, + parent.spawn(TextBundle { + text: Text { + sections: vec![TextSection { + value: "C o n t i n u e".into(), + style: TextStyle { + color: Color::WHITE, + font_size: 12.0, + font: font_handle.clone(), + }, + }], ..default() - } - ); + }, + style: Style { + margin: UiRect::all(Val::Px(20.0)), + ..default() + }, + ..default() + }); }); }); } diff --git a/src/ui.rs b/src/ui.rs index 1a061a8..300f41f 100644 --- a/src/ui.rs +++ b/src/ui.rs @@ -69,8 +69,10 @@ fn manage_cursor( } fn interactive_button( - mut events: Query<(&mut UiImage, &Interaction), (With