slightly adjust some fullscreen stuff

This commit is contained in:
Dustin Carlino 2020-01-15 14:51:55 -08:00
parent bb01c30b9d
commit 15400dc514
3 changed files with 61 additions and 70 deletions

View File

@ -138,8 +138,7 @@ pub fn challenges_picker(ctx: &mut EventCtx) -> Box<dyn State> {
}
col.push(ManagedWidget::row(flex_row).flex_wrap(ctx, 80));
let mut c =
Composite::new(ezgui::Composite::new(ManagedWidget::col(col).centered()).build(ctx));
let mut c = Composite::new(ezgui::Composite::new(ManagedWidget::col(col)).build(ctx));
c = c.cb("back", Box::new(|_, _| Some(Transition::Pop)));
for (name, stages) in all_challenges() {

View File

@ -39,8 +39,7 @@ impl TitleScreen {
hotkey(Key::Space),
"start game",
ctx,
))])
.centered(),
))]),
]))
.build(ctx),
)
@ -84,76 +83,67 @@ pub fn main_menu(ctx: &mut EventCtx, ui: &UI) -> Box<dyn State> {
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",
),
])
.centered(),
);
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",
),
]));
if ui.opts.dev {
col.push(
ManagedWidget::row(vec![
Composite::text_button(ctx, "INTERNAL DEV TOOLS", hotkey(Key::M)),
Composite::text_button(ctx, "INTERNAL A/B TEST MODE", hotkey(Key::A)),
])
.centered(),
);
col.push(ManagedWidget::row(vec![
Composite::text_button(ctx, "INTERNAL DEV TOOLS", hotkey(Key::M)),
Composite::text_button(ctx, "INTERNAL A/B TEST MODE", hotkey(Key::A)),
]));
}
col.push(Composite::text_button(ctx, "About A/B Street", None));
let mut c =
Composite::new(ezgui::Composite::new(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))))),
)
.cb(
"Sandbox mode",
Box::new(|ctx, ui| {
Some(Transition::PushWithMode(
Box::new(SandboxMode::new(
ctx,
ui,
GameplayMode::PlayScenario(
"random scenario with some agents".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)))),
);
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(ctx))))),
)
.cb(
"Sandbox mode",
Box::new(|ctx, ui| {
Some(Transition::PushWithMode(
Box::new(SandboxMode::new(
ctx,
ui,
GameplayMode::PlayScenario("random scenario with some agents".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(

View File

@ -62,6 +62,8 @@ pub fn make(ctx: &mut EventCtx, ui: &UI, tab: Tab) -> Box<dyn State> {
.padding(10),
content,
]))
// Leave room for OSD
.max_size_percent(100, 85)
.build(ctx),
)
.cb("BACK", Box::new(|_, _| Some(Transition::Pop)));