This is PlanetView.h in view mode; [Download] [Up]
#import "BackView.h" #import <dpsclient/event.h> // Constants #define PLANETS 20 /* number of planets */ #define MAXPLANETS 30 // maximum number of planets #define SPACEDIST 2 // # of pixels = 1 unit of space distance #define DEFAULTGRAV 1 /* Default gravity for new planet*/ #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 RAND(v) ((random() % v) - (v/2)) /* random number around 0 */ #define SQR(v) (v*v) /* fast square */ typedef struct { NXCoord x, y; /* planet positions x[planet] NXcoord is a float*/ NXColor planetcolor; // planet color float gravity; /* planet gravity gravity[planet] */ float xv, yv; /* planet velocities xv[planet] */ } aplanet; @interface PlanetView : BackView { /* animation related */ int numplanets; /* number of planets */ aplanet *myplanets; int winNum; /* who am I? */ NXCoord curX, curY; /* where am I? */ int cursortime; /* How long have I followed the cursor */ int numPlanets, planetNumber; /*How many, which am I looking at*/ id myPrefWindow; // Preferances Window id numplanetForm; id numplanetSlider; id cursorGravity; id planetnumForm; id planetnumSlider; id planetSpecs; id planetgravitySlider; id planetColor; } - showPanel; - setNumberPlanets: sender; - setPlanetNumber: sender; - setPlanetSpex: sender; - setPlanetGravity: sender; - setCursorhasGravity: sender; - merge: (int) i: (int) j; - oneStep; - newPlanet: (aplanet *) newplanet: (float) width: (float) height; - doBOOM: sender; - blowPlanet: (int) planetNum; @end
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.