/* -*- Mode: C; tab-width: 4 -*- */
-/* lisa --- animated full-loop lisajous figures */
+/* lisa --- animated full-loop lissajous figures */
#if 0
static const char sccsid[] = "@(#)lisa.c 5.00 2000/11/01 xlockmore";
*
* The inspiration for this program, Lasp, was written by Adam B. Roach
* in 1990, assisted by me, Caleb Cullen. It was written first in C, then
- * in assembly, and used pre-calculated data tables to graph lisajous
+ * in assembly, and used pre-calculated data tables to graph lissajous
* figures on 386 machines and lower. This version bears only superficial
* resemblances to the original Lasp.
*
# define DEFAULTS "*delay: 17000 \n" \
"*count: 1 \n" \
"*cycles: 768 \n" \
- "*size: -1 \n" \
- "*ncolors: 64 \n"
+ "*size: 500 \n" \
+ "*ncolors: 64 \n" \
+ "*fpsSolid: true \n" \
+ "*lowrez: True \n" \
+
# define UNIFORM_COLORS
+# define release_lisa 0
# define reshape_lisa 0
-# define lisa_handle_event 0
+# define lisa_handle_event xlockmore_no_events
# include "xlockmore.h" /* in xscreensaver distribution */
#else /* STANDALONE */
#include "xlock.h" /* in xlockmore distribution */
#ifdef USE_MODULES
ModStruct lisa_description =
-{"lisa", "init_lisa", "draw_lisa", "release_lisa",
- "refresh_lisa", "change_lisa", (char *) NULL, &lisa_opts,
+{"lisa", "init_lisa", "draw_lisa", (char *) NULL,
+ "refresh_lisa", "change_lisa", "free_lisa", &lisa_opts,
17000, 1, 768, -1, 64, 1.0, "",
- "Shows animated lisajous figures", 0, NULL};
+ "Shows animated lissajous figures", 0, NULL};
#endif
} lisas;
typedef struct lisacontext_struct {
- lisas *lisajous;
- int width, height, nlisajous, loopcount;
+ lisas *lissajous;
+ int width, height, nlissajous, loopcount;
int maxcycles;
Bool painted;
} lisacons;
int xMaxLines;
-static void
-free_lisa(lisacons *lc)
+ENTRYPOINT void
+free_lisa(ModeInfo * mi)
{
- while (lc->lisajous) {
+ lisacons *lc = &Lisa[MI_SCREEN(mi)];
+ while (lc->lissajous) {
int lctr;
- for (lctr = 0; lctr < lc->nlisajous; lctr++) {
- (void) free((void *) lc->lisajous[lctr].lastpoint);
+ for (lctr = 0; lctr < lc->nlissajous; lctr++) {
+ (void) free((void *) lc->lissajous[lctr].lastpoint);
}
- (void) free((void *) lc->lisajous);
- lc->lisajous = (lisas *) NULL;
+ (void) free((void *) lc->lissajous);
+ lc->lissajous = (lisas *) NULL;
}
}
/* Allocate the np (new point) array (with padding) */
if ((np = (XPoint *) calloc(loop->nsteps+extra_points, sizeof (XPoint))) == NULL) {
- free_lisa(lc);
+ free_lisa(mi);
return False;
}
if ((lp = loop->lastpoint = (XPoint *)
calloc(loop->nsteps+extra_points, sizeof (XPoint))) == NULL) {
- free_lisa(lc);
+ free_lisa(mi);
return False;
}
phase = lc->loopcount % loop->nsteps;
lisacons *lc = &Lisa[MI_SCREEN(mi)];
int lctr;
- for (lctr = 0; lctr < lc->nlisajous; lctr++) {
- if (!drawlisa(mi, &lc->lisajous[lctr]))
+ for (lctr = 0; lctr < lc->nlissajous; lctr++) {
+ if (!drawlisa(mi, &lc->lissajous[lctr]))
return;
}
}
+#ifndef STANDALONE
ENTRYPOINT void
refresh_lisa(ModeInfo * mi)
{
if (Lisa == NULL)
return;
lc = &Lisa[MI_SCREEN(mi)];
- if (lc->lisajous == NULL)
+ if (lc->lissajous == NULL)
return;
if (lc->painted) {
refreshlisa(mi);
}
}
+#endif
static void
change_lisa(ModeInfo * mi)
if (Lisa == NULL)
return;
lc = &Lisa[MI_SCREEN(mi)];
- if (lc->lisajous == NULL)
+ if (lc->lissajous == NULL)
return;
lc->loopcount = 0;
- for (lctr = 0; lctr < lc->nlisajous; lctr++) {
- loop = &lc->lisajous[lctr]; /* count through the loops we're drawing */
+ for (lctr = 0; lctr < lc->nlissajous; lctr++) {
+ loop = &lc->lissajous[lctr]; /* count through the loops we're drawing */
newfunc = NRAND(NUMSTDFUNCS); /* choose a new function at random */
#if defined FOLLOW_FUNC_ORDER
loop->function[1] =
int lctr;
lisacons *lc;
- if (Lisa == NULL) {
- if ((Lisa = (lisacons *) calloc(MI_NUM_SCREENS(mi),
- sizeof (lisacons))) == NULL)
- return;
- }
+ MI_INIT (mi, Lisa);
lc = &Lisa[MI_SCREEN(mi)];
lc->width = MI_WIDTH(mi);
lc->height = MI_HEIGHT(mi);
lc->loopcount = 0;
- lc->nlisajous = MI_COUNT(mi);
- if (lc->nlisajous <= 0)
- lc->nlisajous = 1;
+ lc->nlissajous = MI_COUNT(mi);
+ if (lc->nlissajous <= 0)
+ lc->nlissajous = 1;
MI_CLEARWINDOW(mi);
lc->painted = False;
- if (lc->lisajous == NULL) {
- if ((lc->lisajous = (lisas *) calloc(lc->nlisajous,
+ if (lc->lissajous == NULL) {
+ if ((lc->lissajous = (lisas *) calloc(lc->nlissajous,
sizeof (lisas))) == NULL)
return;
- for (lctr = 0; lctr < lc->nlisajous; lctr++) {
- if (!initlisa(mi, &lc->lisajous[lctr]))
+ for (lctr = 0; lctr < lc->nlissajous; lctr++) {
+ if (!initlisa(mi, &lc->lissajous[lctr]))
return;
lc->loopcount++;
}
if (Lisa == NULL)
return;
lc = &Lisa[MI_SCREEN(mi)];
- if (lc->lisajous == NULL)
+ if (lc->lissajous == NULL)
return;
-#ifdef HAVE_COCOA /* Don't second-guess Quartz's double-buffering */
+#ifdef HAVE_JWXYZ /* Don't second-guess Quartz's double-buffering */
XClearWindow (MI_DISPLAY(mi), MI_WINDOW(mi));
#endif
refreshlisa(mi);
}
-ENTRYPOINT void
-release_lisa (ModeInfo * mi)
-{
- if (Lisa) {
- int screen;
-
- for (screen = 0; screen < MI_NUM_SCREENS(mi); screen++)
- free_lisa(&Lisa[screen]);
- (void) free(Lisa);
- Lisa = (lisacons *) NULL;
- }
-}
-
XSCREENSAVER_MODULE ("Lisa", lisa)
#endif /* MODE_lisa */