/* TODO: Explain the data structures in detail. */
/* TODO: Explain all the options, like the various starting conditions. */
/* TODO: Explain all the dependencies like libXpm. */
-
+/* TODO: Explain that the program is inherently double-buffered but if you don't have VSync turned on, all those alternating lines are going to look terrible when they scroll upward. */
/* TODO: Add a #define for the hack version. */
/* TODO: Check manpage for all functions I use and ensure my includes are correct. I don't want to depend on picking up includes via screenhack.h. */
/* Screenhack API Functions */
/* -------------------------------------------------------------------------- */
+static Bool
+WolframAutomata_event(Display * dpy, Window win, void * closure, XEvent * event)
+{
+ return False;
+}
+
+static void
+WolframAutomata_free(Display * dpy, Window win, void * closure)
+{
+ struct state * state = closure;
+ XFreeGC(state->dpy, state->gc);
+ XFreePixmap(state->dpy, state->evolution_history);
+ free(state->current_generation);
+ free(state);
+}
+
static void *
WolframAutomata_init(Display * dpy, Window win)
{
} else {
// TODO: Wait for a second or two, clear the screen and do a new iteration with suitably changed settings.
// Note: Since we can't actually loop or sleep here, we need to add a flag to the state struct to indicate that we're in an 'admiration timewindow' (and indicate when it should end)
- printf("infinite hamster wheel\n");
- while (1) continue;
+ WolframAutomata_free(dpy, win, state);
+ closure = WolframAutomata_init(dpy, win);
}
// Calculate the vertical offset of the current 'window' into the history
{ 0, 0, 0, 0 }
};
-static Bool
-WolframAutomata_event(Display * dpy, Window win, void * closure, XEvent * event)
-{
- return False;
-}
-
-static void
-WolframAutomata_free(Display * dpy, Window win, void * closure)
-{
- struct state * state = closure;
- XFreeGC(state->dpy, state->gc);
- XFreePixmap(state->dpy, state->evolution_history);
- free(state->current_generation);
- free(state);
-}
-
static void
WolframAutomata_reshape(Display * dpy, Window win, void * closure, unsigned int w, unsigned int h)
{