aboutsummaryrefslogtreecommitdiff
path: root/bts.c
diff options
context:
space:
mode:
authorrodri <rgl@antares-labs.eu>2023-09-15 15:56:10 +0000
committerrodri <rgl@antares-labs.eu>2023-09-15 15:56:10 +0000
commitb6bc5d9b2c4fdb5b49042a98541e6f9758debe66 (patch)
treef0c45eaa90f168e46e232cb3927074504b0f3047 /bts.c
parentf343924623cdddc0037bdad31adaf593ab8c2719 (diff)
downloadbattleship-b6bc5d9b2c4fdb5b49042a98541e6f9758debe66.tar.gz
battleship-b6bc5d9b2c4fdb5b49042a98541e6f9758debe66.tar.bz2
battleship-b6bc5d9b2c4fdb5b49042a98541e6f9758debe66.zip
draw the game's title.
Diffstat (limited to 'bts.c')
-rw-r--r--bts.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/bts.c b/bts.c
index 380336d..0b9911e 100644
--- a/bts.c
+++ b/bts.c
@@ -64,6 +64,8 @@ Cursor aimcursor = {
}
};
char deffont[] = "/lib/font/bit/pelm/unicode.9.font";
+char titlefontpath[] = "assets/font/gunmetal/gunmetal.48.font";
+Font *titlefont;
char winspec[32];
char uid[8+1], oid[8+1];
Channel *drawchan;
@@ -252,6 +254,14 @@ drawboard(Image *dst, Board *b)
}
void
+drawtitle(Image *dst)
+{
+ static char s[] = "BATTLESHIP";
+
+ string(dst, Pt(SCRW/2 - stringwidth(titlefont, s)/2, 0), display->white, ZP, titlefont, s);
+}
+
+void
drawgameoptions(Image *dst)
{
static char s[] = "press p to play, w to watch";
@@ -327,6 +337,7 @@ redraw(void)
draw(screenb, screenb->r, display->black, nil, ZP);
switch(game.state){
case Waiting0:
+ drawtitle(screenb);
drawgameoptions(screenb);
break;
default:
@@ -879,6 +890,10 @@ threadmain(int argc, char *argv[])
worldrf.bx = Vec2(1,0);
worldrf.by = Vec2(0,1);
+ titlefont = openfont(display, titlefontpath);
+ if(titlefont == nil)
+ sysfatal("openfont: %r");
+
inittiles();
initboards();
initarmada();