mirror of
https://github.com/a-b-street/abstreet.git
synced 2024-12-30 01:41:56 +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();
|
let mut rng = ui.primary.current_flags.sim_flags.make_rng();
|
||||||
TitleScreen {
|
TitleScreen {
|
||||||
composite: Composite::new(
|
composite: Composite::new(
|
||||||
ezgui::Composite::new(ManagedWidget::col(vec![
|
ezgui::Composite::new(
|
||||||
ManagedWidget::just_draw(JustDraw::image("assets/pregame/logo.png", ctx))
|
ManagedWidget::col(vec![
|
||||||
.bg(Color::GREEN.alpha(0.2)),
|
ManagedWidget::just_draw(JustDraw::image("assets/pregame/logo.png", ctx))
|
||||||
// TODO that nicer font
|
.bg(Color::GREEN.alpha(0.2)),
|
||||||
// TODO Any key
|
// TODO that nicer font
|
||||||
ManagedWidget::row(vec![ManagedWidget::btn(Button::text(
|
// TODO Any key
|
||||||
Text::from(Line("PLAY")),
|
ManagedWidget::btn(Button::text(
|
||||||
Color::BLUE,
|
Text::from(Line("PLAY")),
|
||||||
Color::ORANGE,
|
Color::BLUE,
|
||||||
hotkey(Key::Space),
|
Color::ORANGE,
|
||||||
"start game",
|
hotkey(Key::Space),
|
||||||
ctx,
|
"start game",
|
||||||
))]),
|
ctx,
|
||||||
]))
|
)),
|
||||||
|
])
|
||||||
|
.centered(),
|
||||||
|
)
|
||||||
.build(ctx),
|
.build(ctx),
|
||||||
)
|
)
|
||||||
.cb(
|
.cb(
|
||||||
@ -71,38 +74,34 @@ impl State for TitleScreen {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn main_menu(ctx: &mut EventCtx, ui: &UI) -> Box<dyn State> {
|
pub fn main_menu(ctx: &mut EventCtx, ui: &UI) -> Box<dyn State> {
|
||||||
let mut col = Vec::new();
|
let mut col = vec![
|
||||||
|
ManagedWidget::row(vec![{
|
||||||
col.push(ManagedWidget::row(vec![
|
let mut txt = Text::from(Line("A/B STREET").size(50));
|
||||||
Composite::svg_button(ctx, "assets/pregame/quit.svg", "quit", hotkey(Key::Escape)),
|
txt.add(Line("Created by Dustin Carlino"));
|
||||||
ManagedWidget::draw_text(ctx, Text::from(Line("A/B STREET").size(50))),
|
ManagedWidget::draw_text(ctx, txt)
|
||||||
]));
|
}]),
|
||||||
|
ManagedWidget::row(vec![
|
||||||
col.push(ManagedWidget::draw_text(
|
Composite::svg_button(
|
||||||
ctx,
|
ctx,
|
||||||
Text::from(Line("Created by Dustin Carlino")),
|
"assets/pregame/tutorial.svg",
|
||||||
));
|
"Tutorial",
|
||||||
|
hotkey(Key::T),
|
||||||
col.push(ManagedWidget::row(vec![
|
),
|
||||||
Composite::svg_button(
|
Composite::svg_button(
|
||||||
ctx,
|
ctx,
|
||||||
"assets/pregame/tutorial.svg",
|
"assets/pregame/sandbox.svg",
|
||||||
"Tutorial",
|
"Sandbox mode",
|
||||||
hotkey(Key::T),
|
hotkey(Key::S),
|
||||||
),
|
),
|
||||||
Composite::svg_button(
|
Composite::img_button(
|
||||||
ctx,
|
ctx,
|
||||||
"assets/pregame/sandbox.svg",
|
"assets/pregame/challenges.png",
|
||||||
"Sandbox mode",
|
hotkey(Key::C),
|
||||||
hotkey(Key::S),
|
"Challenges",
|
||||||
),
|
),
|
||||||
Composite::img_button(
|
])
|
||||||
ctx,
|
.centered(),
|
||||||
"assets/pregame/challenges.png",
|
];
|
||||||
hotkey(Key::C),
|
|
||||||
"Challenges",
|
|
||||||
),
|
|
||||||
]));
|
|
||||||
if ui.opts.dev {
|
if ui.opts.dev {
|
||||||
col.push(ManagedWidget::row(vec![
|
col.push(ManagedWidget::row(vec![
|
||||||
Composite::text_button(ctx, "INTERNAL DEV TOOLS", hotkey(Key::M)),
|
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));
|
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(
|
||||||
.cb(
|
ezgui::Composite::new(ManagedWidget::row(vec![
|
||||||
"quit",
|
Composite::svg_button(ctx, "assets/pregame/quit.svg", "quit", hotkey(Key::Escape)),
|
||||||
Box::new(|_, _| {
|
ManagedWidget::col(col).centered(),
|
||||||
// TODO before_quit?
|
]))
|
||||||
std::process::exit(0);
|
.build(ctx),
|
||||||
}),
|
)
|
||||||
)
|
.cb(
|
||||||
.cb(
|
"quit",
|
||||||
"Tutorial",
|
Box::new(|_, _| {
|
||||||
Box::new(|ctx, _| {
|
// TODO before_quit?
|
||||||
Some(Transition::Push(Box::new(TutorialMode::new(
|
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,
|
ctx,
|
||||||
Stage::CanvasControls,
|
ui,
|
||||||
))))
|
GameplayMode::PlayScenario("random".to_string()),
|
||||||
}),
|
)),
|
||||||
)
|
EventLoopMode::Animation,
|
||||||
.cb(
|
))
|
||||||
"Sandbox mode",
|
}),
|
||||||
Box::new(|ctx, ui| {
|
)
|
||||||
Some(Transition::PushWithMode(
|
.cb(
|
||||||
Box::new(SandboxMode::new(
|
"Challenges",
|
||||||
ctx,
|
Box::new(|ctx, _| Some(Transition::Push(challenges_picker(ctx)))),
|
||||||
ui,
|
)
|
||||||
GameplayMode::PlayScenario("random".to_string()),
|
.cb(
|
||||||
)),
|
"About A/B Street",
|
||||||
EventLoopMode::Animation,
|
Box::new(|ctx, _| Some(Transition::Push(about(ctx)))),
|
||||||
))
|
);
|
||||||
}),
|
|
||||||
)
|
|
||||||
.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 {
|
if ui.opts.dev {
|
||||||
c = c
|
c = c
|
||||||
.cb(
|
.cb(
|
||||||
|
Loading…
Reference in New Issue
Block a user