Forbid item selection outside central box

This commit is contained in:
Nikita Lisitsa 2024-08-19 23:38:23 +03:00
parent 5df5369372
commit 8a98bf3c21

View file

@ -1485,12 +1485,13 @@ namespace gmtk
if (!view_transition_)
{
map_.world.apply<item const>([&](ecs::handle entity, item const & i)
{
auto box = geom::expand(geom::box<float, 2>::singleton(position(map_.world, i)), scale(map_.world, i) / 9.f);
if (geom::contains(box, mouse_world_))
selected_item_ = entity;
});
if (geom::contains(geom::shrink(view_box_[0], (view_box_[0].length() - view_box_[1].length()) / 2.f), mouse_world_[0]))
map_.world.apply<item const>([&](ecs::handle entity, item const & i)
{
auto box = geom::expand(geom::box<float, 2>::singleton(position(map_.world, i)), scale(map_.world, i) / 9.f);
if (geom::contains(box, mouse_world_))
selected_item_ = entity;
});
if (selected_item_ && item_killing_spree_)
{