ftp.nice.ch/pub/next/developer/resources/libraries/gamekit_proj.NI.sa.tar.gz#/gamekit_proj/Headers/gamekit/PlayerUpView.h

This is PlayerUpView.h in view mode; [Download] [Up]

// PlayerUpView is used to track one-ups.  (i.e. the number of extra
// "men" left.)  It handles displaying them on the screen, too; use
// is fairly obvious:
//			1.  Initialize: -initFrame, -setImage:, -setImageFrame:
//					-setMargin: (optional method, default is 2.0)
//			2.	Reset at start of game play with -setNumUp:
//			3.	When an extra "man" is needed, call -decNumUp:  If it
//					returns YES, then you got one.  If it returns NO
//					then there are no more left and the game is over.
//			4.	If the player is to be awarded a bonus "extra man"
//					then call -incNumUp: to add one extra "man".
//					If you set up an appropriate BonusTacker (or subclass),
//					send it to the PlayerUpView, and then make the
//					PlayerUpView one of the delegates to the ScoreKeeper,
//					then it will automatically give extra one-ups at the
//					right times.
//			5.	If you need to know how many are left, then use
//					the -numUp method to find out.  (If you need to
//					inc by more than one, for example, use a combo
//					like: [playerUpView setNumUp:([playerUpView numUp] + x)];
//			6.	Set the delegate outlet if you want notification of bonus
//					men, added/subtracted men, and so on.  (Trigger sounds
//					and music off the notification, etc.)
// Note that the NeXT archiving works via -read: and -write: so that
//		this object can be on a palette.

#import <appkit/appkit.h>

@interface PlayerUpView:View
{
    id	image;			// an NXImage of the one up
    id	delegate;		// any object...
    id	extraManBonusTracker;	// a BonusTracker...when to give xtra men
	int numUp;			// how many chances the player has left
	NXCoord margin;		// amount of white space to leave when rendering
	NXRect imageFrame;	// where the one up image is located in "image"
}

// before using this object, you should use the following methods, in
// this order, to set things up.
- initFrame:(const NXRect *)frm;	// for initting a view
- setImage:anImage;					// bitmap image of a oneUp
- setMargin:(NXCoord)newMargin;		// white space around displayed oneUps
- setImageFrame:(NXRect *)aRect;	// where the oneUp pic is in the image
- setNumUp:(int)newNumUp;	// set # of oneUps; use at start of game play

// -setNumUp: and the next three methods are for use by the game.
- incNumUp:sender;			// add a oneUp (awarded bonuses or whatever)
- (int)numUp;				// how many oneUps are left
- (BOOL)decNumUp:sender;	// use a oneUp & update view

- drawSelf:(NXRect *)rects :(int)rectCount;	// render the view
- read:(NXTypedStream *)stream;		// for archiving & palettes
- write:(NXTypedStream *)stream;	// for archiving & palettes

// give away extra guys; we act as delegate to ScoreKeeper and wait for
// the score to cross critical points...
- scoreChangedFrom:(int)oldScore to:(int)newScore;
- setExtraManBonusTracker:tracker;
- setDelegate:anObject;
- extraManBonusTracker;
- delegate;

@end

These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.