/* -*- Mode: C; tab-width: 4 -*- */
/* apollonian --- Apollonian Circles */
-#if !defined( lint ) && !defined( SABER )
+#if 0
static const char sccsid[] = "@(#)apollonian.c 5.02 2001/07/01 xlockmore";
#endif
*/
#ifdef STANDALONE
-#define MODE_apollonian
-#define PROGCLASS "Apollonian"
-#define HACK_INIT init_apollonian
-#define HACK_DRAW draw_apollonian
-#define apollonian_opts xlockmore_opts
-#define DEFAULTS "*delay: 1000000 \n" \
- "*count: 64 \n" \
- "*cycles: 20 \n" \
- "*ncolors: 64 \n"
-#include "xlockmore.h" /* in xscreensaver distribution */
-#include "erase.h"
+# define MODE_apollonian
+# define DEFAULTS "*delay: 1000000 \n" \
+ "*count: 64 \n" \
+ "*cycles: 20 \n" \
+ "*ncolors: 64 \n" \
+ "*fpsTop: true \n" \
+ "*fpsSolid: true \n" \
+
+# define refresh_apollonian 0
+# define reshape_apollonian 0
+# define apollonian_handle_event 0
+# include "xlockmore.h" /* in xscreensaver distribution */
+# include "erase.h"
#else /* STANDALONE */
-#include "xlock.h" /* in xlockmore distribution */
+# include "xlock.h" /* in xlockmore distribution */
#endif /* STANDALONE */
#ifdef MODE_apollonian
static XrmOptionDescRec opts[] =
{
- {(char *) "-altgeom", (char *) ".apollonian.altgeom", XrmoptionNoArg, (caddr_t) "on"},
- {(char *) "+altgeom", (char *) ".apollonian.altgeom", XrmoptionNoArg, (caddr_t) "off"},
- {(char *) "-label", (char *) ".apollonian.label", XrmoptionNoArg, (caddr_t) "on"},
- {(char *) "+label", (char *) ".apollonian.label", XrmoptionNoArg, (caddr_t) "off"},
+ {"-altgeom", ".apollonian.altgeom", XrmoptionNoArg, "on"},
+ {"+altgeom", ".apollonian.altgeom", XrmoptionNoArg, "off"},
+ {"-label", ".apollonian.label", XrmoptionNoArg, "on"},
+ {"+label", ".apollonian.label", XrmoptionNoArg, "off"},
};
static argtype vars[] =
{
- {(caddr_t *) & altgeom, (char *) "altgeom", (char *) "AltGeom", (char *) DEF_ALTGEOM, t_Bool},
- {(caddr_t *) & label, (char *) "label", (char *) "Label", (char *) DEF_LABEL, t_Bool},
+ {&altgeom, "altgeom", "AltGeom", DEF_ALTGEOM, t_Bool},
+ {&label, "label", "Label", DEF_LABEL, t_Bool},
};
static OptionStruct desc[] =
{
- {(char *) "-/+altgeom", (char *) "turn on/off alternate geometries (off euclidean space, on includes spherical and hyperbolic)"},
- {(char *) "-/+label", (char *) "turn on/off alternate space and number labeling"},
+ {"-/+altgeom", "turn on/off alternate geometries (off euclidean space, on includes spherical and hyperbolic)"},
+ {"-/+label", "turn on/off alternate space and number labeling"},
};
-ModeSpecOpt apollonian_opts =
+ENTRYPOINT ModeSpecOpt apollonian_opts =
{sizeof opts / sizeof opts[0], opts, sizeof vars / sizeof vars[0], vars, desc};
#ifdef DOFONT
euclidean = 0, spherical, hyperbolic
};
-const char * space_string[] = {
+static const char * space_string[] = {
"euclidean",
"spherical",
"hyperbolic"
(e^2+x^2+y^2-1)/(2*e) (an integer!) and the "hyperbolic label", is
calulated by h + s = e.
*/
-circle examples[][4] = {
+static circle examples[][4] = {
{ /* double semi-bounded */
{ 0, 0, 0, 0, 1},
{ 0, 0, 0, 0, -1},
#endif
int time;
int game;
+#ifdef STANDALONE
+ eraser_state *eraser;
+#endif
} apollonianstruct;
static apollonianstruct *apollonians = (apollonianstruct *) NULL;
XDrawString(MI_DISPLAY(mi), MI_WINDOW(mi), MI_GC(mi),
((int) (cp->size * c.x / (2.0 * c.e) + cp->offset.x)),
((int) (cp->size * c.y / (2.0 * c.e) + MI_HEIGHT(mi) -
- FONT_HEIGHT / 2)), space_string[cp->geometry],
+ FONT_HEIGHT / 2)), (char *) space_string[cp->geometry],
strlen(space_string[cp->geometry]));
}
return;
c.h = 2*(c1.h+c2.h+c3.h) - c4.h;
c.x = 2*(c1.x+c2.x+c3.x) - c4.x;
c.y = 2*(c1.y+c2.y+c3.y) - c4.y;
- if (c.e > cp->size * e || c.x / c.e > BIG || c.y / c.e > BIG ||
+ if (c.e == 0 ||
+ c.e > cp->size * e || c.x / c.e > BIG || c.y / c.e > BIG ||
c.x / c.e < -BIG || c.y / c.e < -BIG)
return;
p(mi, c);
f(mi, c1, c2, c, c3);
}
-static void
-free_apollonian(Display *display, apollonianstruct *cp)
+ENTRYPOINT void
+free_apollonian (Display *display, apollonianstruct *cp)
{
if (cp->quad != NULL) {
(void) free((void *) cp->quad);
}
#ifndef DEBUG
-void
+static void
randomize_c(int randomize, circle * c)
{
if (randomize / 2) {
}
#endif
-void
-init_apollonian(ModeInfo * mi)
+ENTRYPOINT void
+init_apollonian (ModeInfo * mi)
{
apollonianstruct *cp;
int i;
cquad(&(cp->c1), &(cp->c2), &(cp->c3), &(cp->c4));
}
cp->time = 0;
+#ifndef STANDALONE
MI_CLEARWINDOW(mi);
+#endif
if (cp->game != 0) {
double q123;
#endif
}
-void
-draw_apollonian(ModeInfo * mi)
+ENTRYPOINT void
+draw_apollonian (ModeInfo * mi)
{
apollonianstruct *cp;
return;
cp = &apollonians[MI_SCREEN(mi)];
+#ifdef STANDALONE
+ if (cp->eraser) {
+ cp->eraser = erase_window (MI_DISPLAY(mi), MI_WINDOW(mi), cp->eraser);
+ return;
+ }
+#endif
MI_IS_DRAWN(mi) = True;
if (++cp->time > MI_CYCLES(mi))
{
#ifdef STANDALONE
- erase_full_window(MI_DISPLAY(mi), MI_WINDOW(mi));
+ cp->eraser = erase_window (MI_DISPLAY(mi), MI_WINDOW(mi), cp->eraser);
#endif /* STANDALONE */
init_apollonian(mi);
}
}
-void
-release_apollonian(ModeInfo * mi)
+ENTRYPOINT void
+release_apollonian (ModeInfo * mi)
{
if (apollonians != NULL) {
int screen;
}
}
+XSCREENSAVER_MODULE ("Apollonian", apollonian)
+
#endif /* MODE_apollonian */