summaryrefslogtreecommitdiffhomepage
path: root/editor/draw.cpp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2022-11-25 19:37:06 +0100
committerStanislaw Halik <sthalik@misaki.pl>2022-11-25 19:37:06 +0100
commite46dd0f45d1cab35c7441d72f5dcac83720cc539 (patch)
tree1611ed041680e6dcccb115cbc7c99e098b809d33 /editor/draw.cpp
parent1831d5d1eab5c9a607270a8a9b72a2ac1e6ce62a (diff)
add scenery horizontal mirroring
Diffstat (limited to 'editor/draw.cpp')
-rw-r--r--editor/draw.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/editor/draw.cpp b/editor/draw.cpp
index 17be7aeb..dd4cf96b 100644
--- a/editor/draw.cpp
+++ b/editor/draw.cpp
@@ -52,7 +52,11 @@ clickable_scenery* app::find_clickable_scenery(Vector2i pixel_)
for (clickable_scenery& c : array)
if (c.depth > depth && c.dest.contains(pixel))
{
- const auto pos = pixel - c.dest.min() + c.src.min();
+
+ const auto pos_ = pixel - c.dest.min() + c.src.min();
+ const auto pos = c.atlas.group(c.item.r).mirror_from.isEmpty()
+ ? pos_
+ : Vector2ui(c.src.sizeX() - pos_[0], pos_[1]);
const auto stride = c.atlas.info().pixel_size[0];
std::size_t idx = pos.y() * stride + pos.x();
fm_debug_assert(idx < c.bitmask.size());