software/MFrame/commonFunctions/commonFunctions.cpp
/*----------------------------------------------------------------------*/
// GetScreenDepth, from the Mac Game Programming Gurus book, until I can write
// my own
/*----------------------------------------------------------------------*/
GetScreenDepth, from the Mac Game Programming Gurus book, until I can write
my own
GetScreenDepth from the Mac Game Programming Gurus book until I can write my own
short GetScreenDepth (void)
{
	short			thisDepth;
	char			wasState;
	GDHandle		thisGDevice;
	thisGDevice = GetMainDevice();
	if (thisGDevice != nil)							
	{
		wasState = HGetState((Handle)thisGDevice);	
		HLock((Handle)thisGDevice);					
		thisDepth = (**(**thisGDevice).gdPMap).pixelSize;
		HSetState((Handle)thisGDevice, wasState);	
	}
	else
	{
		DisplayAlert("Can't get screen depth ", "because of an unknown reason.");				
		ExitApplication();
	}
	return (thisDepth);								
}
short GetScreenDepth ( void ) { short thisDepth ; char wasState ; GDHandle thisGDevice ; thisGDevice = GetMainDevice ( ) ; if ( thisGDevice != nil ) { wasState = HGetState ( ( Handle ) thisGDevice ) ; HLock ( ( Handle ) thisGDevice ) ; thisDepth = ( * * ( * * thisGDevice ) . gdPMap ) . pixelSize ; HSetState ( ( Handle ) thisGDevice , wasState ) ; } else { DisplayAlert ( " " , " " ) ; ExitApplication ( ) ; } return ( thisDepth ) ; }
GetScreenDepth, from the Mac Game Programming Gurus book, until I can write
my own
GetScreenDepth from the Mac Game Programming Gurus book until I can write my own
// Make sure we have device handle. // Remember the handle's state. // Lock the device handle down. // Get it's depth (pixelSize). // Restore handle's state. // Post generic error message. // Return screen depth.