This is GameModule.rtf in view mode; [Download] [Up]
CardSet Release 2.1 GameModule Inherits From: Object Declared In: GameModule.h Class Description GameModule is an abstract superclass providing a generic framework for .solitaire game modules. It contains a number of methods which can be overridden to provide game-specific behavior. The methods ± startGame:, ± restartGame:, and ± checkForWin: should always be overridden. Instance Variables id bundle; id inspector; id gameWindow; id prefs; id rulesWindow; char *gameName; char frameName[NX_MAXFRAMESTRINGLENGTH]; CardSize cardSize; BOOL ignoreSizePref; CardBack cardBack; NXColor desktopColor; bundle Bundle for this dynamically loaded module. inspector The inspector view for this game. gameWindow Active game window. prefs Game's preferences object. rulesWindow Panel containing rules. gameName The name of the game; also the name of the GameModule subclass. frameName Used to remember location of game window. cardSize Current card size. ignoreSizePref Used internally. cardBack Current card back. desktopColor Current desktop color. Method Types Creating and freeing ± initFromBundle:withName: Game Inspector - inspector: - inspectorInstalled - inspectorWillBeRemoved Start and stop game - startGame: - restartGame: - endGame: Drawing the card - drawCardAt: - drawContentsAt: - drawOutlineAt: Utilities - showRules: - win - lose - checkForWin Instance Methods checkForWin - checkForWin Determine if the game has been won. Always override (unless your game is impossible to win). endGame: - endGame:sender Sent when the game engine is about to switch to a different game. Default implementation hides the game window and rules window. initFromBundle:withName: - initFromBundle:aBundle withName:(const char *)aName Designated initializer for the GameModule class. If this method is overridden in a subclass, always pass message back to this class via super. inspector: - inspector:sender Returns the module's inspector view. inspectorInstalled - inspectorInstalled Sent immediately after this module's inspector view has been installed in the Game Selection Panel. Override as needed. inspectorWillBeRemoved - inspectorWillBeRemoved Sent just before the module's inspector is removed; i.e. before switching to a new game. lose - lose Called when the game has been lost. Override to create new "lost" behaviour. Most games will not bother to detect losing situations. restartGame: - restartGame: Sent when user selects "Restart Game" option. The game should start over, without shuffling the deck. If overridden, always send the message back to the GameModule class via super. startGame: - startGame:sender Start a new game; i.e. shuffle the deck and deal. If overridden, always send the message back to the GameModule class via super. showRules: - showRules:sender Display the rules panel. win - win Called when the game has been won. By default, invokes the generic "win" routine. Override to create custom "game won" behaviour.
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.