This is FireWorksView.m in view mode; [Download] [Up]
/* * Module: * FireWorks * * Author: * Doug "Kareth" McClure * asd@cc.purdue.edu * XASD@PURCCVM.BITNET * * Version: 1.0 */ #import "FireWorksView.h" #import "Thinker.h" #import "FireWorksWraps.h" #import <appkit/NXImage.h> #import <appkit/Window.h> #import <appkit/Panel.h> // for NXRunAlertPanel() #import <dpsclient/wraps.h> #import <libc.h> #import <math.h> #define GRAVITY 0.8 #define NUMBER_SHOTS 10 #define TIME_DELAY 1000 @implementation FireWorksView - oneStep { static int i = 0, blowCount = 1; static float oldx, oldy, newx, newy, xvel, yvel; if ( i == 0 ) { oldx = randBetween(0.0, 1000.0); oldy = 0.0; newx = oldx; newy = 0.0; xvel = (randBetween(0.0, 1000.0) - oldx) / 50.0; yvel = randBetween(0.0, 15.0) + 23.0; } PSsendfloat(newx); PSsendfloat(newy); PSsendfloat(oldx); PSsendfloat(oldy); psDrawWork(); oldx = newx; oldy = newy; newx = oldx + xvel; newy = oldy + yvel; yvel -= GRAVITY; if ( i++ > 50 ) { i = 0; PSsendfloat(newy); PSsendfloat(newx); PSsendfloat(oldy); PSsendfloat(oldx); PSsendfloat(randBetween(0.0, 0.5)); PSsendfloat(randBetween(0.0, -2.0) - 1.0); psBlowUp(); if ( ++blowCount > NUMBER_SHOTS ) { blowCount = 1; PSsetgray(0.0); PSclippath(); PSfill(); } } return self; } - initFrame:(NXRect *)frameRect { [super initFrame:frameRect]; [self newSize]; PSsetlinewidth(2.0); return self; } - sizeTo:(NXCoord)width :(NXCoord)height { [super sizeTo:width :height]; [self newSize]; return self; } - newSize { xSize = bounds.size.width; ySize = bounds.size.height; return self; } @end
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.