shithub: battleship

Download patch

ref: 39d20fdc8507e927900358d37392efcbb50f874d
parent: 68cfdc52fa2daecdd2b4db02fe5f117a4e2329f6
author: rodri <rgl@antares-labs.eu>
date: Thu Aug 31 10:44:14 EDT 2023

show the board labels.

--- a/bts.c
+++ b/bts.c
@@ -175,6 +175,19 @@
 	layoutdone = 0;
 }
 
+Point
+vstring(Image *dst, Point p, Image *src, Point sp, Font *f, char *s)
+{
+	char buf[2];
+	buf[1] = 0;
+	while(*s){
+		buf[0] = *s++;
+		string(dst, p, src, sp, f, buf);
+		p.y += font->height;
+	}
+	return p;
+}
+
 Image *
 gettileimage(int type)
 {
@@ -256,6 +269,14 @@
 		return;
 	p = Pt(SCRW/2 - stringwidth(font, s)/2, 0);
 	string(dst, p, display->white, ZP, font, s);
+
+	s = "TARGET";
+	p = subpt(alienboard.bbox.min, Pt(font->width+2,0));
+	vstring(dst, p, display->white, ZP, font, s);
+
+	s = "LOCAL";
+	p = Pt(localboard.bbox.max.x+2, localboard.bbox.min.y);
+	vstring(dst, p, display->white, ZP, font, s);
 
 	if(game.state == Outlaying){
 		if(c == nil)