diff options
-rw-r--r-- | dat.h | 9 | ||||
-rw-r--r-- | lobby.c | 4 | ||||
-rw-r--r-- | musw.c | 15 | ||||
-rw-r--r-- | muswd.c | 2 | ||||
-rw-r--r-- | notes | 17 | ||||
-rw-r--r-- | physics.c | 2 |
6 files changed, 44 insertions, 5 deletions
@@ -16,6 +16,13 @@ typedef enum WEDGE } Kind; +enum { + SCRW = 640, + SCRH = 480, + SCRWB = SCRW+2*Borderwidth, + SCRHB = SCRH+2*Borderwidth +}; + typedef struct Vector Vector; typedef struct VModel VModel; typedef struct Sprite Sprite; @@ -126,7 +133,7 @@ struct Lobby int (*takeseat)(Lobby*, char*, int, int); int (*leaveseat)(Lobby*, ulong); int (*getcouple)(Lobby*, Player*); - void (*healthcheck)(Lobby*); + void (*purge)(Lobby*); }; struct Party @@ -51,7 +51,7 @@ lobby_getcouple(Lobby *l, Player *couple) } static void -lobby_healthcheck(Lobby *l) +lobby_purge(Lobby *l) { char status[48], buf[16]; int i, fd; @@ -86,7 +86,7 @@ newlobby(void) l->takeseat = lobby_takeseat; l->getcouple = lobby_getcouple; l->leaveseat = lobby_leaveseat; - l->healthcheck = lobby_healthcheck; + l->purge = lobby_purge; return l; } @@ -35,6 +35,7 @@ struct Ball }; Ball bouncer; +char winspec[32]; int debug; @@ -142,6 +143,8 @@ redraw(void) void resize(void) { + int fd; + if(debug) fprint(2, "resizing\n"); @@ -149,6 +152,15 @@ resize(void) if(getwindow(display, Refnone) < 0) sysfatal("resize failed"); unlockdisplay(display); + + if(Dx(screen->r) != SCRW || Dy(screen->r) != SCRH){ + fd = open("/dev/wctl", OWRITE); + if(fd >= 0){ + fprint(fd, "resize %s", winspec); + close(fd); + } + } + redraw(); } @@ -178,7 +190,8 @@ threadmain(int argc, char *argv[]) usage(); server = argv[0]; - if(newwindow("-dx 640 -dy 480") < 0) + snprint(winspec, sizeof winspec, "-dx %d -dy %d", SCRWB, SCRHB); + if(newwindow(winspec) < 0) sysfatal("newwindow: %r"); if(initdraw(nil, nil, nil) < 0) sysfatal("initdraw: %r"); @@ -107,7 +107,7 @@ threadsim(void *) io = ioproc(); for(;;){ - lobby->healthcheck(lobby); + lobby->purge(lobby); if(lobby->getcouple(lobby, couple) != -1){ newparty(couple); @@ -0,0 +1,17 @@ +• there's, at most, two players waiting in the lobby at a given time. +it makes no sense to allocate more than two seats since the threadsim +will consume them whenever they are ready to join the party. i'm +thinking of using channels to synchronize the two threads, so +threadsim doesn't loop doing nothing (but sleeping) until at least a +couple of players join. + +• the integrator has to operate with vectors and the different objects +in the universe, some of which may require their own governing laws. + +• think of a way to pack the bullets efficiently. will they be part +of the global state broadcast? what does the client need to know to +render and manage them? + +• it could be beneficial to do dynamics in the client as well, which +means sending more data, and probably require a tighter sync, but a +smoother user experience. @@ -4,6 +4,8 @@ #include "dat.h" #include "fns.h" +static double G = 6.674e-11; + /* * Dynamics stepper */ |