X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=hacks%2Fdemon.c;h=47c545abe41c32d6895cbcca5888d9abe835d88d;hb=d1ae2829ff0fd2a96c16a0c8c5420efaa47d7b30;hp=d48ce7274e06383a5ca3b1f95d2c5b5d6ccb5b0f;hpb=c1b9b55ad8d59dc05ef55e316aebf5863e7dfa56;p=xscreensaver diff --git a/hacks/demon.c b/hacks/demon.c index d48ce727..47c545ab 100644 --- a/hacks/demon.c +++ b/hacks/demon.c @@ -55,12 +55,11 @@ static const char sccsid[] = "@(#)demon.c 5.00 2000/11/01 xlockmore"; # define DEFAULTS "*delay: 50000 \n" \ "*count: 0 \n" \ "*cycles: 1000 \n" \ - "*size: -7 \n" \ + "*size: -30 \n" \ "*ncolors: 64 \n" \ "*fpsSolid: true \n" \ + "*ignoreRotation: True \n" \ -# define reshape_demon 0 -# define demon_handle_event 0 # define UNIFORM_COLORS # include "xlockmore.h" /* in xscreensaver distribution */ #else /* STANDALONE */ @@ -166,7 +165,6 @@ drawcell(ModeInfo * mi, int col, int row, unsigned char state) gc = MI_GC(mi); } else { XGCValues gcv; - #ifdef DO_STIPPLE gcv.stipple = dp->pixmaps[(state - 1) % (NUMSTIPPLES - 1)]; #endif /* DO_STIPPLE */ @@ -230,25 +228,6 @@ addtolist(ModeInfo * mi, int col, int row, unsigned char state) return True; } -#ifdef DEBUG -static void -print_state(ModeInfo * mi, int state) -{ - demonstruct *dp = &demons[MI_SCREEN(mi)]; - CellList *locallist; - int i = 0; - - locallist = dp->cellList[state]; - (void) printf("state %d\n", state); - while (locallist) { - (void) printf("%d x %d, y %d\n", i, - locallist->pt.x, locallist->pt.y); - locallist = locallist->next; - i++; - } -} - -#endif static void free_state(demonstruct * dp, int state) @@ -467,6 +446,10 @@ init_demon (ModeInfo * mi) #endif /* DO_STIPPLE */ free_struct(dp); +#ifdef HAVE_COCOA + jwxyz_XSetAntiAliasing (MI_DISPLAY(mi), MI_GC(mi), False); +#endif + for (nk = 0; nk < NEIGHBORKINDS; nk++) { if (neighbors == plots[0][nk]) { dp->neighbors = plots[0][nk]; @@ -695,7 +678,7 @@ draw_demon (ModeInfo * mi) dp->newcell[i + mj] = dp->oldcell[k + ml]; /* W */ k = (!i) ? dp->ncols - 1 : i - 1; - l = j; + /*l = j;*/ ml = mj; if (dp->oldcell[k + ml] == (int) (dp->oldcell[i + mj] + 1) % dp->states) @@ -865,7 +848,7 @@ draw_demon (ModeInfo * mi) dp->newcell[i + mj] = dp->oldcell[k + ml]; /* EE */ k = (i + 1 == dp->ncols) ? 0 : i + 1; - l = j; + /*l = j;*/ ml = mj; if (dp->oldcell[k + ml] == (int) (dp->oldcell[i + mj] + 1) % dp->states) @@ -897,7 +880,7 @@ draw_demon (ModeInfo * mi) dp->newcell[i + mj] = dp->oldcell[k + ml]; /* WW */ k = (!i) ? dp->ncols - 1 : i - 1; - l = j; + /*l = j;*/ ml = mj; if (dp->oldcell[k + ml] == (int) (dp->oldcell[i + mj] + 1) % dp->states) @@ -947,6 +930,14 @@ draw_demon (ModeInfo * mi) } +ENTRYPOINT void +reshape_demon(ModeInfo * mi, int width, int height) +{ + XClearWindow (MI_DISPLAY (mi), MI_WINDOW(mi)); + init_demon (mi); +} + + ENTRYPOINT void release_demon (ModeInfo * mi) { @@ -973,6 +964,19 @@ refresh_demon (ModeInfo * mi) dp->redrawpos = 0; } +ENTRYPOINT Bool +demon_handle_event (ModeInfo *mi, XEvent *event) +{ + if (screenhack_event_helper (MI_DISPLAY(mi), MI_WINDOW(mi), event)) + { + reshape_demon (mi, MI_WIDTH(mi), MI_HEIGHT(mi)); + return True; + } + return False; +} + + + XSCREENSAVER_MODULE ("Demon", demon) #endif /* MODE_demon */