コード例 #1
0
ファイル: logmain.cpp プロジェクト: Ariemeth/MechCommander2HD
void UpdateRenderers()
{
	hasGuardBand = gos_GetMachineInformation(gos_Info_HasGuardBandClipping) != 0;

	//---------------------------------------------------------------------------------
	//Doesn't work.  Always returns 0 for TNT in Win2K build 2183 with 3.55 detonator
	//Assume worst case is +/- 8.0 for now.
	//MaxMinUV = gos_GetMachineInformation(gos_Info_GetMaximumUVSize);

	DWORD bColor = 0x0;
	if (eye)
		bColor = eye->fogColor;
		
	gos_SetupViewport(1,1.0,1,bColor, 0.0, 0.0, 1.0, 1.0 );		//ALWAYS FULL SCREEN for now
	gos_SetRenderState( gos_State_Filter, gos_FilterBiLinear );

	gos_SetRenderState( gos_State_AlphaMode, gos_Alpha_AlphaInvAlpha );

	gos_SetRenderState( gos_State_AlphaTest, TRUE );

	gos_SetRenderState( gos_State_Clipping, TRUE);

	gos_SetRenderState( gos_State_TextureAddress, gos_TextureClamp );

	gos_SetRenderState( gos_State_Dither, 1);

	if (logistics)
	{
		float viewMulX, viewMulY, viewAddX, viewAddY;
		gos_GetViewport(&viewMulX, &viewMulY, &viewAddX, &viewAddY);
		//userInput->setViewport(viewMulX,viewMulY,viewAddX,viewAddY);

		logistics->render();
	}

	//------------------------------------------------------------
	gos_SetRenderState( gos_State_Filter, gos_FilterNone );
	//userInput->render();

	//------------------------------------------------------------
	gos_SetRenderState( gos_State_Filter, gos_FilterNone );
}
コード例 #2
0
void OptionsGraphics::init(long xOffset, long yOffset)
{
	FullPathFileName path;
	path.init( artPath, "mcl_options_combobox0", ".fit" );
	FitIniFile file;
	if ( NO_ERR !=file.open( path ) )
	{
		char error[256];
		sprintf( error, "couldn't open file %s", path );
		Assert( 0, 0, error );
		return;	
	}

	getButton( MSG_RESET )->setMessageOnRelease();

	resolutionList.init( &file, "PlayerNameComboBox" );
	resolutionList.move( globalX(), globalY() );
	resolutionList.move( xOffset, yOffset );
	resolutionList.ListBox().setOrange( true );

	for ( int i = IDS_RESOLUTION0; i < IDS_RESOLUTION9 + 1; i++ )
	{
		if ( 1!=gos_GetMachineInformation( gos_Info_ValidMode, 
			Environment.FullScreenDevice, 
			resModes[i-IDS_RESOLUTION0].xRes, 
			resModes[i-IDS_RESOLUTION0].yRes,
			resModes[i-IDS_RESOLUTION0].bitDepth) )
		{
			availableMode[i-IDS_RESOLUTION0] = false;
		}
		else
		{
			char cstr[256];
			cLoadString (i, cstr, 255 );
			resolutionList.AddItem( cstr, 0xffffffff );
		}
	}

	file.close();

	path.init( artPath, "mcl_options_combobox2", ".fit" );
	if ( NO_ERR !=file.open( path ) )
	{
		char error[256];
		sprintf( error, "couldn't open file %s", path );
		Assert( 0, 0, error );
		return;	
	}

	getButton( MSG_RESET )->setMessageOnRelease();

	cardList.init( &file, "PlayerNameComboBox" );
	cardList.move( globalX(), globalY() );
	cardList.move( xOffset, yOffset );
	cardList.ListBox().setOrange( true );

	DWORD numDevices = 0;
	numDevices = gos_GetMachineInformation( gos_Info_NumberDevices );

	//Theoretically impossible but config would probably like to know if it happens!
	if (numDevices <= 0)
		STOP(("GameOS said there were no video cards in the system!"));

	long usableCardCount = 0;
	for (i=0;i<numDevices;i++)
	{
		DWORD minTextureRam = 6291456;

		//If we are a Voodoo 2, we may be a 4/8 or a 4/4.  Try allowing a 4/4 to run
		// and see what happens!!  NO good has come of this!
		/*
		if ((gos_GetMachineInformation(gos_Info_GetDeviceVendorID,i) == 0x121a) &&
			(gos_GetMachineInformation(gos_Info_GetDeviceDeviceID,i) == 0x0002))
			minTextureRam = 4096000;
		*/

		if (gos_GetMachineInformation(gos_Info_GetDeviceLocalMemory, i) >= minTextureRam)
		{
			char *deviceName = (char*)gos_GetMachineInformation( gos_Info_GetDeviceName, i);
		
			//Save name to other string here.
			cardList.AddItem( deviceName, 0xffffffff );

			if ( Environment.FullScreenDevice == i )
				cardList.SelectItem( usableCardCount );

			usableCardCount++;
		}
	}

//ALL of this is a lie.  Code is now correct but I would ignore this.
// Sorry Heidi!
// -fs

//Turns out, its the same for both.

//Environment.Renderer tells you what device you are currently using as follows:
//	If the value is 0 or 1 you are using the default device or the primary display adapter (One and the same always)
//	If the value is 2 you are using the second video card.
//	If the value is 3 you are using BLADE software renderer.

//If you set the values to any of the above, you will switch to that device.


	for ( i = 0; i < buttonCount; i++ )
	{
		buttons[i].setPressFX( LOG_VIDEOBUTTONS );
		buttons[i].setHighlightFX( LOG_DIGITALHIGHLIGHT );
		buttons[i].setDisabledFX( LOG_WRONGBUTTON );
	}


	move( xOffset, yOffset );

	helpTextArrayID = 1;



	
}