mirror of
https://github.com/a-b-street/abstreet.git
synced 2024-11-28 12:12:00 +03:00
add color to the time panel
This commit is contained in:
parent
bf8c35788b
commit
6d32db9865
@ -57,7 +57,7 @@ You can skip this section if you're just touching code in `game`, `ezgui`, and
|
||||
You have two options: you can seed some of the intermediate data by running
|
||||
`./data/grab_all_seed_data.sh` (downloads ~1GB, expands to ~5GB), or you can
|
||||
build everything totally from scratch by running
|
||||
`./import.sh --osm --map --scenario`. This takes a while.
|
||||
`./import.sh --raw --map --scenario`. This takes a while.
|
||||
|
||||
You'll need some extra dependencies:
|
||||
|
||||
@ -68,7 +68,7 @@ You'll need some extra dependencies:
|
||||
You can rerun specific stages of the importer:
|
||||
|
||||
- If you're modifying the initial OSM data -> RawMap conversion in
|
||||
`convert_osm`, you need `./import.sh --osm --map`.
|
||||
`convert_osm`, you need `./import.sh --raw --map`.
|
||||
- If you're modifying `map_model` but not the OSM -> RawMap conversion, then you
|
||||
just need `./import.sh --map`.
|
||||
- By default, all maps are regenerated. You can also specify a single map:
|
||||
|
@ -609,17 +609,37 @@ impl TimePanel {
|
||||
// This is manually tuned
|
||||
let width = 300.0;
|
||||
let height = 15.0;
|
||||
// Just clamp past 24 hours
|
||||
let percent = app.primary.sim.time().to_percent(Time::END_OF_DAY).min(1.0);
|
||||
let mut percent = app.primary.sim.time().to_percent(Time::END_OF_DAY);
|
||||
|
||||
// TODO rounded
|
||||
batch.push(Color::WHITE, Polygon::rectangle(width, height));
|
||||
if percent != 0.0 {
|
||||
|
||||
// Midnight to sunrise
|
||||
if percent > 0.0 {
|
||||
batch.push(
|
||||
colors::SECTION_BG,
|
||||
Polygon::rectangle(percent * width, height),
|
||||
app.cs.get_def("night time", Color::hex("#12409D")),
|
||||
Polygon::rectangle(percent.min(0.25) * width, height),
|
||||
);
|
||||
}
|
||||
percent -= 0.25;
|
||||
// Daytime
|
||||
if percent > 0.0 {
|
||||
batch.push(
|
||||
app.cs.get_def("day time", Color::hex("#F4DA22")),
|
||||
Polygon::rectangle(percent.min(0.5) * width, height)
|
||||
.translate(0.25 * width, 0.0),
|
||||
);
|
||||
}
|
||||
percent -= 0.5;
|
||||
// Sunset to midnight
|
||||
if percent > 0.0 {
|
||||
// Just clamp past 24 hours
|
||||
batch.push(
|
||||
app.cs.get("night time"),
|
||||
Polygon::rectangle(percent.min(0.25) * width, height)
|
||||
.translate(0.75 * width, 0.0),
|
||||
);
|
||||
}
|
||||
|
||||
Widget::draw_batch(ctx, batch)
|
||||
},
|
||||
Widget::row(vec![
|
||||
|
Loading…
Reference in New Issue
Block a user