X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=hacks%2Fbouboule.c;h=e3379aa3c6e6c0d555a63cf3defb80973d7cbff6;hb=4361b69d3178d7fc98d0388f9a223af6c2651aba;hp=7e77e464bb10120d67b91b9b951e953723f1ede4;hpb=ce3185de9d9705e259f2b60dd4b5509007fa17d4;p=xscreensaver diff --git a/hacks/bouboule.c b/hacks/bouboule.c index 7e77e464..e3379aa3 100644 --- a/hacks/bouboule.c +++ b/hacks/bouboule.c @@ -19,9 +19,8 @@ * other special, indirect and consequential damages. */ -#if !defined( lint ) && !defined( SABER ) +#if 0 static const char sccsid[] = "@(#)bouboule.c 4.00 97/01/01 xlockmore"; - #endif /*- @@ -75,28 +74,29 @@ static const char sccsid[] = "@(#)bouboule.c 4.00 97/01/01 xlockmore"; */ #ifdef STANDALONE -# define PROGCLASS "Bouboule" -# define HACK_INIT init_bouboule -# define HACK_DRAW draw_bouboule -# define bouboule_opts xlockmore_opts # define DEFAULTS "*count: 100 \n" \ "*size: 15 \n" \ - "*delay: 5000 \n" \ + "*delay: 20000 \n" \ "*ncolors: 64 \n" \ - "*use3d: False \n" \ + "*use3d: True \n" \ "*delta3d: 1.5 \n" \ "*right3d: red \n" \ "*left3d: blue \n" \ "*both3d: magenta \n" \ - "*none3d: black \n" + "*none3d: black \n" \ + "*fpsSolid: true \n" \ + "*ignoreRotation: True \n" # define SMOOTH_COLORS +# define release_bouboule 0 +# define bouboule_handle_event 0 # include "xlockmore.h" /* from the xscreensaver distribution */ #else /* !STANDALONE */ # include "xlock.h" /* from the xlockmore distribution */ +# define ENTRYPOINT /**/ #endif /* !STANDALONE */ -ModeSpecOpt bouboule_opts = { +ENTRYPOINT ModeSpecOpt bouboule_opts = { 0, NULL, 0, NULL, NULL }; #define USEOLDXARCS 1 /* If 1, we use old xarcs list for erasing. @@ -298,8 +298,11 @@ sinfree(SinVariable * point) } } +static void free_bouboule(ModeInfo * mi); + + /***************/ -void +ENTRYPOINT void init_bouboule(ModeInfo * mi) /***************/ @@ -315,11 +318,7 @@ init_bouboule(ModeInfo * mi) int i; double theta, omega; - if (starfield == NULL) { - if ((starfield = (StarField *) calloc(MI_NUM_SCREENS(mi), - sizeof (StarField))) == NULL) - return; - } + MI_INIT (mi, starfield, free_bouboule); sp = &starfield[MI_SCREEN(mi)]; sp->width = MI_WIN_WIDTH(mi); @@ -529,7 +528,7 @@ init_bouboule(ModeInfo * mi) } /****************/ -void +ENTRYPOINT void draw_bouboule(ModeInfo * mi) /****************/ @@ -543,6 +542,10 @@ draw_bouboule(ModeInfo * mi) Star *star; XArc *arc = NULL, *arcleft = NULL; +#ifdef HAVE_JWXYZ /* Don't second-guess Quartz's double-buffering */ + XClearWindow(MI_DISPLAY(mi), MI_WINDOW(mi)); +#endif + #if (ADAPT_ERASE == 1) struct timeval tv1; struct timeval tv2; @@ -799,43 +802,55 @@ draw_bouboule(ModeInfo * mi) } } -void -release_bouboule(ModeInfo * mi) +static void +free_bouboule(ModeInfo * mi) { - if (starfield != NULL) { - int screen; - - for (screen = 0; screen < MI_NUM_SCREENS(mi); screen++) { - StarField *sp = &starfield[screen]; - - if (sp->star) - (void) free((void *) sp->star); - if (sp->xarc) - (void) free((void *) sp->xarc); - if (sp->xarcleft) - (void) free((void *) sp->xarcleft); + StarField *sp = &starfield[MI_SCREEN(mi)]; + + if (sp->star) + (void) free((void *) sp->star); + if (sp->xarc) + (void) free((void *) sp->xarc); + if (sp->xarcleft) + (void) free((void *) sp->xarcleft); #if ((USEOLDXARCS == 1) || (ADAPT_ERASE == 1)) - if (sp->oldxarc) - (void) free((void *) sp->oldxarc); - if (sp->oldxarcleft) - (void) free((void *) sp->oldxarcleft); + if (sp->oldxarc) + (void) free((void *) sp->oldxarc); + if (sp->oldxarcleft) + (void) free((void *) sp->oldxarcleft); #endif - sinfree(&(sp->x)); - sinfree(&(sp->y)); - sinfree(&(sp->z)); - sinfree(&(sp->sizex)); - sinfree(&(sp->sizey)); - sinfree(&(sp->thetax)); - sinfree(&(sp->thetay)); - sinfree(&(sp->thetaz)); - } - (void) free((void *) starfield); - starfield = NULL; - } + sinfree(&(sp->x)); + sinfree(&(sp->y)); + sinfree(&(sp->z)); + sinfree(&(sp->sizex)); + sinfree(&(sp->sizey)); + sinfree(&(sp->thetax)); + sinfree(&(sp->thetay)); + sinfree(&(sp->thetaz)); +} + +ENTRYPOINT void +reshape_bouboule(ModeInfo * mi, int width, int height) +{ + StarField *sp = &starfield[MI_SCREEN(mi)]; + sp->width = width; + sp->height = height; + sininit(&sp->x, + sp->x.alpha, sp->x.step, + ((double) sp->width) / 4.0, + 3.0 * ((double) sp->width) / 4.0, + POSCANRAND); + sininit(&sp->y, + sp->y.alpha, sp->y.step, + ((double) sp->height) / 4.0, + 3.0 * ((double) sp->height) / 4.0, + POSCANRAND); } -void +ENTRYPOINT void refresh_bouboule(ModeInfo * mi) { /* Do nothing, it will refresh by itself */ } + +XSCREENSAVER_MODULE ("Bouboule", bouboule)