diff options
author | rodri <rgl@antares-labs.eu> | 2021-08-04 19:56:44 +0000 |
---|---|---|
committer | rodri <rgl@antares-labs.eu> | 2021-08-04 19:56:44 +0000 |
commit | bad1338d12dce1c8d9a3a2cf6b16476cd910e6f7 (patch) | |
tree | a9c9177a5a7b0eafbeb37c7c840f2315abfa419d | |
parent | 854f2430801958cdbd14c86715814a9d9a097ac4 (diff) | |
download | musw-bad1338d12dce1c8d9a3a2cf6b16476cd910e6f7.tar.gz musw-bad1338d12dce1c8d9a3a2cf6b16476cd910e6f7.tar.bz2 musw-bad1338d12dce1c8d9a3a2cf6b16476cd910e6f7.zip |
add a default sky map from fourmilab.ch.
-rw-r--r-- | musw.c | 23 |
1 files changed, 22 insertions, 1 deletions
@@ -40,6 +40,7 @@ RFrame screenrf; Ball bouncer; Universe *universe; VModel *needlemdl; +Image *skymap; Channel *kchan; char winspec[32]; int debug; @@ -255,11 +256,29 @@ threadresize(void *arg) } 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); |