X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=hacks%2Fsphere.c;h=d35720e9e66d21ee3b89513f15c257bd5d0814a5;hb=39809ded547bdbb08207d3e514950425215b4410;hp=2323eb6eaf630725e47b2a4c43e2667247ea34b1;hpb=96a411663168b0ba5432b407a83be55f3df0c802;p=xscreensaver diff --git a/hacks/sphere.c b/hacks/sphere.c index 2323eb6e..d35720e9 100644 --- a/hacks/sphere.c +++ b/hacks/sphere.c @@ -57,30 +57,31 @@ static const char sccsid[] = "@(#)sphere.c 5.00 2000/11/01 xlockmore"; */ #ifdef STANDALONE -#define MODE_sphere -#define PROGCLASS "Sphere" -#define HACK_INIT init_sphere -#define HACK_DRAW draw_sphere -#define sphere_opts xlockmore_opts -#define DEFAULTS "*delay: 1000 \n" \ - "*cycles: 20 \n" \ - "*size: 0 \n" \ - "*ncolors: 64 \n" -#define BRIGHT_COLORS -#include "xlockmore.h" /* from the xscreensaver distribution */ +# define MODE_sphere +#define DEFAULTS "*delay: 20000 \n" \ + "*cycles: 20 \n" \ + "*size: 0 \n" \ + "*ncolors: 64 \n" \ + "*fpsSolid: true \n" \ + +# define BRIGHT_COLORS +# define release_sphere 0 +# define reshape_sphere 0 +# define sphere_handle_event 0 +# include "xlockmore.h" /* from the xscreensaver distribution */ #else /* !STANDALONE */ -#include "xlock.h" /* from the xlockmore distribution */ +# include "xlock.h" /* from the xlockmore distribution */ #endif /* !STANDALONE */ #ifdef MODE_sphere -ModeSpecOpt sphere_opts = +ENTRYPOINT ModeSpecOpt sphere_opts = {0, (XrmOptionDescRec *) NULL, 0, (argtype *) NULL, (OptionStruct *) NULL}; #ifdef USE_MODULES ModStruct sphere_description = -{"sphere", "init_sphere", "draw_sphere", "release_sphere", - "refresh_sphere", "init_sphere", (char *) NULL, &sphere_opts, +{"sphere", "init_sphere", "draw_sphere", (char *) NULL, + "refresh_sphere", "init_sphere", "free_sphere", &sphere_opts, 5000, 1, 20, 0, 64, 1.0, "", "Shows a bunch of shaded spheres", 0, NULL}; @@ -110,16 +111,12 @@ typedef struct { static spherestruct *spheres = (spherestruct *) NULL; -void +ENTRYPOINT void init_sphere(ModeInfo * mi) { spherestruct *sp; - if (spheres == NULL) { - if ((spheres = (spherestruct *) calloc(MI_NUM_SCREENS(mi), - sizeof (spherestruct))) == NULL) - return; - } + MI_INIT (mi, spheres); sp = &spheres[MI_SCREEN(mi)]; if (sp->points != NULL) { @@ -141,7 +138,7 @@ init_sphere(ModeInfo * mi) sp->shadowy = (LRAND() & 1) ? 1 : -1; } -void +ENTRYPOINT void draw_sphere(ModeInfo * mi) { Display *display = MI_DISPLAY(mi); @@ -270,26 +267,23 @@ draw_sphere(ModeInfo * mi) } } -void -release_sphere(ModeInfo * mi) +ENTRYPOINT void +free_sphere(ModeInfo * mi) { - if (spheres != NULL) { - int screen; + spherestruct *sp; - for (screen = 0; screen < MI_NUM_SCREENS(mi); screen++) { - spherestruct *sp = &spheres[screen]; + if (spheres == NULL) + return; + sp = &spheres[MI_SCREEN(mi)]; - if (sp->points) { - (void) free((void *) sp->points); - /* sp->points = NULL; */ - } - } - (void) free((void *) spheres); - spheres = (spherestruct *) NULL; + if (sp->points) { + (void) free((void *) sp->points); + /* sp->points = NULL; */ } } -void +#ifndef STANDALONE +ENTRYPOINT void refresh_sphere(ModeInfo * mi) { spherestruct *sp; @@ -302,5 +296,8 @@ refresh_sphere(ModeInfo * mi) sp->x = -sp->radius; } +#endif + +XSCREENSAVER_MODULE ("Sphere", sphere) #endif /* MODE_sphere */