/****************************/
/*		OPENGL BASICS		*/
/* (c)2004 Pangea Software  */
/* By Brian Greenstone      */
/****************************/


/****************************/
/*    PROTOTYPES            */
/****************************/


/**************************/
/*    EXTERNS             */
/**************************/

extern	Boolean						gPlayInWindow;
extern	short						gDesiredColorDepth, gDesiredRezH, gDesiredRezV;
extern	CGDirectDisplayID			gCGDisplayID;



/****************************/
/*    VARIABLES             */
/****************************/

CFBundleRef 		gBundle = nil;
IBNibRef 			gNibs = nil;


/******************** GET GAME NIB *********************/
//
// Our dialog resources are all stored in the Game.nib file.
// This code creates a reference to that .nib file so that we can
// easily get to the resources whenever we need to.
//

static void GetGameNib(void)
{
OSStatus	iErr;
			
	gBundle = CFBundleGetMainBundle();
	if (gBundle == nil)
		DoFatalAlert("\pCannot locate Main Bundle!");
		
	iErr = CreateNibReferenceWithCFBundle(gBundle, CFSTR("Game"), &gNibs);			// note:  we don't need the ".nib" extension in the filename
	if (iErr != noErr)
		DoFatalAlert("\pCreateNibReferenceWithCFBundle failed!");
}


/************************ MAIN **************************/

int main(void)
{
	GetGameNib();
	
			/* ASK USER FOR VIDEO SETTINGS */
			
	DoScreenModeDialog();

	
	if (gPlayInWindow)							// play in window or full screen?
		CreateGameWindow();		
	else	
		SwitchDisplayMode(gDesiredRezH, gDesiredRezV, gDesiredColorDepth);	
	

			/* GET OPENGL GOING */
				
	OGL_CreateDrawContext();					// create the draw context
	OGL_InitFont();								// init an AGL font to use
	
	
			/* DRAW STUFF */
			
	while (!Button())							// loop until user presses mouse button
	{
		OGL_DrawScene();	
	}
}










