From bad1338d12dce1c8d9a3a2cf6b16476cd910e6f7 Mon Sep 17 00:00:00 2001 From: rodri Date: Wed, 4 Aug 2021 19:56:44 +0000 Subject: add a default sky map from fourmilab.ch. --- musw.c | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/musw.c b/musw.c index 6b42bf7..e0f031b 100644 --- a/musw.c +++ b/musw.c @@ -40,6 +40,7 @@ RFrame screenrf; Ball bouncer; Universe *universe; VModel *needlemdl; +Image *skymap; Channel *kchan; char winspec[32]; int debug; @@ -254,12 +255,30 @@ threadresize(void *arg) resize(); } +void +initskymap(void) +{ + int fd; + + fd = open("assets/bg/defskymap.pic", OREAD); + if(fd < 0) + goto darkness; + + skymap = readimage(display, fd, 1); + if(skymap == nil){ +darkness: + fprint(2, "couldn't read a sky map. falling back to darkness...\n"); + skymap = display->black; + } + close(fd); +} + void redraw(void) { lockdisplay(display); - draw(screen, screen->r, display->black, nil, ZP); + draw(screen, screen->r, skymap, nil, ZP); fillellipse(screen, toscreen(bouncer.p), 2, 2, display->white, ZP); drawship(&universe->ships[0], screen); @@ -355,6 +374,8 @@ threadmain(int argc, char *argv[]) universe->ships[1].mdl = needlemdl; universe->star.spr = readsprite("assets/spr/earth.pic", ZP, Rect(0,0,32,32), 5, 20e3); + initskymap(); + threadcreate(threadnetrecv, &fd, 4096); threadcreate(threadnetsend, &fd, 4096); threadcreate(threadresize, mc, 4096); -- cgit v1.2.3