This is GameBrain.h in view mode; [Download] [Up]
/* Generated by Interface Builder */ // This handles a lot of the logic of the game; it has application delegate // methods to deal with start up and shut down of the application. It also // has some window delegate methods that work in conjunction with the game // window (window with the playing field). It starts and stops the game, // odes pausing, makes sure initialization is done properly, moves from // level to level, and tracks the score along with various bonuses. #import <appkit/appkit.h> // These next #defines are for arguments to the -askAbortGame: method // Here are some reasons why (or ways that) you might abort a game: #define GK_ABORT 0 // user initiated abort (start new game or abort) #define GK_EXIT 1 // exiting the program // Following are subtypes for the compound field of the even data in app- // defined events. You can use your own subtypes as well...just start them // at GK_USER_BASE #define GK_EVENT_BASE 1 // start of the GK defined events #define GK_NONE 0 // NULL GK app-defined event #define GK_STARTUP GK_EVENT_BASE #define GK_USER_BASE GK_EVENT_BASE + 1 // if you define your own events, they should be declared as // (GK_USERBASE + xxx) where xxx is your event number // (which should be in the range from 0 to 65534-GK_USER_BASE); // that way, if new events are added to the GameKit, you won't // get any weird behaviors! @interface GameBrain:Object { id scorePlayer; // plays music id soundPlayer; // plays sound files id scoreKeeper; // keeps score for the game id oneUpView; // keeps track of "extra men" id strings; // localized strings in .nib id alert; // tells user to wait during load id levelText; // textField on status window id gameScreen; // gameView instance id gameTimer; // gameView instance id pauseMenuCell; // menuCell that pauses/unpauses game id gameWindow; // window holding gameView id gameInfo; // window holding gameView id highScoreController; // object to handle High Scores id preferencesBrain; // object to handle Preferences Panel id infoController; // object to put out info/help panels id loadingPanel; // to tell the user we're awake id loadingText; // used to say what we're loading... id currentSlot; // high score slot for the game in progress BOOL paused; // game is paused flag BOOL ranOnce; // did the player at least play one game? BOOL initDone; // is the game done with init sequence&alerts? BOOL printLevel; // which title should be put in window on print? BOOL playerCheated; // has the player cheated during this game? BOOL aborting; // is the player aborting a game in progress? // instance variables to hold preferences and game status: int level, speed, tableNum; } // access to vital "global" game objects - scoreKeeper; // main score keeper object - highScoreController; // high score controller object - currentHighScoreSlot; // returns the high score slot for the game in progress - scorePlayer; // plays music - soundPlayer; // plays sound files - mainStrings; // localized strings in .nib - gameScreen; // gameView instance - gameWindow; // window holding gameView - gameInfo; // returns the app's gameInfo object - oneUpView; // returns the oneUpView object (PlayerUpView instance) - preferencesBrain; // object to handle Preferences Panel - infoController; // object to put out info/help panels // misc methods - init; // designated initializer - (int)tableNum; // the number of the high score table the current // game is eligible to be in - (int)level; // returns current play level - (int)speed; // returns speed - gameOver; // end the game & wrap it up, disp. "game over" - (int)pause; // pause the game - internal method - (int)paused; // are we paused? - (BOOL)playerCheated; // did the player cheat this game? - (BOOL)aborting; // is the player aborting a game in progress? - unpause; // unpause the game - internal method - printGame:sender; // print game screen w/score, level, etc. - buildNewSlot; // builds & returns a new high score slot - makeGameInfo; // you can override to make a custom gameinfo // Interface Builder (IB) methods: - pauseGame:sender; // to be sent by menu item - startNewGame:sender; // called by New Game menu item and on startup - unpauseGame:sender; // same as pauseGame: - gameOver:sender; // sent by gameScreen when game is over. - nextLevel:sender; // advance game to next level - (for user cheat mode) - nextLevel; // advance game to next level - internal - buildAlert; - startUp; // deal with the GK_STARTUP app-defined event - (BOOL)askAbortGame:(int)why; // abort: check if user really wants to - abortGame:sender; // above, but terminates the game if YES. - layerWindows; // make sure the right windows are on top (stats, etc.) - appWillInit:sender; // puts up loading alert. - appDidInit:sender; // starts up the game on launch - appDidBecomeActive:sender; // reactivates the game - appDidHide:sender; // deactivates the game - appDidResignActive:sender; // reactivates the game - appDidUnhide:sender; // deactivates the game - appWillTerminate:sender; // saves high scores and preferences - quit:sender; // to catch the "quit" menu item - applicationDefined:(NXEvent *)theEvent; // initial startup readme panels - windowDidResginMain:sender; // do pause if window loses main status - windowDidResignKey:sender; // do pause if window loses key status - windowDidBecomeKey:sender; // do unpause if window gains key status - windowDidDeminiaturize:sender; // clean off crap left by the new @end
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.