mirror of
https://github.com/a-b-street/abstreet.git
synced 2024-12-29 17:34:58 +03:00
the vital swap control
This commit is contained in:
parent
58b3d6d201
commit
4a3e8177c4
@ -57,6 +57,7 @@ impl ABTestMode {
|
|||||||
|
|
||||||
let mut txt = Text::new();
|
let mut txt = Text::new();
|
||||||
txt.add_styled_line("A/B Test Mode".to_string(), None, Some(Color::BLUE), None);
|
txt.add_styled_line("A/B Test Mode".to_string(), None, Some(Color::BLUE), None);
|
||||||
|
txt.add_line(state.ui.state.primary.map.get_edits().edits_name.clone());
|
||||||
txt.add_line(state.ui.state.primary.sim.summary());
|
txt.add_line(state.ui.state.primary.sim.summary());
|
||||||
if let State::Running { ref speed, .. } = mode.state {
|
if let State::Running { ref speed, .. } = mode.state {
|
||||||
txt.add_line(format!(
|
txt.add_line(format!(
|
||||||
@ -98,6 +99,11 @@ impl ABTestMode {
|
|||||||
if ctx.input.modal_action("speed up sim") {
|
if ctx.input.modal_action("speed up sim") {
|
||||||
mode.desired_speed += ADJUST_SPEED;
|
mode.desired_speed += ADJUST_SPEED;
|
||||||
}
|
}
|
||||||
|
if ctx.input.modal_action("swap") {
|
||||||
|
let secondary = mode.secondary.take().unwrap();
|
||||||
|
let primary = std::mem::replace(&mut state.ui.state.primary, secondary);
|
||||||
|
mode.secondary = Some(primary);
|
||||||
|
}
|
||||||
|
|
||||||
match mode.state {
|
match mode.state {
|
||||||
State::Paused => {
|
State::Paused => {
|
||||||
|
@ -150,6 +150,7 @@ impl GUI for UI {
|
|||||||
(Key::RightBracket, "speed up sim"),
|
(Key::RightBracket, "speed up sim"),
|
||||||
(Key::Space, "run/pause sim"),
|
(Key::Space, "run/pause sim"),
|
||||||
(Key::M, "run one step of sim"),
|
(Key::M, "run one step of sim"),
|
||||||
|
(Key::S, "swap"),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
ModalMenu::new(
|
ModalMenu::new(
|
||||||
|
Loading…
Reference in New Issue
Block a user