aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--musw.c23
1 files changed, 22 insertions, 1 deletions
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;
@@ -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);