svg parking icons

This commit is contained in:
Dustin Carlino 2020-01-12 09:20:54 -08:00
parent 179a562178
commit de1c481c93
4 changed files with 23 additions and 27 deletions

View File

@ -0,0 +1,4 @@
<svg width="128" height="128" viewBox="0 0 128 128" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M113.827 0H14.1732C6.34557 0 0 6.34557 0 14.1732V113.827C0 121.654 6.34557 128 14.1732 128H113.827C121.654 128 128 121.654 128 113.827V14.1732C128 6.34557 121.654 0 113.827 0Z" fill="#204A87"/>
<path d="M23.5209 11.5117H68.4506C81.8099 11.5118 92.052 14.4884 99.1771 20.4414C106.349 26.3477 109.935 34.7852 109.935 45.7539C109.935 56.7696 106.349 65.254 99.1771 71.207C92.052 77.1133 81.8099 80.0664 68.4506 80.0664H50.5912V116.488H23.5209V11.5117ZM50.5912 31.1289V60.4492H65.5677C70.8177 60.4493 74.8724 59.1837 77.7318 56.6523C80.5911 54.0743 82.0208 50.4415 82.0209 45.7539C82.0208 41.0665 80.5911 37.4571 77.7318 34.9258C74.8724 32.3946 70.8177 31.129 65.5677 31.1289H50.5912Z" fill="white"/>
</svg>

After

Width:  |  Height:  |  Size: 813 B

View File

@ -54,7 +54,12 @@ pub fn edit_map_panel(ctx: &mut EventCtx, ui: &UI, gameplay: GameplayMode) -> Co
ManagedWidget::draw_text(ctx, Text::from(Line(ui.primary.map.get_name()))),
]),
ManagedWidget::col(vec![
Composite::svg_button(ctx, "assets/tools/edit_map.svg", "edit map", lctrl(Key::E)),
Composite::svg_button(
ctx,
"assets/tools/edit_map.svg",
"edit map",
lctrl(Key::E),
),
{
let edits = ui.primary.map.get_edits();
let mut txt = Text::from(Line(&edits.edits_name));

View File

@ -1,7 +1,7 @@
use crate::helpers::{ColorScheme, ID};
use crate::render::{DrawCtx, DrawOptions, Renderable, OUTLINE_THICKNESS};
use ezgui::{Color, GeomBatch, GfxCtx, Line, Text};
use geom::{Circle, Distance, Line, Polygon, Pt2D};
use geom::{Angle, Distance, Line, Polygon, Pt2D};
use map_model::{Building, BuildingID, Map, LANE_THICKNESS};
pub struct DrawBuilding {
@ -45,30 +45,12 @@ impl DrawBuilding {
.map(|num| Text::from(Line(num.to_string()).fg(Color::BLACK).size(50)));
if bldg.parking.is_some() {
let center = bldg.label_center;
batch.push(
cs.get_def("parking icon background", Color::BLACK),
Circle::new(center, Distance::meters(5.0)).to_polygon(),
);
// Draw a 'P'
// TODO The result here looks pretty bad and is quite tedious to define. Figure out a
// reasonable way to import SVG sprites. Still need to programatically fill up the
// circle with color, though.
batch.push(
cs.get_def("parking icon foreground", Color::WHITE),
Polygon::rectangle_centered(
center.offset(-1.0, 0.0),
Distance::meters(1.5),
Distance::meters(4.5),
),
);
batch.push(
cs.get("parking icon foreground"),
Circle::new(center.offset(0.5, -0.5), Distance::meters(1.5)).to_polygon(),
);
batch.push(
cs.get("parking icon background"),
Circle::new(center.offset(0.5, -0.5), Distance::meters(0.5)).to_polygon(),
// Might need to scale down more for some buildings, but so far, this works everywhere.
batch.add_svg(
"assets/map/parking.svg",
bldg.label_center,
0.1,
Angle::ZERO,
);
}

View File

@ -89,7 +89,12 @@ pub fn freeform_controller(
]),
// TODO Refactor
ManagedWidget::col(vec![
Composite::svg_button(ctx, "assets/tools/edit_map.svg", "edit map", lctrl(Key::E)),
Composite::svg_button(
ctx,
"assets/tools/edit_map.svg",
"edit map",
lctrl(Key::E),
),
{
let edits = ui.primary.map.get_edits();
let mut txt = Text::from(Line(&edits.edits_name));