shithub: puzzles

Download patch

ref: 8698b75afca8c60bac6ab8b9f4b93f814497154c
parent: d35e4b88e85d9bb4f677083c0808b02f51620c2f
author: sirjofri <sirjofri@sirjofri.de>
date: Mon May 27 12:50:42 EDT 2024

supports BLITTER_FROMSAVED

--- a/plan9.c
+++ b/plan9.c
@@ -70,6 +70,7 @@
 
 struct blitter {
 	Image *blimg;
+	Point pos;
 };
 
 frontend *fe = nil;
@@ -340,6 +341,7 @@
 p9_blitter_save(void *handle, blitter *bl, int x, int y)
 {
 	USED(handle);
+	bl->pos = Pt(x, y);
 	draw(bl->blimg, Rect(x, y, x + bl->blimg->r.max.x, y + bl->blimg->r.max.y), screen, nil, Pt(x, y));
 }
 
@@ -347,6 +349,10 @@
 p9_blitter_load(void *handle, blitter *bl, int x, int y)
 {
 	USED(handle);
+	if (x == BLITTER_FROMSAVED)
+		x = bl->pos.x;
+	if (y == BLITTER_FROMSAVED)
+		y = bl->pos.y;
 	draw(screen, Rect(x, y, x + bl->blimg->r.max.x, y + bl->blimg->r.max.y), bl->blimg, nil, Pt(x, y));
 }