Better cards & belts UX

This commit is contained in:
Nikita Lisitsa 2024-08-20 12:04:17 +03:00
parent b0628fbce6
commit 7d64f80c87

View file

@ -1247,6 +1247,9 @@ namespace gmtk
break;
}
if (built)
active_card_ = std::nullopt;
if (built && tutorial_state_ <= 3)
tutorial_state_ = 4;
}
@ -1781,6 +1784,31 @@ namespace gmtk
color = {255, 128, 128, 255};
}
draw_selection(selected_->bbox(), painter_, color);
if (belt_start_)
{
auto d = selected_->coords - belt_start_->coords;
if (selected_->level == belt_start_->level && std::abs(d[0]) + std::abs(d[1]) == 1)
{
gfx::color_rgba c{224, 224, 224, 255};
location p0 = belt_start_->down();
location p1 = p0.moved(d);
sink(map_.world, p0, p1);
auto e0 = map_.world.index<path_index>().get(p0);
auto e1 = map_.world.index<path_index>().get(p1);
if (map_.world.get(e0).get<path_vertex>().belts_to.contains(e1))
c = {244, 160, 160, 255};
else if (map_.world.get(e0).get<path_vertex>().belts_from.contains(e1))
c = {244, 244, 160, 255};
float w = 0.25f * std::pow(3.f, 1.f - selected_->level) / 2.f;
painter_.line(selected_->center(), belt_start_->center(), w, c, true);
}
}
}
if (belt_start_)