mirror of
https://github.com/a-b-street/abstreet.git
synced 2024-12-20 21:01:33 +03:00
adjust title screen layouting [rebuild]
This commit is contained in:
parent
562f462519
commit
3eb8d61dd2
@ -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![
|
||||
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(
|
||||
Text::from(Line("PLAY")),
|
||||
Color::BLUE,
|
||||
Color::ORANGE,
|
||||
hotkey(Key::Space),
|
||||
"start game",
|
||||
ctx,
|
||||
))]),
|
||||
]))
|
||||
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::btn(Button::text(
|
||||
Text::from(Line("PLAY")),
|
||||
Color::BLUE,
|
||||
Color::ORANGE,
|
||||
hotkey(Key::Space),
|
||||
"start game",
|
||||
ctx,
|
||||
)),
|
||||
])
|
||||
.centered(),
|
||||
)
|
||||
.build(ctx),
|
||||
)
|
||||
.cb(
|
||||
@ -71,38 +74,34 @@ 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![
|
||||
Composite::svg_button(
|
||||
ctx,
|
||||
"assets/pregame/tutorial.svg",
|
||||
"Tutorial",
|
||||
hotkey(Key::T),
|
||||
),
|
||||
Composite::svg_button(
|
||||
ctx,
|
||||
"assets/pregame/sandbox.svg",
|
||||
"Sandbox mode",
|
||||
hotkey(Key::S),
|
||||
),
|
||||
Composite::img_button(
|
||||
ctx,
|
||||
"assets/pregame/challenges.png",
|
||||
hotkey(Key::C),
|
||||
"Challenges",
|
||||
),
|
||||
]));
|
||||
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",
|
||||
"Tutorial",
|
||||
hotkey(Key::T),
|
||||
),
|
||||
Composite::svg_button(
|
||||
ctx,
|
||||
"assets/pregame/sandbox.svg",
|
||||
"Sandbox mode",
|
||||
hotkey(Key::S),
|
||||
),
|
||||
Composite::img_button(
|
||||
ctx,
|
||||
"assets/pregame/challenges.png",
|
||||
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,44 +110,50 @@ 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))
|
||||
.cb(
|
||||
"quit",
|
||||
Box::new(|_, _| {
|
||||
// TODO before_quit?
|
||||
std::process::exit(0);
|
||||
}),
|
||||
)
|
||||
.cb(
|
||||
"Tutorial",
|
||||
Box::new(|ctx, _| {
|
||||
Some(Transition::Push(Box::new(TutorialMode::new(
|
||||
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(|_, _| {
|
||||
// TODO before_quit?
|
||||
std::process::exit(0);
|
||||
}),
|
||||
)
|
||||
.cb(
|
||||
"Tutorial",
|
||||
Box::new(|ctx, _| {
|
||||
Some(Transition::Push(Box::new(TutorialMode::new(
|
||||
ctx,
|
||||
Stage::CanvasControls,
|
||||
))))
|
||||
}),
|
||||
)
|
||||
.cb(
|
||||
"Sandbox mode",
|
||||
Box::new(|ctx, ui| {
|
||||
Some(Transition::PushWithMode(
|
||||
Box::new(SandboxMode::new(
|
||||
ctx,
|
||||
Stage::CanvasControls,
|
||||
))))
|
||||
}),
|
||||
)
|
||||
.cb(
|
||||
"Sandbox mode",
|
||||
Box::new(|ctx, ui| {
|
||||
Some(Transition::PushWithMode(
|
||||
Box::new(SandboxMode::new(
|
||||
ctx,
|
||||
ui,
|
||||
GameplayMode::PlayScenario("random".to_string()),
|
||||
)),
|
||||
EventLoopMode::Animation,
|
||||
))
|
||||
}),
|
||||
)
|
||||
.cb(
|
||||
"Challenges",
|
||||
Box::new(|ctx, _| Some(Transition::Push(challenges_picker(ctx)))),
|
||||
)
|
||||
.cb(
|
||||
"About A/B Street",
|
||||
Box::new(|ctx, _| Some(Transition::Push(about(ctx)))),
|
||||
);
|
||||
ui,
|
||||
GameplayMode::PlayScenario("random".to_string()),
|
||||
)),
|
||||
EventLoopMode::Animation,
|
||||
))
|
||||
}),
|
||||
)
|
||||
.cb(
|
||||
"Challenges",
|
||||
Box::new(|ctx, _| Some(Transition::Push(challenges_picker(ctx)))),
|
||||
)
|
||||
.cb(
|
||||
"About A/B Street",
|
||||
Box::new(|ctx, _| Some(Transition::Push(about(ctx)))),
|
||||
);
|
||||
if ui.opts.dev {
|
||||
c = c
|
||||
.cb(
|
||||
|
Loading…
Reference in New Issue
Block a user