UX tweaks

This commit is contained in:
Nikita Lisitsa 2024-08-19 15:17:19 +03:00
parent b22005ff54
commit 7034b2bde2

View file

@ -898,7 +898,8 @@ namespace gmtk
{
if (event.down && event.button == app::mouse_button::left)
{
lmb_down_ = true;
if (selected_item_)
item_killing_spree_ = true;
if (!selected_item_ && selected_ && !belt_start_)
{
@ -908,7 +909,7 @@ namespace gmtk
if (!event.down && event.button == app::mouse_button::left)
{
lmb_down_ = false;
item_killing_spree_ = false;
if (selected_ && belt_start_ && selected_->level == belt_start_->level)
{
@ -1316,7 +1317,7 @@ namespace gmtk
selected_item_ = entity;
});
if (selected_item_ && lmb_down_)
if (selected_item_ && item_killing_spree_)
{
auto const & i = map_.world.get(*selected_item_).get<item const>();
if (i.target)
@ -1383,7 +1384,16 @@ namespace gmtk
draw_grids(map_, view_level, painter_);
if (selected_)
draw_selection(*selected_, painter_, {128, 128, 128, 255});
{
gfx::color_rgba color = {128, 128, 128, 255};
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)
color = {255, 128, 128, 255};
}
draw_selection(*selected_, painter_, color);
}
if (belt_start_)
draw_selection(*belt_start_, painter_, {64, 64, 64, 255});
@ -1491,7 +1501,7 @@ namespace gmtk
geom::vector<int, 2> screen_size_{1, 1};
geom::point<int, 2> mouse_{0, 0};
bool lmb_down_ = false;
bool item_killing_spree_ = false;
gfx::painter painter_;