本文整理汇总了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);
}
示例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);
}
示例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() );
}
示例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;
}
示例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 );
}
}
示例6: Sys_EndMouseInputEvents
/*
================
Sys_EndMouseInputEvents
================
*/
void Sys_EndMouseInputEvents() {
mouse_polls.SetNum(0, false);
}
示例7: Sys_EndKeyboardInputEvents
/*
================
Sys_EndKeyboardInputEvents
================
*/
void Sys_EndKeyboardInputEvents() {
kbd_polls.SetNum(0, false);
}
示例8: Sys_EndJoystickInputEvents
void Sys_EndJoystickInputEvents() {
joystick_polls.SetNum(0, false);
}
示例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 );
}