|
|
1.1 ! root 1: ! 2: #import <appkit/View.h> ! 3: #import "Thinker.h" ! 4: ! 5: typedef struct { float l,b,r,t; } BRECT; ! 6: ! 7: typedef struct { ! 8: float hue; ! 9: float pos; ! 10: } LineInfo; ! 11: ! 12: // maximum number number of grid lines ! 13: #define NVERT 8 ! 14: #define NHORIZ 10 ! 15: ! 16: #define DECREASING 0 ! 17: #define INCREASING 1 ! 18: ! 19: void horizLineWithAvoidance(float x1, float y1, float x2,float y2, ! 20: float hue,float brightness, const NXRect *r); ! 21: ! 22: void verticalLineWithAvoidance(float x1, float y1, float x2,float y2, ! 23: float hue,float brightness, const NXRect *r); ! 24: ! 25: @interface BoinkView:View ! 26: { ! 27: float xpos; ! 28: float xspeed; ! 29: float ypos; ! 30: float yspeed; ! 31: float accel; ! 32: int ballNum; ! 33: int spinDir; ! 34: int rebound; ! 35: ! 36: float viewHeight; ! 37: float viewWidth; ! 38: ! 39: BRECT old; ! 40: NXPoint ballTo; ! 41: NXPoint redrawTo; ! 42: NXRect redraw; ! 43: NXSize oldSize; ! 44: ! 45: id buffer; ! 46: id balls; ! 47: ! 48: int nvert, nhoriz; ! 49: int vcount, hcount; ! 50: LineInfo vertLines[NVERT]; ! 51: LineInfo horizLines[NHORIZ]; ! 52: int toggle; ! 53: int reboundMode; ! 54: float lastLaunchSpeed; ! 55: ! 56: BStimeval now, then; ! 57: BStimeval nextRotationTime; ! 58: BStimeval nextLineDrawTime; ! 59: } ! 60: ! 61: - oneStep; ! 62: - newSpeed; ! 63: - initFrame:(const NXRect *)frameRect; ! 64: - setAccel:(float)val; ! 65: - sizeTo:(NXCoord)width :(NXCoord)height; ! 66: - drawSelf:(const NXRect *)rects :(int)rectCount; ! 67: - newViewSize; ! 68: - incrementBallNumber; ! 69: - (float) getRandomXspeed; ! 70: - (float) timeCorrectedXSpeed; ! 71: - checkXspeed:(float *)speed; ! 72: - (const char *)windowTitle; ! 73: - updateGrid; ! 74: - drawGrid; ! 75: - drawLinesInBuffer; ! 76: ! 77: @end
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.