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


C++ idList::SetNum方法代码示例

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


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

示例1: Sys_ClearEvents

/*
================
Sys_ClearEvents
================
*/
void Sys_ClearEvents() {
	SDL_Event ev;

	while (SDL_PollEvent(&ev))
		;

	kbd_polls.SetNum(0, false);
	mouse_polls.SetNum(0, false);
}
开发者ID:svdijk,项目名称:dhewm3,代码行数:14,代码来源:events.cpp

示例2: Sys_ClearEvents

/*
================
Sys_ClearEvents
================
*/
void Sys_ClearEvents() {
	SDL_Event ev;

	while (SDL_PollEvent(&ev))
		;

	kbd_polls.SetNum(0, false);
	mouse_polls.SetNum(0, false);
	joystick_polls.SetNum(0, false);

	memset( buttonStates, 0, sizeof( buttonStates ) );
	memset( joyAxis, 0, sizeof( joyAxis ) );

	event_overflow.SetNum(0, false);
}
开发者ID:tankorsmash,项目名称:quadcow,代码行数:20,代码来源:events.cpp

示例3: GetTopLifeStats

/*
============
sdStatsTracker::GetTopLifeStats
============
*/
void sdStatsTracker::GetTopLifeStats( idList< const lifeStatsData_t* >& improved,
									  idList< const lifeStatsData_t* >& unchanged,
									  idList< const lifeStatsData_t* >& worse ) const {
	improved.SetNum( 0, false );
	unchanged.SetNum( 0, false );
	worse.SetNum( 0, false );

	for( int i = 0; i < lifeStatsData.Num(); i++ ) {
		const lifeStatsData_t& data = lifeStatsData[ i ];

		switch ( data.newValue.GetType() ) {
			case sdNetStatKeyValue::SVT_FLOAT:
			case sdNetStatKeyValue::SVT_FLOAT_MAX:
				if ( data.newValue.GetFloat() > data.oldValue.GetFloat() ) {
					improved.Append( &data );
				} else if( idMath::Fabs( data.newValue.GetFloat() - data.oldValue.GetFloat() ) < STATS_EPSILON ) {
					unchanged.Append( &data );
				} else {
					worse.Append( &data );
				}
				break;				
			case sdNetStatKeyValue::SVT_INT:
			case sdNetStatKeyValue::SVT_INT_MAX:
				if ( data.newValue.GetInt() > data.oldValue.GetInt() ) {
					improved.Append( &data );
				} else if( data.newValue.GetInt() == data.oldValue.GetInt() ) {
					unchanged.Append( &data );
				} else {
					worse.Append( &data );
				}
				break;
			default:
				assert( false );
				break;
		}
	}
	sdQuickSort( improved.Begin(), improved.End(), sdSortPercentageImprovement() );
}
开发者ID:,项目名称:,代码行数:43,代码来源:

示例4: Wait

/*
========================
idParallelJobList_Threads::Wait
========================
*/
void idParallelJobList_Threads::Wait()
{
	if( jobList.Num() > 0 )
	{
		// don't lock up but return if the job list was never properly submitted
		if( !verify( !done && signalJobCount.Num() > 0 ) )
		{
			return;
		}
		
		bool waited = false;
		uint64 waitStart = Sys_Microseconds();
		
		while( signalJobCount[signalJobCount.Num() - 1].GetValue() > 0 )
		{
			Sys_Yield();
			waited = true;
		}
		version.Increment();
		while( numThreadsExecuting.GetValue() > 0 )
		{
			Sys_Yield();
			waited = true;
		}
		
		jobList.SetNum( 0 );
		signalJobCount.SetNum( 0 );
		numSyncs = 0;
		lastSignalJob = 0;
		
		uint64 waitEnd = Sys_Microseconds();
		deferredThreadStats.waitTime = waited ? ( waitEnd - waitStart ) : 0;
	}
	memcpy( & threadStats, & deferredThreadStats, sizeof( threadStats ) );
	done = true;
}
开发者ID:BielBdeLuna,项目名称:RBDoom3BFG-mirrored,代码行数:41,代码来源:ParallelJobList.cpp

示例5: RestoreTraceModels

/*
===============
idClipModel::RestoreTraceModels
===============
*/
void idClipModel::RestoreTraceModels( idRestoreGame *savefile ) {
	int i, num;
	ClearTraceModelCache();
	savefile->ReadInt( num );
	traceModelCache.SetNum( num );
	for( i = 0; i < num; i++ ) {
		trmCache_t *entry = new trmCache_t;
		savefile->ReadTraceModel( entry->trm );
		savefile->ReadFloat( entry->volume );
		savefile->ReadVec3( entry->centerOfMass );
		savefile->ReadMat3( entry->inertiaTensor );
		entry->refCount = 0;
		traceModelCache[i] = entry;
		traceModelHash.Add( GetTraceModelHashKey( entry->trm ), i );
	}
}
开发者ID:revelator,项目名称:Revelation-Engine,代码行数:21,代码来源:Clip.cpp

示例6: Sys_EndMouseInputEvents

/*
================
Sys_EndMouseInputEvents
================
*/
void Sys_EndMouseInputEvents() {
	mouse_polls.SetNum(0, false);
}
开发者ID:svdijk,项目名称:dhewm3,代码行数:8,代码来源:events.cpp

示例7: Sys_EndKeyboardInputEvents

/*
================
Sys_EndKeyboardInputEvents
================
*/
void Sys_EndKeyboardInputEvents() {
	kbd_polls.SetNum(0, false);
}
开发者ID:svdijk,项目名称:dhewm3,代码行数:8,代码来源:events.cpp

示例8: Sys_EndJoystickInputEvents

void Sys_EndJoystickInputEvents() {
	joystick_polls.SetNum(0, false);
}
开发者ID:tankorsmash,项目名称:quadcow,代码行数:3,代码来源:events.cpp

示例9: DrawOverlayText

/*
========================
idConsoleLocal::DrawOverlayText
========================
*/
void idConsoleLocal::DrawOverlayText( float& leftY, float& rightY, float& centerY )
{
	for( int i = 0; i < overlayText.Num(); i++ )
	{
		const idStr& text = overlayText[i].text;
		
		int maxWidth = 0;
		int numLines = 0;
		for( int j = 0; j < text.Length(); j++ )
		{
			int width = 1;
			for( ; j < text.Length() && text[j] != '\n'; j++ )
			{
				width++;
			}
			numLines++;
			if( width > maxWidth )
			{
				maxWidth = width;
			}
		}
		
		idVec4 bgColor( 0.0f, 0.0f, 0.0f, 0.75f );
		
		const float width = maxWidth * SMALLCHAR_WIDTH;
		const float height = numLines * ( SMALLCHAR_HEIGHT + 4 );
		const float bgAdjust = - 0.5f * SMALLCHAR_WIDTH;
		if( overlayText[i].justify == JUSTIFY_LEFT )
		{
			renderSystem->DrawFilled( bgColor, LOCALSAFE_LEFT + bgAdjust, leftY, width, height );
		}
		else if( overlayText[i].justify == JUSTIFY_RIGHT )
		{
			renderSystem->DrawFilled( bgColor, LOCALSAFE_RIGHT - width + bgAdjust, rightY, width, height );
		}
		else if( overlayText[i].justify == JUSTIFY_CENTER_LEFT || overlayText[i].justify == JUSTIFY_CENTER_RIGHT )
		{
			renderSystem->DrawFilled( bgColor, LOCALSAFE_LEFT + ( LOCALSAFE_WIDTH - width + bgAdjust ) * 0.5f, centerY, width, height );
		}
		else
		{
			assert( false );
		}
		
		idStr singleLine;
		for( int j = 0; j < text.Length(); j += singleLine.Length() + 1 )
		{
			singleLine = "";
			for( int k = j; k < text.Length() && text[k] != '\n'; k++ )
			{
				singleLine.Append( text[k] );
			}
			if( overlayText[i].justify == JUSTIFY_LEFT )
			{
				DrawTextLeftAlign( LOCALSAFE_LEFT, leftY, "%s", singleLine.c_str() );
			}
			else if( overlayText[i].justify == JUSTIFY_RIGHT )
			{
				DrawTextRightAlign( LOCALSAFE_RIGHT, rightY, "%s", singleLine.c_str() );
			}
			else if( overlayText[i].justify == JUSTIFY_CENTER_LEFT )
			{
				DrawTextLeftAlign( LOCALSAFE_LEFT + ( LOCALSAFE_WIDTH - width ) * 0.5f, centerY, "%s", singleLine.c_str() );
			}
			else if( overlayText[i].justify == JUSTIFY_CENTER_RIGHT )
			{
				DrawTextRightAlign( LOCALSAFE_LEFT + ( LOCALSAFE_WIDTH + width ) * 0.5f, centerY, "%s", singleLine.c_str() );
			}
			else
			{
				assert( false );
			}
		}
	}
	overlayText.SetNum( 0 );
}
开发者ID:bsmr-c-cpp,项目名称:RBDOOM-3-BFG,代码行数:81,代码来源:Console.cpp


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