This is PlanetView.h in view mode; [Download] [Up]
#import <appkit/View.h> #import <dpsclient/event.h> // Constants #define PLANETS 30 // default number of planets #define MAXPLANETS 42 // maximum number of planets #define MAXITERATIONS 30000 #define SPACEDIST 2 // # of pixels = 1 unit of space distance #define DEFAULTGRAV 1 /* Default gravity for new planet*/ #define MAXGRAVITY (MAXPLANETS * DEFAULTGRAV) #define PI 3.14159 /* Macros */ #define deltaX(a,b) ((myplanets[b].x - myplanets[a].x)/SPACEDIST) /* addressing into dynamic array */ #define deltaY(a,b) ((myplanets[b].y - myplanets[a].y)/SPACEDIST) /* addressing into dynamic array */ #define SQR(v) (v*v) /* fast square */ typedef struct { NXCoord x, y; /* planet positions x[planet] NXcoord is a float*/ float gravity; /* planet gravity gravity[planet] */ float xv, yv; /* planet velocities xv[planet] */ } aplanet; @interface PlanetView : View { int numplanets; int initialNumplanets; aplanet *myplanets; id numplanetTextField; id numplanetSlider; id inspectorPanel; int iterationCount; float gfactor; } - createUniverse; - constrainGravity:(int)i; - setNumberPlanets:sender; - merge: (int) i: (int) j; - setGFactor:sender; - oneStep; - constrainPosition:(int)i; - newPlanet: (aplanet *) newplanet: (float) width: (float) height; - blowPlanet: (int) planetNum; @end
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.