adjust title screen layouting [rebuild]
@@ -27,20 +27,23 @@ impl TitleScreen {
let mut rng = ui.primary.current_flags.sim_flags.make_rng();
TitleScreen {
composite: Composite::new(
- ezgui::Composite::new(ManagedWidget::col(vec![
+ ezgui::Composite::new(
+ ManagedWidget::col(vec![
ManagedWidget::just_draw(JustDraw::image("assets/pregame/logo.png", ctx))
.bg(Color::GREEN.alpha(0.2)),
// TODO that nicer font
// TODO Any key
- ManagedWidget::row(vec![ManagedWidget::btn(Button::text(
+ ManagedWidget::btn(Button::text(
Text::from(Line("PLAY")),
Color::BLUE,
Color::ORANGE,
hotkey(Key::Space),
"start game",
ctx,
- ))]),
- ]))
+ )),
+ ])
+ .centered(),
+ )
.build(ctx),
)
.cb(
@@ -71,19 +74,13 @@ impl State for TitleScreen {
}
pub fn main_menu(ctx: &mut EventCtx, ui: &UI) -> Box<dyn State> {
- let mut col = Vec::new();
-
- col.push(ManagedWidget::row(vec![
- Composite::svg_button(ctx, "assets/pregame/quit.svg", "quit", hotkey(Key::Escape)),
- ManagedWidget::draw_text(ctx, Text::from(Line("A/B STREET").size(50))),
- ]));
-
- col.push(ManagedWidget::draw_text(
- ctx,
- Text::from(Line("Created by Dustin Carlino")),
- ));
-
- col.push(ManagedWidget::row(vec![
+ let mut col = vec![
+ ManagedWidget::row(vec![{
+ let mut txt = Text::from(Line("A/B STREET").size(50));
+ txt.add(Line("Created by Dustin Carlino"));
+ ManagedWidget::draw_text(ctx, txt)
+ }]),
+ ManagedWidget::row(vec![
Composite::svg_button(
ctx,
"assets/pregame/tutorial.svg",
@@ -102,7 +99,9 @@ pub fn main_menu(ctx: &mut EventCtx, ui: &UI) -> Box<dyn State> {
hotkey(Key::C),
"Challenges",
),
- ]));
+ ])
+ .centered(),
+ ];
if ui.opts.dev {
col.push(ManagedWidget::row(vec![
Composite::text_button(ctx, "INTERNAL DEV TOOLS", hotkey(Key::M)),
@@ -111,7 +110,13 @@ pub fn main_menu(ctx: &mut EventCtx, ui: &UI) -> Box<dyn State> {
}
col.push(Composite::text_button(ctx, "About A/B Street", None));
- let mut c = Composite::new(ezgui::Composite::new(ManagedWidget::col(col)).build(ctx))
+ let mut c = Composite::new(
+ ezgui::Composite::new(ManagedWidget::row(vec![
+ Composite::svg_button(ctx, "assets/pregame/quit.svg", "quit", hotkey(Key::Escape)),
+ ManagedWidget::col(col).centered(),
+ ]))
+ .build(ctx),
+ )
.cb(
"quit",
Box::new(|_, _| {
