temporary workarounds for the hackathon, will revert later

This commit is contained in:
Dustin Carlino 2019-11-23 12:03:23 -08:00
parent 10c291f7ed
commit 640fcae07e
4 changed files with 30 additions and 34 deletions

View File

@ -59,8 +59,8 @@ impl<'a> EventCtx<'a> {
.insert(filename.to_string(), fallback);
}
if textures.len() > 20 {
panic!("Due to lovely hacks, only 20 textures supported");
if textures.len() > 15 {
panic!("Due to lovely hacks, only 15 textures supported");
}
timer.start_iter("upload textures", textures.len());
for (idx, (filename, tex_type)) in textures.into_iter().enumerate() {

View File

@ -28,37 +28,32 @@ impl LaneEditor {
pub fn setup(ctx: &EventCtx) -> LaneEditor {
// TODO This won't handle resizing well
let mut x1 = 0.5 * ctx.canvas.window_width;
let mut make_brush =
|icon: &str,
label: &str,
key: Key,
apply: Box<dyn Fn(&Map, LaneID) -> Result<Option<EditCmd>, String>>| {
let btn = Button::icon_btn(
&format!("assets/ui/edit_{}.png", icon),
32.0,
label,
hotkey(key),
ctx,
)
.at(ScreenPt::new(x1, 0.0));
let enabled_btn = Button::icon_btn_bg(
&format!("assets/ui/edit_{}.png", icon),
32.0,
label,
hotkey(key),
Color::RED,
ctx,
)
let mut make_brush = |icon: &str,
label: &str,
key: Key,
apply: Box<
dyn Fn(&Map, LaneID) -> Result<Option<EditCmd>, String>,
>| {
let btn = Button::icon_btn("assets/ui/hamburger.png", 32.0, label, hotkey(key), ctx)
.at(ScreenPt::new(x1, 0.0));
let enabled_btn = Button::icon_btn_bg(
"assets/ui/hamburger.png",
32.0,
label,
hotkey(key),
Color::RED,
ctx,
)
.at(ScreenPt::new(x1, 0.0));
x1 += 70.0;
Paintbrush {
btn,
enabled_btn,
label: label.to_string(),
apply,
}
};
x1 += 70.0;
Paintbrush {
btn,
enabled_btn,
label: label.to_string(),
apply,
}
};
let brushes = vec![
make_brush(

View File

@ -25,12 +25,12 @@ impl UI {
let (primary, prebaked) = ctx.loading_screen("load map", |ctx, mut timer| {
// Always load some small icons.
let mut textures = vec![
("assets/ui/edit_bike.png", TextureType::Stretch),
/*("assets/ui/edit_bike.png", TextureType::Stretch),
("assets/ui/edit_bus.png", TextureType::Stretch),
("assets/ui/edit_construction.png", TextureType::Stretch),
("assets/ui/edit_contraflow.png", TextureType::Stretch),
("assets/ui/edit_driving.png", TextureType::Stretch),
("assets/ui/edit_parking.png", TextureType::Stretch),
("assets/ui/edit_parking.png", TextureType::Stretch),*/
("assets/ui/hamburger.png", TextureType::Stretch),
("assets/ui/hide.png", TextureType::Stretch),
("assets/ui/info.png", TextureType::Stretch),

View File

@ -156,7 +156,8 @@ impl IntersectionSimState {
}
}
} else {
unreachable!()
return;
//unreachable!()
};
for req in protected {