当前位置: 首页>>代码示例>>C++>>正文


C++ idCVar::SetInteger方法代码示例

本文整理汇总了C++中idCVar::SetInteger方法的典型用法代码示例。如果您正苦于以下问题:C++ idCVar::SetInteger方法的具体用法?C++ idCVar::SetInteger怎么用?C++ idCVar::SetInteger使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在idCVar的用法示例。


在下文中一共展示了idCVar::SetInteger方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: switch

/*
========================
idMenuScreen_Shell_SystemOptions::idMenuDataSource_SystemSettings::AdjustField
========================
*/
void idMenuScreen_Shell_SystemOptions::idMenuDataSource_SystemSettings::AdjustField( const int fieldIndex, const int adjustAmount ) {
    switch ( fieldIndex ) {
    case SYSTEM_FIELD_FRAMERATE: {
        //Carl: Oculus Rift DK1 can be hacked to use refresh rates from 60Hz to 83Hz (71Hz max undistorted). CV1 will probably support 90Hz.
        //Carl: Doom 3 BFG also originally supported 120Hz. So list everything from 60 to 83, with 90 and 120 last.
        static const int numValues = 26;
        static const int values[numValues] = { 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 90, 120 };
        com_engineHz.SetInteger( AdjustOption( com_engineHz.GetInteger(), values, numValues, adjustAmount ) );
        break;
    }
    case SYSTEM_FIELD_VSYNC: {
        static const int numValues = 3;
        static const int values[numValues] = { 0, 1, 2 };
        r_swapInterval.SetInteger( AdjustOption( r_swapInterval.GetInteger(), values, numValues, adjustAmount ) );
        break;
    }
    case SYSTEM_FIELD_ANTIALIASING: {
        static const int numValues = 5;
        static const int values[numValues] = { 0, 2, 4, 8, 16 };
        r_multiSamples.SetInteger( AdjustOption( r_multiSamples.GetInteger(), values, numValues, adjustAmount ) );
        break;
    }
    case SYSTEM_FIELD_MOTIONBLUR: {
        static const int numValues = 5;
        static const int values[numValues] = { 0, 2, 3, 4, 5 };
        r_motionBlur.SetInteger( AdjustOption( r_motionBlur.GetInteger(), values, numValues, adjustAmount ) );
        break;
    }
    case SYSTEM_FIELD_LODBIAS: {
        const float percent = LinearAdjust( r_lodBias.GetFloat(), -1.0f, 1.0f, 0.0f, 100.0f );
        const float adjusted = percent + (float)adjustAmount * 5.0f;
        const float clamped = idMath::ClampFloat( 0.0f, 100.0f, adjusted );
        r_lodBias.SetFloat( LinearAdjust( clamped, 0.0f, 100.0f, -1.0f, 1.0f ) );
        break;
    }
    case SYSTEM_FIELD_BRIGHTNESS: {
        const float percent = LinearAdjust( r_lightScale.GetFloat(), 2.0f, 4.0f, 0.0f, 100.0f );
        const float adjusted = percent + (float)adjustAmount;
        const float clamped = idMath::ClampFloat( 0.0f, 100.0f, adjusted );
        r_lightScale.SetFloat( LinearAdjust( clamped, 0.0f, 100.0f, 2.0f, 4.0f ) );
        break;
    }
    case SYSTEM_FIELD_VOLUME: {
        const float percent = 100.0f * Square( 1.0f - ( s_volume_dB.GetFloat() / DB_SILENCE ) );
        const float adjusted = percent + (float)adjustAmount;
        const float clamped = idMath::ClampFloat( 0.0f, 100.0f, adjusted );
        s_volume_dB.SetFloat( DB_SILENCE - ( idMath::Sqrt( clamped / 100.0f ) * DB_SILENCE ) );
        break;
    }
    }
    cvarSystem->ClearModifiedFlags( CVAR_ARCHIVE );
}
开发者ID:KozGit,项目名称:DOOM3-BFG-RIFT,代码行数:57,代码来源:MenuScreen_Shell_SystemOptions.cpp

示例2: ShutdownPlaybacks

void idGameEdit::ShutdownPlaybacks( void )
{
    g_recordPlayback.SetInteger( 0 );
    g_playPlayback.SetInteger( 0 );

    if( gamePlayback )
    {
        delete gamePlayback;
        gamePlayback = NULL;
    }

    if( playbackCamera )
    {
        playbackCamera->PostEventMS( &EV_Remove, 0 );
        playbackCamera = NULL;
        SetCamera( NULL );
    }
}
开发者ID:Big-Zam,项目名称:IT266-gameMod,代码行数:18,代码来源:Playback.cpp

示例3: Posix_LateInit

/*
===============
Posix_LateInit
===============
*/
void Posix_LateInit( void ) {
	Posix_InitConsoleInput();
	com_pid.SetInteger( getpid() );
	common->Printf( "pid: %d\n", com_pid.GetInteger() );
	common->Printf( "%d MB System Memory\n", Sys_GetSystemRam() );
#ifndef ID_DEDICATED
	common->Printf( "%d MB Video Memory\n", Sys_GetVideoRam() );
#endif
}
开发者ID:iodoom-gitorious,项目名称:pvs-dhewg,代码行数:14,代码来源:posix_main.cpp

示例4: RBFProc

static BOOL CALLBACK RBFProc(HWND hwndDlg, UINT message, WPARAM wParam, LPARAM lParam) 
{  
    switch (message) 
    { 
        case WM_INITDIALOG: 
			SetDlgItemInt(hwndDlg, IDC_RBF_WIDTH, rbfg_DefaultWidth.GetInteger(), FALSE);
			SetDlgItemInt(hwndDlg, IDC_RBF_HEIGHT, rbfg_DefaultHeight.GetInteger(), FALSE);
			SetDlgItemText(hwndDlg, IDC_RBF_FILENAME, RBFName);
            return TRUE; 
 
        case WM_COMMAND: 
            switch (LOWORD(wParam)) 
            { 
                case IDOK: 
					{
						int		width, height;

						width = GetDlgItemInt(hwndDlg, IDC_RBF_WIDTH, 0, FALSE);
						height = GetDlgItemInt(hwndDlg, IDC_RBF_HEIGHT, 0, FALSE);

						rbfg_DefaultWidth.SetInteger( width );
						rbfg_DefaultHeight.SetInteger( height );

						Com_WriteConfigToFile( CONFIG_FILE );

						if (!CheckPow2(width) || !CheckPow2(height))
						{
							return TRUE;
						}

						DestroyWindow(hwndDlg); 

						cmdSystem->BufferCommandText( CMD_EXEC_APPEND, va("renderbumpflat -size %d %d %s\n", width, height, RBFName.c_str() ) );
	                    return TRUE; 
					}
 
                case IDCANCEL: 
                    DestroyWindow(hwndDlg); 
                    return TRUE; 
            } 
    }

    return FALSE; 
} 
开发者ID:ProfessorKaos64,项目名称:tdm,代码行数:44,代码来源:RenderBumpFlatDialog.cpp

示例5: Posix_LateInit

/*
===============
Posix_LateInit
===============
*/
void Posix_LateInit()
{
	Posix_InitConsoleInput();
	com_pid.SetInteger( getpid() );
	common->Printf( "pid: %d\n", com_pid.GetInteger() );
	common->Printf( "%d MB System Memory\n", Sys_GetSystemRam() );
	
//#ifndef ID_DEDICATED
	//common->Printf( "%d MB Video Memory\n", Sys_GetVideoRam() );
//#endif

	//Posix_StartAsyncThread( );
}
开发者ID:bubble8773,项目名称:RBDOOM-3-BFG,代码行数:18,代码来源:posix_main.cpp

示例6: AdjustOption

/*
========================
idMenuScreen_Shell_SystemOptions::idMenuDataSource_SystemSettings::AdjustField
========================
*/
void idMenuScreen_Shell_SystemOptions::idMenuDataSource_SystemSettings::AdjustField( const int fieldIndex, const int adjustAmount )
{
	switch( fieldIndex )
	{
		case SYSTEM_FIELD_FRAMERATE:
		{
			static const int numValues = 2;
			static const int values[numValues] = { 60, 120 };
			com_engineHz.SetInteger( AdjustOption( com_engineHz.GetInteger(), values, numValues, adjustAmount ) );
			break;
		}
		case SYSTEM_FIELD_VSYNC:
		{
			static const int numValues = 3;
			static const int values[numValues] = { 0, 1, 2 };
			r_swapInterval.SetInteger( AdjustOption( r_swapInterval.GetInteger(), values, numValues, adjustAmount ) );
			break;
		}
		case SYSTEM_FIELD_ANTIALIASING:
		{
			// RB: disabled 16x MSAA
			static const int numValues = 4;
			static const int values[numValues] = { 0, 2, 4, 8 };
			// RB end
			r_multiSamples.SetInteger( AdjustOption( r_multiSamples.GetInteger(), values, numValues, adjustAmount ) );
			break;
		}
		case SYSTEM_FIELD_MOTIONBLUR:
		{
			static const int numValues = 5;
			static const int values[numValues] = { 0, 2, 3, 4, 5 };
			r_motionBlur.SetInteger( AdjustOption( r_motionBlur.GetInteger(), values, numValues, adjustAmount ) );
			break;
		}
		// RB begin
		case SYSTEM_FIELD_SHADOWMAPPING:
		{
			static const int numValues = 2;
			static const int values[numValues] = { 0, 1 };
			r_useShadowMapping.SetInteger( AdjustOption( r_useShadowMapping.GetInteger(), values, numValues, adjustAmount ) );
			break;
		}
		/*case SYSTEM_FIELD_LODBIAS:
		{
			const float percent = LinearAdjust( r_lodBias.GetFloat(), -1.0f, 1.0f, 0.0f, 100.0f );
			const float adjusted = percent + ( float )adjustAmount * 5.0f;
			const float clamped = idMath::ClampFloat( 0.0f, 100.0f, adjusted );
			r_lodBias.SetFloat( LinearAdjust( clamped, 0.0f, 100.0f, -1.0f, 1.0f ) );
			break;
		}*/
		// RB end
		case SYSTEM_FIELD_BRIGHTNESS:
		{
			const float percent = LinearAdjust( r_lightScale.GetFloat(), 2.0f, 4.0f, 0.0f, 100.0f );
			const float adjusted = percent + ( float )adjustAmount;
			const float clamped = idMath::ClampFloat( 0.0f, 100.0f, adjusted );
			r_lightScale.SetFloat( LinearAdjust( clamped, 0.0f, 100.0f, 2.0f, 4.0f ) );
			break;
		}
		case SYSTEM_FIELD_VOLUME:
		{
			const float percent = 100.0f * Square( 1.0f - ( s_volume_dB.GetFloat() / DB_SILENCE ) );
			const float adjusted = percent + ( float )adjustAmount;
			const float clamped = idMath::ClampFloat( 0.0f, 100.0f, adjusted );
			s_volume_dB.SetFloat( DB_SILENCE - ( idMath::Sqrt( clamped / 100.0f ) * DB_SILENCE ) );
			break;
		}
	}
	cvarSystem->ClearModifiedFlags( CVAR_ARCHIVE );
}
开发者ID:baldvin,项目名称:RBDOOM-3-BFG,代码行数:75,代码来源:MenuScreen_Shell_SystemOptions.cpp

示例7: if

/*
========================
idMenuScreen_Shell_MatchSettings::idMenuDataSource_MatchSettings::AdjustField
========================
*/
void idMenuScreen_Shell_MatchSettings::idMenuDataSource_MatchSettings::AdjustField( const int fieldIndex, const int adjustAmount ) {

	const idStrList & modes = common->GetModeList();
	const idList< mpMap_t > maps = common->GetMapList();

	idMatchParameters matchParameters = session->GetActivePlatformLobbyBase().GetMatchParms();
	if ( fieldIndex == MATCH_FIELD_MAP ) {
		for ( int i = 0; i < maps.Num(); i++ ) {
			// Don't allow random maps in the game lobby
			matchParameters.gameMap += adjustAmount;
			if ( matchParameters.gameMap < 0 ) {
				matchParameters.gameMap = maps.Num() - 1;
			}
			matchParameters.gameMap %= maps.Num();
			matchParameters.mapName = maps[ matchParameters.gameMap ].mapFile;
			if ( ( maps[matchParameters.gameMap].supportedModes & BIT(matchParameters.gameMode) ) != 0 ) {
				// This map supports this mode
				break;
			}
		}
		session->UpdateMatchParms( matchParameters );

		idStr val;
		GetMapName( matchParameters.gameMap, val );
		si_map.SetInteger( matchParameters.gameMap );
		fields[ MATCH_FIELD_MAP ].SetString( val );

	} else if ( fieldIndex == MATCH_FIELD_MODE ) {
		// Don't allow random modes in the game lobby
		matchParameters.gameMode += adjustAmount;

		if ( matchParameters.gameMode < 0 ) {
			matchParameters.gameMode = modes.Num() - 1;
		} 
		matchParameters.gameMode %= modes.Num();
		updateMap = false;
		if ( ( maps[matchParameters.gameMap].supportedModes & BIT(matchParameters.gameMode) ) == 0 ) {			
			for ( int i = 0; i < maps.Num(); ++i ) {
				if ( ( maps[i].supportedModes & BIT(matchParameters.gameMode) ) != 0 ) {
					matchParameters.gameMap = i;
					updateMap = true;
					break;
				}
			}
		}

		session->UpdateMatchParms( matchParameters );
		idStr val;
		
		GetModeName( matchParameters.gameMode, val );
		si_mode.SetInteger( matchParameters.gameMode );
		fields[ MATCH_FIELD_MODE ].SetString( val );

		if ( updateMap ) {
			GetMapName( matchParameters.gameMap, val );
			si_map.SetInteger( matchParameters.gameMap );
			fields[ MATCH_FIELD_MAP ].SetString( val );
		}

	} else if ( fieldIndex == MATCH_FIELD_TIME ) {
		int time = si_timeLimit.GetInteger() + ( adjustAmount * 5 );
		if ( time < 0 ) {
			time = 60;
		} else if ( time > 60 ) {
			time = 0;
		}

		if ( time == 0 ) {
			fields[ MATCH_FIELD_TIME ].SetString( "#str_02844" );	// none
		} else {
			fields[ MATCH_FIELD_TIME ].SetString( va( "%i", time ) );
		}

		si_timeLimit.SetInteger( time );

		matchParameters.serverInfo.SetInt( "si_timeLimit", si_timeLimit.GetInteger() );
		session->UpdateMatchParms( matchParameters );

	} else if ( fieldIndex == MATCH_FIELD_SCORE ) {

		int val = fields[ fieldIndex ].ToInteger() + ( adjustAmount * 5 );
		if ( val < 5 ) {
			val = MP_PLAYER_MAXFRAGS;
		} else if ( val > MP_PLAYER_MAXFRAGS ) {
			val = 5;
		}

		fields[ fieldIndex ].SetInteger( val );
		si_fragLimit.SetInteger( val );

		matchParameters.serverInfo.SetInt( "si_fragLimit", si_fragLimit.GetInteger() );
		session->UpdateMatchParms( matchParameters );
	}

	cvarSystem->ClearModifiedFlags( CVAR_ARCHIVE );
//.........这里部分代码省略.........
开发者ID:469486139,项目名称:DOOM-3-BFG,代码行数:101,代码来源:MenuScreen_Shell_MatchSettings.cpp


注:本文中的idCVar::SetInteger方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。