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


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

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


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

示例1: Sys_SetLanguageFromSystem

void Sys_SetLanguageFromSystem()
{
	sys_lang.SetString( Sys_DefaultLanguage() );
}
开发者ID:bubble8773,项目名称:RBDOOM-3-BFG,代码行数:4,代码来源:posix_main.cpp

示例2: DebugOutput

void idCollisionModelManagerLocal::DebugOutput( const idVec3& origin )
{
	int i, k, t;
	char buf[128];
	idVec3 end;
	idAngles boxAngles;
	idMat3 modelAxis, boxAxis;
	idBounds bounds;
	trace_t trace;
	
	if( !cm_testCollision.GetBool() )
	{
		return;
	}
	
	testend = ( idVec3* ) Mem_Alloc( cm_testTimes.GetInteger() * sizeof( idVec3 ), TAG_COLLISION );
	
	if( cm_testReset.GetBool() || ( cm_testWalk.GetBool() && !start.Compare( start ) ) )
	{
		total_translation = total_rotation = 0;
		min_translation = min_rotation = 999999;
		max_translation = max_rotation = -999999;
		num_translation = num_rotation = 0;
		cm_testReset.SetBool( false );
	}
	
	if( cm_testWalk.GetBool() )
	{
		start = origin;
		cm_testOrigin.SetString( va( "%1.2f %1.2f %1.2f", start[0], start[1], start[2] ) );
	}
	else
	{
		sscanf( cm_testOrigin.GetString(), "%f %f %f", &start[0], &start[1], &start[2] );
	}
	
	sscanf( cm_testBox.GetString(), "%f %f %f %f %f %f", &bounds[0][0], &bounds[0][1], &bounds[0][2],
			&bounds[1][0], &bounds[1][1], &bounds[1][2] );
	sscanf( cm_testBoxRotation.GetString(), "%f %f %f", &boxAngles[0], &boxAngles[1], &boxAngles[2] );
	boxAxis = boxAngles.ToMat3();
	modelAxis.Identity();
	
	idTraceModel itm( bounds );
	idRandom random( 0 );
	idTimer timer;
	
	if( cm_testRandomMany.GetBool() )
	{
		// if many traces in one random direction
		for( i = 0; i < 3; i++ )
		{
			testend[0][i] = start[i] + random.CRandomFloat() * cm_testLength.GetFloat();
		}
		for( k = 1; k < cm_testTimes.GetInteger(); k++ )
		{
			testend[k] = testend[0];
		}
	}
	else
	{
		// many traces each in a different random direction
		for( k = 0; k < cm_testTimes.GetInteger(); k++ )
		{
			for( i = 0; i < 3; i++ )
			{
				testend[k][i] = start[i] + random.CRandomFloat() * cm_testLength.GetFloat();
			}
		}
	}
	
	// translational collision detection
	timer.Clear();
	timer.Start();
	for( i = 0; i < cm_testTimes.GetInteger(); i++ )
	{
		Translation( &trace, start, testend[i], &itm, boxAxis, CONTENTS_SOLID | CONTENTS_PLAYERCLIP, cm_testModel.GetInteger(), vec3_origin, modelAxis );
	}
	timer.Stop();
	t = timer.Milliseconds();
	if( t < min_translation ) min_translation = t;
	if( t > max_translation ) max_translation = t;
	num_translation++;
	total_translation += t;
	if( cm_testTimes.GetInteger() > 9999 )
	{
		sprintf( buf, "%3dK", ( int )( cm_testTimes.GetInteger() / 1000 ) );
	}
	else
	{
		sprintf( buf, "%4d", cm_testTimes.GetInteger() );
	}
	common->Printf( "%s translations: %4d milliseconds, (min = %d, max = %d, av = %1.1f)\n", buf, t, min_translation, max_translation, ( float ) total_translation / num_translation );
	
	if( cm_testRandomMany.GetBool() )
	{
		// if many traces in one random direction
		for( i = 0; i < 3; i++ )
		{
			testend[0][i] = start[i] + random.CRandomFloat() * cm_testRadius.GetFloat();
		}
//.........这里部分代码省略.........
开发者ID:dcahrakos,项目名称:RBDOOM-3-BFG,代码行数:101,代码来源:CollisionModel_debug.cpp

示例3: Sys_DefaultLanguage

const char* Sys_DefaultLanguage()
{
	// sku breakdowns are as follows
	//  EFIGS	Digital
	//  EF  S	North America
	//   FIGS	EU
	//  E		UK
	// JE    	Japan
	
	// If japanese exists, default to japanese
	// else if english exists, defaults to english
	// otherwise, french
	
	if( !fileSystem->UsingResourceFiles() )
	{
		return ID_LANG_ENGLISH;
	}
	
	idStr fileName;
	
	//D3XP: Instead of just loading a single lang file for each language
	//we are going to load all files that begin with the language name
	//similar to the way pak files work. So you can place english001.lang
	//to add new strings to the english language dictionary
	idFileList* langFiles;
	langFiles = fileSystem->ListFilesTree( "strings", ".lang", true );
	
	idStrList langList = langFiles->GetList();
	
	// Loop through the list and filter
	idStrList currentLangList = langList;
	
	idStr temp;
	for( int i = 0; i < currentLangList.Num(); i++ )
	{
		temp = currentLangList[i];
		temp = temp.Right( temp.Length() - strlen( "strings/" ) );
		temp = temp.Left( temp.Length() - strlen( ".lang" ) );
		currentLangList[i] = temp;
	}
	
	if( currentLangList.Num() <= 0 )
	{
		// call it English if no lang files exist
		sys_lang.SetString( ID_LANG_ENGLISH );
	}
	else if( currentLangList.Num() == 1 )
	{
		sys_lang.SetString( currentLangList[0] );
	}
	else
	{
		if( currentLangList.Find( ID_LANG_JAPANESE ) )
		{
			sys_lang.SetString( ID_LANG_JAPANESE );
		}
		else if( currentLangList.Find( ID_LANG_ENGLISH ) )
		{
			sys_lang.SetString( ID_LANG_ENGLISH );
		}
		else if( currentLangList.Find( ID_LANG_FRENCH ) )
		{
			sys_lang.SetString( ID_LANG_FRENCH );
		}
		else if( currentLangList.Find( ID_LANG_GERMAN ) )
		{
			sys_lang.SetString( ID_LANG_GERMAN );
		}
		else if( currentLangList.Find( ID_LANG_ITALIAN ) )
		{
			sys_lang.SetString( ID_LANG_GERMAN );
		}
		else if( currentLangList.Find( ID_LANG_SPANISH ) )
		{
			sys_lang.SetString( ID_LANG_GERMAN );
		}
		else
		{
			sys_lang.SetString( currentLangList[0] );
		}
	}
	
	fileSystem->FreeFileList( langFiles );
	
	return sys_lang.GetString();// ID_LANG_ENGLISH;
	
	
}
开发者ID:BielBdeLuna,项目名称:RBDoom3BFG-mirrored,代码行数:88,代码来源:sys_local.cpp


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