This is BattleZoneView.m in view mode; [Download] [Up]
/* Generated by Interface Builder */ #import "BattleZoneView.h" void RunBattleEntry(DPSTimedEntry te, double timeNow, void *data) { /* we set data to self so we can call this method from the timed entry */ [(BattleZoneView *)data display]; } void DisplayBattleFrame(float width,float height,float *Lines); @implementation BattleZoneView - drawSelf:(const NXRect *)rects :(int)rectCount { int count; float myLines[5]; if(step == -1) { PSsetgray(0.0); NXRectFill(&bounds); step = 0; } for(count = 0; count < 5; count++) myLines[count] = Lines[(count*10)+step]; myLines[0] = Lines[0]; step++; if(step == 10) step = 0; DisplayBattleFrame(bounds.size.width,bounds.size.height,myLines); return self; } - startAnimation { myTimedEntry = DPSAddTimedEntry((float)0.02, &RunBattleEntry,self,NX_BASETHRESHOLD); return self; } - endAnimation { DPSRemoveTimedEntry(myTimedEntry); return self; } - initFrame:(const NXRect *)frameRect { int count; float totalSize = 0.0,Delta = 1.0,sofa = 0.0; #define height frameRect->size.height [super initFrame :frameRect]; step = -1; for(count = 0; count < 50; count++) { totalSize += Delta; Delta *= 1.075; } Delta = 1.0; for(count = 0; count < 50; count++) { sofa += Delta; Delta *= 1.075; Lines[count] = height-((sofa*height)/totalSize); } return self; } @end
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.