aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrodri <rgl@antares-labs.eu>2023-08-31 14:44:14 +0000
committerrodri <rgl@antares-labs.eu>2023-08-31 14:44:14 +0000
commit39d20fdc8507e927900358d37392efcbb50f874d (patch)
tree714e5e5848407d99a1b9b68aa6aea5d6fe64b8d8
parent68cfdc52fa2daecdd2b4db02fe5f117a4e2329f6 (diff)
downloadbattleship-39d20fdc8507e927900358d37392efcbb50f874d.tar.gz
battleship-39d20fdc8507e927900358d37392efcbb50f874d.tar.bz2
battleship-39d20fdc8507e927900358d37392efcbb50f874d.zip
show the board labels.
-rw-r--r--bts.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/bts.c b/bts.c
index 1a6478e..9b2b84f 100644
--- a/bts.c
+++ b/bts.c
@@ -175,6 +175,19 @@ resetgame(void)
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)
{
@@ -257,6 +270,14 @@ drawinfo(Image *dst)
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)
c = eallocimage(display, Rect(0,0,1,1), screen->chan, 1, DYellow);