This is SwarmView.h in view mode; [Download] [Up]
#import "BackView.h" // Constants #define TRUE 1 #define FALSE 0 #define STD_STR 100 #define BEES 50 /* number of bees */ #define MAXBEES 500 // maximum number of bees #define TIMES 3 /* number of time positions recorded */ #define BEEACC 3 /* acceleration of bees */ #define WASPACC 5 /* maximum acceleration of wasp */ #define BEEVEL 11 /* maximum bee velocity */ #define WASPVEL 12 /* maximum wasp velocity */ #define BORDER 50 /* wasp won't go closer than this to the edges */ /* Macros */ #define X(t,b) (x[t*bees + b]) /* addressing into dynamic array */ #define Y(t,b) (y[t*bees + b]) /* addressing into dynamic array */ #define RAND(v) ((random() % v) - (v/2)) /* random number around 0 */ @interface SwarmView:BackView //@interface SwarmView:View { /* animation related */ int times; /* number of time steps recorded */ int bees, newbees; /* number of bees */ int wasp_vel; /* maximum wasp speed */ int bee_vel; /* maximum bee speed */ int wasp_acc; /* maximum wasp acceleration */ int bee_acc; /* bee acceleration */ int delay; /* delay between updates, in microseconds */ int timeout; /* time in seconds before screen saving */ int border; /* border limiting wasp travel */ char stop; int verbose; /* display settings if TRUE */ int stay_in_front; /* Try to stay in clear area of the screen. */ int root; /* display in root window */ int pointer; /* control wasp with mouse */ int *x, *y; /* bee positions x[time][bee#] */ int *xv, *yv; /* bee velocities xv[bee#] */ int wx[3], wy[3]; /* wasp positions */ int wxv, wyv; /* wasp velocity */ int mywidth, myheight; /* how big am I? */ int winNum; /* who am I? */ float curX, curY; /* where am I? */ int cursortime; /* How long have I followed the cursor */ id myPrefWindow; // Preferances Window id beeText; // Number of Bees } - show; - setNumberBees: sender; - setFollow: sender; - sizeTo:(NXCoord)width :(NXCoord)height; - oneStep; - newSize; @end
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.