summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKen D'Ambrosio <ken.dambrosio@constantcontact.com>2026-06-05 08:56:04 -0400
committerKen D'Ambrosio <ken.dambrosio@constantcontact.com>2026-06-05 08:56:04 -0400
commit92a31b84bf3731a40b745480b390239be03ba361 (patch)
tree7e49d0d53971296b13cb5285c0f9d961285d5cc5
parentb5b34b4bb9429d739cdeaf88d74fb18f9632e138 (diff)
Fix flipped-sprite draw offset (right-facing sheep unclickable)master
The flip clip rect (-tile_w, 0, tile_w, tile_h) mapped to device x [dest_x+tile_w, dest_x+2*tile_w] — one tile_w off to the right — so the visual and the input hit-box didn't overlap for right-facing sheep. Correct clip is (0, 0, tile_w, tile_h) with source offset -sx/-sy. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
-rw-r--r--esheep.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/esheep.py b/esheep.py
index cf2d670..29e03d2 100644
--- a/esheep.py
+++ b/esheep.py
@@ -699,9 +699,9 @@ def draw_frame(cr: cairo.Context, surface: cairo.ImageSurface,
if flip:
cr.translate(dest_x + tile_w, dest_y)
cr.scale(-1, 1)
- cr.rectangle(-tile_w, 0, tile_w, tile_h)
+ cr.rectangle(0, 0, tile_w, tile_h)
cr.clip()
- cr.set_source_surface(surface, -tile_w - sx, -sy)
+ cr.set_source_surface(surface, -sx, -sy)
else:
cr.translate(dest_x, dest_y)
cr.rectangle(0, 0, tile_w, tile_h)