This is LifeView.h in view mode; [Download] [Up]
#import <appkit/View.h> #import "Thinker.h" #define ITERATIONS 20000/* max # of iterations before restarting */ #define PANELTIME 333 /* ms delay between *panel* animation frames */ #define DEEPEDGE 2 /* edge is this # squares beyond visible */ #define MINCELLSIZE 2 /* Make sure cell size gets no smaller than... */ #define MAXCELLSIZE 24 /* Make sure cell size gets no bigger than... */ #define MINCLUSTERS 1 /* Make sure # of clusters gets no smaller than... */ #define MAXCLUSTERS 4 /* Make sure # of clusters gets no bigger than... */ #define MINDELAY 0 /* Minimum lower-bound frame delay, in ms */ #define MAXDELAY 10000 /* Maximum lower-bound frame delay, in ms */ #define COLORS 24 /* Generations from youngest color to oldest color */ #define SQUAREBLOCK 32 /* Number of squares of one color to draw at once */ #define STATSIZE 1024 /* Recognizes all stasis periods up to this number */ #define STATIVAL 128 /* Takes up to this long to recognize stasis */ #ifdef DEEPEDGE # define MAXCOLS (1600/MINCELLSIZE+2+2*DEEPEDGE) # define MAXROWS (1280/MINCELLSIZE+2+2*DEEPEDGE) #else # define MAXCOLS (1600/MINCELLSIZE+2) /* full screen of smallest cells (x) */ # define MAXROWS (1280/MINCELLSIZE+2) /* (y) */ #endif typedef struct _lifecell { int next; char neighbors; char color; } lifecell; @interface LifeView:View { lifecell *Grid; int ifirst; int ncols, nrows; int countDown; int running; int cellSize; int clusters; int xoffset, yoffset; BStimeval lasttime; NXColor youngColor; NXColor mediumColor; NXColor oldColor; int delay; NXColor colorTable[COLORS]; int squareCount[COLORS]; NXRect squareBuffer[COLORS][SQUAREBLOCK]; int stasis[STATSIZE]; int strack; int spass; int sindex; id sharedInspectorPanel; id panelYoungColorWell; id panelMediumColorWell; id panelOldColorWell; id panelRestartButton; id panelStepButton; id panelLifeView; id panelCreditsView; id panelSizeMatrix; id panelRHSizeButton; } - oneStep; - drawSquares; - putSquare:(int)x :(int)y Color:(int)color; - flushColor:(int)color; - flushSquares; - drawSelf:(const NXRect *)rects :(int)rectCount; - (const char *) windowTitle; - setupSquareBuffer; - initFrame:(const NXRect *)frameRect; - free; - getLifeDefaults; - sizeTo:(NXCoord)width :(NXCoord)height; - initLife; - clearLife; - checkStasis:(int)checksum; - computeColors; - updateViews; - inspector:sender; - inspectorInstalled; - takeYoungColorFrom:sender; - takeMediumColorFrom:sender; - takeOldColorFrom:sender; - doSizeMatrix:sender; - animateSingleStep:sender; - doSingleStep:sender; - doRestart:sender; - doRHSizeButton:sender; - showRHSizeButton:sender; - hideRHSizeButton:sender; - showCredits:sender; - hideCredits:sender; - doShowCredits:sender; - doHideCredits:sender; @end @interface StaticLifeView:LifeView { } - setYoungColor:(NXColor)yc MediumColor:(NXColor)mc OldColor:(NXColor)oc; - setLifeCellSize:(int)cs; @end
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.