mirror of
https://github.com/a-b-street/abstreet.git
synced 2024-12-29 01:13:53 +03:00
also draw OSD in some modes that dont use CommonState
This commit is contained in:
parent
3db78d1ddd
commit
6f4252fcae
@ -74,6 +74,10 @@ impl CommonState {
|
||||
}
|
||||
self.turn_cycler.draw(g, ui);
|
||||
|
||||
CommonState::draw_osd(g, ui);
|
||||
}
|
||||
|
||||
pub fn draw_osd(g: &mut GfxCtx, ui: &UI) {
|
||||
let id_color = ui.cs.get_def("OSD ID color", Color::RED);
|
||||
let name_color = ui.cs.get_def("OSD name color", Color::CYAN);
|
||||
let mut osd = Text::new();
|
||||
@ -91,6 +95,22 @@ impl CommonState {
|
||||
osd.append(" is ".to_string(), None);
|
||||
osd.append(ui.primary.map.get_b(b).get_name(), Some(name_color));
|
||||
}
|
||||
Some(ID::Turn(t)) => {
|
||||
osd.append(
|
||||
format!("TurnID({})", ui.primary.map.get_t(t).lookup_idx),
|
||||
Some(id_color),
|
||||
);
|
||||
osd.append(" between ".to_string(), None);
|
||||
osd.append(
|
||||
ui.primary.map.get_parent(t.src).get_name(),
|
||||
Some(name_color),
|
||||
);
|
||||
osd.append(" and ".to_string(), None);
|
||||
osd.append(
|
||||
ui.primary.map.get_parent(t.dst).get_name(),
|
||||
Some(name_color),
|
||||
);
|
||||
}
|
||||
// TODO Intersections, cars, pedestrians...
|
||||
Some(id) => {
|
||||
osd.append(format!("{:?}", id), Some(id_color));
|
||||
|
@ -310,6 +310,7 @@ impl EditMode {
|
||||
}
|
||||
|
||||
menu.draw(g);
|
||||
CommonState::draw_osd(g, &state.ui);
|
||||
}
|
||||
Mode::Edit(EditMode::EditingTrafficSignal(ref editor)) => {
|
||||
editor.draw(g, state);
|
||||
|
@ -1,3 +1,4 @@
|
||||
use crate::common::CommonState;
|
||||
use crate::edit::apply_map_edits;
|
||||
use crate::game::GameState;
|
||||
use crate::helpers::ID;
|
||||
@ -291,6 +292,8 @@ impl TrafficSignalEditor {
|
||||
} else if let Some(ref wizard) = self.preset_wizard {
|
||||
wizard.draw(g);
|
||||
}
|
||||
|
||||
CommonState::draw_osd(g, &state.ui);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,3 +1,4 @@
|
||||
use crate::common::CommonState;
|
||||
use crate::helpers::ID;
|
||||
use crate::render::DrawOptions;
|
||||
use crate::ui::{ShowEverything, UI};
|
||||
@ -253,6 +254,8 @@ impl AgentSpawner {
|
||||
if let Some((_, Some(ref trace))) = self.maybe_goal {
|
||||
g.draw_polygon(ui.cs.get("route"), &trace.make_polygons(LANE_THICKNESS));
|
||||
}
|
||||
|
||||
CommonState::draw_osd(g, ui);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user