Annotation of Examples/AppKit/BreakApp/BreakView.h, revision 1.1.1.1

1.1       root        1: #import <appkit/View.h>
                      2: #import <dpsclient/dpsNeXT.h>
                      3: 
                      4: // Maximum number of tiles in the playing area...
                      5: 
                      6: #define NUMTILESX 8      
                      7: #define NUMTILESY 20
                      8: 
                      9: #define NUMTILETYPES 2   // Number of different tile types.
                     10: 
                     11: #define TILEHEIGHT     18.0  // Tile size, in pixels
                     12: #define TILEWIDTH      28.0                            
                     13: #define INTERTILE      2.0
                     14: 
                     15: #define GAMEWIDTH  ((TILEWIDTH+INTERTILE) * NUMTILESX)  // Size of the field.
                     16: #define GAMEHEIGHT ((TILEHEIGHT+INTERTILE) * NUMTILESY)
                     17: 
                     18: @interface BreakView:View 
                     19: {
                     20:    
                     21:    int numTilesLeft, score, level, lives, highScore;
                     22: 
                     23:    BOOL gameRunning, demoMode, soundEnabled;
                     24: 
                     25:    DPSTimedEntry timer;
                     26: 
                     27:    double lastFrameTime;
                     28: 
                     29:    // The various pieces that know how to draw themselves on the field.
                     30: 
                     31:    id tile[NUMTILETYPES];
                     32: 
                     33:    // The actual array of tiles on the field. tiles[x][y] is the id of the
                     34:    // tile that is at location x * TILEWIDTH, y * TILEHEIGHT.
                     35: 
                     36:    short tiles[NUMTILESX][NUMTILESY];
                     37:    id ball, paddle, backGround;
                     38: 
                     39:    // The following six are outlets set when the nib file is being
                     40:    // read in.
                     41:    
                     42:    // Views that display various info (these can be nil, in which case the
                     43:    // corresponding info will just go to the bit bucket). 
                     44:    
                     45:    id scoreView;
                     46:    id livesView;
                     47:    id levelView;
                     48:    id hscoreView;
                     49:    id statusView;
                     50: 
                     51:    id wallSound;
                     52:    id tileSound;
                     53:    id paddleSound;
                     54:    id missSound;
                     55:    
                     56:    // Other ball & paddle params
                     57:    float ballX, ballY, paddleX, paddleY, ballXVel, ballYVel, leftMargin;
                     58: 
                     59:    NXSize ballSize, paddleSize, tileSize;
                     60: 
                     61:    // These variables store the of the ball. Killer ball goes through tiles
                     62:    // without bouncing; nice ball bounces from the top wall towards the paddle. 
                     63:    BOOL killerBall, niceBall;
                     64: 
                     65:    // Number of revolutions left if the ball is rotating. If zero or
                     66:    // less, than the ball is not rotating...
                     67:    float revolutionsLeft;
                     68:    float revolutionSpeed; // Radians per millisecond if rotating
                     69: 
                     70: }
                     71: 
                     72: // The following methods can be called by Interface Builder objects &
                     73: // during creation/destruction of instances of BreakView.
                     74: 
                     75: - initFrame:(const NXRect *)frm;
                     76: - free;
                     77: 
                     78: - gotoFirstLevel:sender;       // Essentially a "new game"
                     79: - gotoNextLevel:sender;                // Doesn't have to be explicitly called by user
                     80: - setDemoMode:sender;          // Connect to switch with binary state
                     81: - setSoundMode:sender;         // Connect to switch with binary state   
                     82: - go:sender;                   // mouseDown: on the view does the same thing
                     83: - stop:sender;
                     84: 
                     85: - changeBackground:sender;
                     86: - revertBackground:sender;
                     87: 
                     88: // Methods to get back status of game.
                     89: 
                     90: - (int)score;
                     91: - (int)level;
                     92: - (int)lives;
                     93: 
                     94: // The following methods are internal and probably should not be called
                     95: // by others.
                     96: 
                     97: - setBackgroundFile:(const char *)fileName andRemember:(BOOL)remember;
                     98: - setHighScore:(int)hScore;
                     99: - getHighScore;
                    100: - resizePieces;
                    101: - resetBallAndPaddle;
                    102: - directBallAt:(NXPoint *)dest; 
                    103: - drawSelf:(NXRect *)rects :(int)rectCount;
                    104: - drawBackground:(NXRect *)rect;
                    105: - eraseBall;
                    106: - erasePaddle;
                    107: - showBall;
                    108: - showPaddle;
                    109: - incrementGameScore:(int)scoreIncrement;
                    110: -(BOOL) hitTileAt:(int)x :(int)y;
                    111: - step:(double)timeNow;
                    112: -(BOOL)acceptsFirstMouse;
                    113: - (void)playSound:sound atXLoc:(float)xLoc;
                    114: 
                    115: @end

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.