From b6bc5d9b2c4fdb5b49042a98541e6f9758debe66 Mon Sep 17 00:00:00 2001 From: rodri Date: Fri, 15 Sep 2023 15:56:10 +0000 Subject: draw the game's title. --- bts.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'bts.c') 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; @@ -251,6 +253,14 @@ drawboard(Image *dst, Board *b) drawtile(dst, b, Pt2(i,j,1), b->map[i][j]); } +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) { @@ -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(); -- cgit v1.2.3