X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=hacks%2Fpenetrate.c;h=a58efa21b3bf5883be211667114b98b895b2023b;hb=39809ded547bdbb08207d3e514950425215b4410;hp=89eb777d2bfbd6119ec97444fbaafd71f317b13f;hpb=49f5b54f312fe4ac2e9bc47581a72451bd0e8439;p=xscreensaver diff --git a/hacks/penetrate.c b/hacks/penetrate.c index 89eb777d..a58efa21 100644 --- a/hacks/penetrate.c +++ b/hacks/penetrate.c @@ -172,10 +172,11 @@ static void launch (struct state *st, int xlim, int ylim, int src) m->splits = 0; if (m->jenis < 50) { int j = ylim * 0.4; - if (j) + if (j) { m->splits = random() % j; if (m->splits < ylim * 0.08) m->splits = 0; + } } /* special if we're from another missile */ @@ -365,8 +366,8 @@ penetrate_init (Display *dpy, Window window) { struct state *st = (struct state *) calloc (1, sizeof(*st)); int i; - /*char *fontname = "-*-new century schoolbook-*-r-*-*-*-380-*-*-*-*-*-*"; */ - char *fontname = "-*-courier-*-r-*-*-*-380-*-*-*-*-*-*"; + const char *levelfont = "-*-courier-*-r-*-*-*-380-*-*-*-*-*-*"; + const char *scorefont = "-*-helvetica-*-r-*-*-*-180-*-*-*-*-*-*"; XGCValues gcv; XWindowAttributes xgwa; @@ -387,14 +388,23 @@ penetrate_init (Display *dpy, Window window) if (st->lrate < 0) st->lrate = 2; st->startlrate = st->lrate; - if (!fontname || !*fontname) - fprintf (stderr, "%s: no font specified.\n", progname); - st->font = XLoadQueryFont(st->dpy, fontname); - if (!st->font) - fprintf (stderr, "%s: could not load font %s.\n", progname, fontname); + st->font = XLoadQueryFont(st->dpy, levelfont); + if (!st->font) { + fprintf (stderr, "%s: could not load font %s.\n", progname, levelfont); + st->font = XLoadQueryFont(st->dpy, scorefont); + if (! st->font) + st->font = XLoadQueryFont(st->dpy, "fixed"); + if (! st->font) abort(); + } - if (!(st->scoreFont = XLoadQueryFont(st->dpy, "-*-times-*-r-*-*-*-180-*-*-*-*-*-*"))) - fprintf(stderr, "%s: Can't load Times font.", progname); + st->scoreFont = XLoadQueryFont(st->dpy, scorefont); + if (!st->scoreFont) { + fprintf (stderr, "%s: could not load font %s.\n", progname, scorefont); + st->scoreFont = XLoadQueryFont(st->dpy, levelfont); + if (! st->scoreFont) + st->scoreFont = XLoadQueryFont(st->dpy, "fixed"); + if (! st->scoreFont) abort(); + } for (i = 0; i < kMaxMissiles; i++) st->missile[i].alive = 0; @@ -427,7 +437,7 @@ penetrate_init (Display *dpy, Window window) gcv.foreground = get_pixel_resource(st->dpy, st->cmap, "background", "Background"); st->erase_gc = XCreateGC(st->dpy, st->window, GCForeground, &gcv); -# ifdef HAVE_COCOA +# ifdef HAVE_JWXYZ jwxyz_XSetAntiAliasing (st->dpy, st->erase_gc, False); jwxyz_XSetAntiAliasing (st->dpy, st->draw_gc, False); # endif @@ -940,6 +950,7 @@ static void penetrate_reshape (Display *dpy, Window window, void *closure, unsigned int w, unsigned int h) { + XClearWindow (dpy, window); } static Bool @@ -957,12 +968,14 @@ penetrate_free (Display *dpy, Window window, void *closure) static const char *penetrate_defaults [] = { + ".lowrez: true", ".background: black", ".foreground: white", + "*fpsTop: true", + "*fpsSolid: true", "*bgrowth: 5", "*lrate: 80", "*smart: False", - "*geometry: 800x500", 0 };