shithub: scoundrel

Download patch

ref: 85fb5d1f72305d96696389852cb7ca22ec810af1
parent: 322545c522db8bcf396d98e437f84b033125a721
author: sirjofri <sirjofri@sirjofri.de>
date: Mon Feb 16 16:21:52 EST 2026

better card placement

--- a/main.c
+++ b/main.c
@@ -24,6 +24,7 @@
 Point carddim;
 Rectangle roomrects[4];
 Rectangle weaponrect;
+int panelstart;
 
 static void
 drawroom(int *cards)
@@ -38,8 +39,8 @@
 		img = getimage(cards[i]);
 		if (!img)
 			sysfatal("%r");
-		p.x = i * Dx(img->r);
-		p.y = 0;
+		p.x = panelstart + i * (Dx(img->r) + 5);
+		p.y = 5;
 		p = addpt(p, screen->r.min);
 		roomrects[i] = rectaddpt(img->r, p);
 		draw(screen, roomrects[i], img, nil, ZP);
@@ -61,15 +62,15 @@
 	if (!img)
 		sysfatal("%r");
 	
-	p.x = 0;
-	p.y = Dy(img->r);
+	p.x = panelstart;
+	p.y = Dy(img->r) + 10;
 	p = addpt(p, screen->r.min);
 	weaponrect = rectaddpt(img->r, p);
 	draw(screen, weaponrect, img, nil, ZP);
 	
 	if (useweapon) {
-		p.x = Dx(img->r)+10;
-		p.y = Dy(img->r) + 10;
+		p.x = panelstart + Dx(img->r) + 20;
+		p.y = Dy(img->r) + 20;
 		p = addpt(p, screen->r.min);
 		line(screen, p, Pt(p.x, p.y + Dy(img->r) - 20),
 			Enddisc, Enddisc, 4, display->black, ZP);
@@ -82,8 +83,8 @@
 	if (!img)
 		sysfatal("%r");
 	
-	p.x = 0;
-	p.y = Dy(img->r) + 30;
+	p.x = panelstart + 5;
+	p.y = Dy(img->r) + 10 + 45;
 	p = addpt(p, screen->r.min);
 	draw(screen, rectaddpt(img->r, p), img, nil, ZP);
 }
@@ -94,7 +95,8 @@
 	Point p;
 	char s[64];
 	
-	p.x = carddim.x + 100;
+	p.x = panelstart;
+	p.x += carddim.x + 100;
 	p.y = carddim.y + 40;
 	p = addpt(p, screen->r.min);
 	
@@ -147,6 +149,7 @@
 	
 	state = getstate();
 	
+	panelstart = (Dx(screen->r) - (carddim.x+5)*4)/2;
 	drawroom(state->room);
 	drawweapon(state->weapon, state->lastweaponkill);
 	drawstats(state);
--