本文整理汇总了C++中idCmdArgs::Args方法的典型用法代码示例。如果您正苦于以下问题:C++ idCmdArgs::Args方法的具体用法?C++ idCmdArgs::Args怎么用?C++ idCmdArgs::Args使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类idCmdArgs
的用法示例。
在下文中一共展示了idCmdArgs::Args方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ListByFlags
void idCmdSystemLocal::ListByFlags( const idCmdArgs &args, cmdFlags_t flags ) {
int i;
idStr match;
const commandDef_t *cmd;
idList<const commandDef_t *> cmdList;
if ( args.Argc() > 1 ) {
match = args.Args( 1, -1 );
match.Remove( ' ' );
} else {
match = "";
}
for ( cmd = cmdSystemLocal.GetCommands(); cmd; cmd = cmd->next ) {
if ( !( cmd->flags & flags ) ) {
continue;
}
if ( match.Length() && idStr( cmd->name ).Filter( match, false ) == 0 ) {
continue;
}
cmdList.Append( cmd );
}
cmdList.Sort();
for ( i = 0; i < cmdList.Num(); i++ ) {
cmd = cmdList[i];
common->Printf( " %-21s %s\n", cmd->name, cmd->description );
}
common->Printf( "%i commands\n", cmdList.Num() );
}
示例2: Command
/*
============
idCVarSystemLocal::Command
============
*/
bool idCVarSystemLocal::Command( const idCmdArgs &args )
{
idInternalCVar *internal;
internal = FindInternal( args.Argv( 0 ) );
if ( internal == NULL )
{
return false;
}
if ( args.Argc() == 1 )
{
// print the variable
common->Printf( "\"%s\" is:\"%s\"" S_COLOR_WHITE " default:\"%s\"\n",
internal->nameString.c_str(), internal->valueString.c_str(), internal->resetString.c_str() );
if ( idStr::Length( internal->GetDescription() ) > 0 )
{
common->Printf( S_COLOR_WHITE "%s\n", internal->GetDescription() );
}
}
else
{
// set the value
internal->Set( args.Args(), false, false );
}
return true;
}
示例3: Set_f
/*
============
idCVarSystemLocal::Set_f
============
*/
void idCVarSystemLocal::Set_f( const idCmdArgs &args )
{
const char *str;
str = args.Args( 2, args.Argc() - 1 );
localCVarSystem.SetCVarString( args.Argv(1), str );
}
示例4: Test_f
/*
============
idSIMD::Test_f
============
*/
void idSIMD::Test_f( const idCmdArgs &args ) {
SetThreadPriority( GetCurrentThread(), THREAD_PRIORITY_TIME_CRITICAL );
p_simd = processor;
p_generic = generic;
if ( idStr::Length( args.Argv( 1 ) ) != 0 ) {
cpuid_t cpuid = idLib::sys->GetProcessorId();
idStr argString = args.Args();
argString.Replace( " ", "" );
if ( idStr::Icmp( argString, "SSE" ) == 0 ) {
if ( !( cpuid & CPUID_MMX ) || !( cpuid & CPUID_SSE ) ) {
common->Printf( "CPU does not support MMX & SSE\n" );
return;
}
p_simd = new (TAG_MATH) idSIMD_SSE;
} else {
common->Printf( "invalid argument, use: MMX, 3DNow, SSE, SSE2, SSE3, AltiVec\n" );
return;
}
}
idLib::common->SetRefreshOnPrint( true );
idLib::common->Printf( "using %s for SIMD processing\n", p_simd->GetName() );
GetBaseClocks();
TestMath();
TestMinMax();
TestMemcpy();
TestMemset();
idLib::common->Printf("====================================\n" );
TestBlendJoints();
TestBlendJointsFast();
TestConvertJointQuatsToJointMats();
TestConvertJointMatsToJointQuats();
TestTransformJoints();
TestUntransformJoints();
idLib::common->Printf("====================================\n" );
idLib::common->SetRefreshOnPrint( false );
if ( p_simd != processor ) {
delete p_simd;
}
p_simd = NULL;
p_generic = NULL;
SetThreadPriority( GetCurrentThread(), THREAD_PRIORITY_NORMAL );
}
示例5: ListByFlags
void idCVarSystemLocal::ListByFlags( const idCmdArgs &args, cvarFlags_t flags ) {
int i, argNum;
idStr match, indent, string;
const idInternalCVar *cvar;
idList<const idInternalCVar *>cvarList;
enum {
SHOW_VALUE,
SHOW_DESCRIPTION,
SHOW_TYPE,
SHOW_FLAGS
} show;
argNum = 1;
show = SHOW_VALUE;
if ( idStr::Icmp( args.Argv( argNum ), "-" ) == 0 || idStr::Icmp( args.Argv( argNum ), "/" ) == 0 ) {
if ( idStr::Icmp( args.Argv( argNum + 1 ), "help" ) == 0 || idStr::Icmp( args.Argv( argNum + 1 ), "?" ) == 0 ) {
argNum = 3;
show = SHOW_DESCRIPTION;
} else if ( idStr::Icmp( args.Argv( argNum + 1 ), "type" ) == 0 || idStr::Icmp( args.Argv( argNum + 1 ), "range" ) == 0 ) {
argNum = 3;
show = SHOW_TYPE;
} else if ( idStr::Icmp( args.Argv( argNum + 1 ), "flags" ) == 0 ) {
argNum = 3;
show = SHOW_FLAGS;
}
}
if ( args.Argc() > argNum ) {
match = args.Args( argNum, -1 );
match.Replace( " ", "" );
} else {
match = "";
}
for ( i = 0; i < localCVarSystem.cvars.Num(); i++ ) {
cvar = localCVarSystem.cvars[i];
if ( !( cvar->GetFlags() & flags ) ) {
continue;
}
if ( match.Length() && !cvar->nameString.Filter( match, false ) ) {
continue;
}
cvarList.Append( cvar );
}
cvarList.Sort();
switch( show ) {
case SHOW_VALUE: {
for ( i = 0; i < cvarList.Num(); i++ ) {
cvar = cvarList[i];
common->Printf( FORMAT_STRING S_COLOR_WHITE "\"%s\"\n", cvar->nameString.c_str(), cvar->valueString.c_str() );
}
break;
}
case SHOW_DESCRIPTION: {
indent.Fill( ' ', NUM_NAME_CHARS );
indent.Insert( "\n", 0 );
for ( i = 0; i < cvarList.Num(); i++ ) {
cvar = cvarList[i];
common->Printf( FORMAT_STRING S_COLOR_WHITE "%s\n", cvar->nameString.c_str(), CreateColumn( cvar->GetDescription(), NUM_DESCRIPTION_CHARS, indent, string ) );
}
break;
}
case SHOW_TYPE: {
for ( i = 0; i < cvarList.Num(); i++ ) {
cvar = cvarList[i];
if ( cvar->GetFlags() & CVAR_BOOL ) {
common->Printf( FORMAT_STRING S_COLOR_CYAN "bool\n", cvar->GetName() );
} else if ( cvar->GetFlags() & CVAR_INTEGER ) {
if ( cvar->GetMinValue() < cvar->GetMaxValue() ) {
common->Printf( FORMAT_STRING S_COLOR_GREEN "int " S_COLOR_WHITE "[%d, %d]\n", cvar->GetName(), (int) cvar->GetMinValue(), (int) cvar->GetMaxValue() );
} else {
common->Printf( FORMAT_STRING S_COLOR_GREEN "int\n", cvar->GetName() );
}
} else if ( cvar->GetFlags() & CVAR_FLOAT ) {
if ( cvar->GetMinValue() < cvar->GetMaxValue() ) {
common->Printf( FORMAT_STRING S_COLOR_RED "float " S_COLOR_WHITE "[%s, %s]\n", cvar->GetName(), idStr( cvar->GetMinValue() ).c_str(), idStr( cvar->GetMaxValue() ).c_str() );
} else {
common->Printf( FORMAT_STRING S_COLOR_RED "float\n", cvar->GetName() );
}
} else if ( cvar->GetValueStrings() ) {
common->Printf( FORMAT_STRING S_COLOR_WHITE "string " S_COLOR_WHITE "[", cvar->GetName() );
for ( int j = 0; cvar->GetValueStrings()[j] != NULL; j++ ) {
if ( j ) {
common->Printf( S_COLOR_WHITE ", %s", cvar->GetValueStrings()[j] );
} else {
common->Printf( S_COLOR_WHITE "%s", cvar->GetValueStrings()[j] );
}
}
common->Printf( S_COLOR_WHITE "]\n" );
} else {
common->Printf( FORMAT_STRING S_COLOR_WHITE "string\n", cvar->GetName() );
}
//.........这里部分代码省略.........