本文整理匯總了C++中CommandLine函數的典型用法代碼示例。如果您正苦於以下問題:C++ CommandLine函數的具體用法?C++ CommandLine怎麽用?C++ CommandLine使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了CommandLine函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。
示例1: GetFactory
//-----------------------------------------------------------------------------
// Init, shutdown
//-----------------------------------------------------------------------------
bool CHLModelViewerApp::PreInit( )
{
CreateInterfaceFn factory = GetFactory();
ConnectTier1Libraries( &factory, 1 );
ConVar_Register( 0 );
MathLib_Init( 2.2f, 2.2f, 0.0f, 2.0f, false, false, false, false );
// Add paths...
if ( !SetupSearchPaths( NULL, false, true ) )
return false;
// Get the adapter from the command line....
const char *pAdapterString;
int nAdapter = 0;
if (CommandLine()->CheckParm( "-adapter", &pAdapterString ))
{
nAdapter = atoi( pAdapterString );
}
int nAdapterFlags = 0;
if ( CommandLine()->CheckParm( "-ref" ) )
{
nAdapterFlags |= MATERIAL_INIT_REFERENCE_RASTERIZER;
}
g_pMaterialSystem->SetAdapter( nAdapter, nAdapterFlags );
if ( !g_pFileSystem->IsSteam() || CommandLine()->FindParm( "-OldDialogs" ) )
g_bOldFileDialogs = true;
LoadFileSystemDialogModule();
return true;
}
示例2: GetDefaultDepthFeatheringValue
int GetDefaultDepthFeatheringValue( void ) //Allow the command-line to go against the default soft-particle value
{
static int iRetVal = -1;
if ( iRetVal == -1 )
{
#if ( DEFAULT_PARTICLE_FEATHERING_ENABLED == 1 )
{
if ( CommandLine()->CheckParm( "-softparticlesdefaultoff" ) )
iRetVal = 0;
else
iRetVal = 1;
}
#else
{
if ( CommandLine()->CheckParm( "-softparticlesdefaulton" ) )
iRetVal = 1;
else
iRetVal = 0;
}
#endif
}
return iRetVal;
}
示例3: atoi
//-----------------------------------------------------------------------------
// Init, shutdown
//-----------------------------------------------------------------------------
bool CVMTEditApp::PreInit( IAppSystemGroup *pAppSystemGroup )
{
// initialize interfaces
CreateInterfaceFn appFactory = pAppSystemGroup->GetFactory();
if (!vgui::VGui_InitInterfacesList( "VMTEDIT", &appFactory, 1 ))
return false;
g_pMatSystemSurface = (IMatSystemSurface *)pAppSystemGroup->FindSystem(MAT_SYSTEM_SURFACE_INTERFACE_VERSION);
char *pArg;
int iWidth = 1024;
int iHeight = 768;
bool bWindowed = (CommandLine()->CheckParm( "-fullscreen" ) == NULL);
if (CommandLine()->CheckParm( "-width", &pArg ))
{
iWidth = atoi( pArg );
}
if (CommandLine()->CheckParm( "-height", &pArg ))
{
iHeight = atoi( pArg );
}
if (!CreateAppWindow( "VMTEdit", bWindowed, iWidth, iHeight ))
return false;
g_pMatSystemSurface->AttachToWindow( m_HWnd );
// NOTE: If we specifically wanted to use a particular shader DLL, we set it here...
//g_pMaterialSystem->SetShader( "shaderapidx8" );
return true;
}
示例4: FileSystem_GetFileSystemDLLName
//-----------------------------------------------------------------------------
// Returns the name of the file system DLL to use
//-----------------------------------------------------------------------------
FSReturnCode_t FileSystem_GetFileSystemDLLName( char *pFileSystemDLL, int nMaxLen, bool &bSteam )
{
bSteam = false;
// Inside of here, we don't have a filesystem yet, so we have to assume that the filesystem_stdio or filesystem_steam
// is in this same directory with us.
char executablePath[MAX_PATH];
if ( !FileSystem_GetExecutableDir( executablePath, sizeof( executablePath ) ) )
return SetupFileSystemError( false, FS_INVALID_PARAMETERS, "FileSystem_GetExecutableDir failed." );
#if defined( _WIN32 )
Q_snprintf( pFileSystemDLL, nMaxLen, "%s%cfilesystem_stdio.dll", executablePath, CORRECT_PATH_SEPARATOR );
#elif defined( POSIX )
Q_snprintf( pFileSystemDLL, nMaxLen, "%s%cfilesystem_stdio", executablePath, CORRECT_PATH_SEPARATOR );
struct stat statBuf;
if ( CommandLine()->FindParm( "-steam" ) || CommandLine()->FindParm( "-steamlocal" ) || stat( pFileSystemDLL, &statBuf ) != 0 )
{
Q_snprintf( pFileSystemDLL, nMaxLen, "%s%cfilesystem_steam.dylib", executablePath, CORRECT_PATH_SEPARATOR );
bSteam = true;
}
#else
#error "define a filesystem dll name"
#endif
return FS_OK;
}
示例5: FileSystem_GetFileSystemDLLName
//-----------------------------------------------------------------------------
// Returns the name of the file system DLL to use
//-----------------------------------------------------------------------------
FSReturnCode_t FileSystem_GetFileSystemDLLName( char *pFileSystemDLL, int nMaxLen, bool &bSteam )
{
bSteam = false;
// Inside of here, we don't have a filesystem yet, so we have to assume that the filesystem_stdio or filesystem_steam
// is in this same directory with us.
char executablePath[MAX_PATH];
if ( !FileSystem_GetExecutableDir( executablePath, sizeof( executablePath ) ) )
return SetupFileSystemError( false, FS_INVALID_PARAMETERS, "FileSystem_GetExecutableDir failed." );
#if defined( _WIN32 ) && !defined( _X360 )
// If filesystem_stdio.dll is missing or -steam is specified, then load filesystem_steam.dll.
// There are two command line parameters for Steam:
// 1) -steam (runs Steam in remote filesystem mode; requires Steam backend)
// 2) -steamlocal (runs Steam in local filesystem mode (all content off HDD)
Q_snprintf( pFileSystemDLL, nMaxLen, "%s%cfilesystem_stdio.dll", executablePath, CORRECT_PATH_SEPARATOR );
if ( CommandLine()->FindParm( "-steam" ) || CommandLine()->FindParm( "-steamlocal" ) || _access( pFileSystemDLL, 0 ) != 0 )
{
Q_snprintf( pFileSystemDLL, nMaxLen, "%s%cfilesystem_steam.dll", executablePath, CORRECT_PATH_SEPARATOR );
bSteam = true;
}
#elif defined( _X360 )
Q_snprintf( pFileSystemDLL, nMaxLen, "%s%cfilesystem_stdio.dll", executablePath, CORRECT_PATH_SEPARATOR );
#elif defined( _LINUX )
Q_snprintf( pFileSystemDLL, nMaxLen, "%s%cfilesystem_i486.so", executablePath, CORRECT_PATH_SEPARATOR );
#else
#error "define a filesystem dll name"
#endif
return FS_OK;
}
示例6: atoi
//-----------------------------------------------------------------------------
// PreInit, PostShutdown
//-----------------------------------------------------------------------------
bool CInputTestApp::PreInit( )
{
if ( !BaseClass::PreInit() )
return false;
if (!g_pFullFileSystem || !g_pInputSystem )
return false;
// Add paths...
if ( !SetupSearchPaths() )
return false;
const char *pArg;
int iWidth = 1024;
int iHeight = 768;
bool bWindowed = (CommandLine()->CheckParm( "-fullscreen" ) == NULL);
if (CommandLine()->CheckParm( "-width", &pArg ))
{
iWidth = atoi( pArg );
}
if (CommandLine()->CheckParm( "-height", &pArg ))
{
iHeight = atoi( pArg );
}
if (!CreateAppWindow( "InputTest", bWindowed, iWidth, iHeight ))
return false;
g_pInputSystem->AttachToWindow( m_HWnd );
return true;
}
示例7: Warning
//---------------------------------------------------------------------------------
// Purpose: called when the plugin is loaded, load the interface we need from the engine
//---------------------------------------------------------------------------------
bool CEmptyServerPlugin::Load( CreateInterfaceFn interfaceFactory, CreateInterfaceFn gameServerFactory )
{
//ConnectTier1Libraries( &interfaceFactory, 1 );
pEngine = (IVEngineServer*)interfaceFactory(INTERFACEVERSION_VENGINESERVER, NULL);
if (!pEngine){
Warning( "Unable to load IVEngineServer, aborting load\n" );
return false;
}
// assuming that the value of host_timer_spin_ms is 0 by any server configs
if ( CommandLine()->CheckParm( "+host_timer_spin_ms" ) )
{
m_bCommandPresent = 1;
m_iDefaultValue = CommandLine()->ParmValue( "+host_timer_spin_ms", 0 );
if ( m_iDefaultValue < 0 )
m_iDefaultValue = 0;
else if ( m_iDefaultValue > 15 )
m_iDefaultValue = 15; // god knows who would do this (idiots)
CommandLine()->RemoveParm( "+host_timer_spin_ms" );
}
//pEngine->ServerCommand( "con_logfile autotimer.log\n" );
//ConVar_Register( 0 );
return true;
}
示例8: main
//-----------------------------------------------------------------------------
// Purpose:
// Input : argc -
// argv[] -
// Output : int
//-----------------------------------------------------------------------------
int main( int argc, char* argv[] )
{
SpewOutputFunc( SpewFunc );
Msg( "Valve Software - vcprojtomake.exe (%s)\n", __DATE__ );
Msg( "Modified for VS2010 Support by Killer Monkey\n" );
Msg( "<[email protected]>\n" );
CommandLine()->CreateCmdLine( argc, argv );
if ( CommandLine()->ParmCount() < 2)
{
printusage();
return 0;
}
CVCProjConvert proj;
if ( !proj.LoadProject( CommandLine()->GetParm( 1 )) )
{
Msg( "Failed to parse project\n" );
return -1;
}
OutputKeyValuesVersion(proj);
CMakefileCreator makefile;
makefile.CreateMakefiles( proj );
return 0;
}
示例9: Sys_MessageBox
//-----------------------------------------------------------------------------
// Purpose: Handles there being an error setting up the video mode
// Output : Returns true on if the engine should restart, false if it should quit
//-----------------------------------------------------------------------------
InitReturnVal_t CEngineAPI::HandleSetModeError()
{
// show an error, see if the user wants to restart
if ( CommandLine()->FindParm( "-safe" ) )
{
Sys_MessageBox( "Failed to set video mode.\n\nThis game has a minimum requirement of DirectX 7.0 compatible hardware.\n", "Video mode error", false );
return INIT_FAILED;
}
if ( CommandLine()->FindParm( "-autoconfig" ) )
{
if ( Sys_MessageBox( "Failed to set video mode - falling back to safe mode settings.\n\nGame will now restart with the new video settings.", "Video - safe mode fallback", true ))
{
CommandLine()->AppendParm( "-safe", NULL );
return (InitReturnVal_t)INIT_RESTART;
}
return INIT_FAILED;
}
if ( Sys_MessageBox( "Failed to set video mode - resetting to defaults.\n\nGame will now restart with the new video settings.", "Video mode warning", true ) )
{
CommandLine()->AppendParm( "-autoconfig", NULL );
return (InitReturnVal_t)INIT_RESTART;
}
return INIT_FAILED;
}
示例10: main
//-----------------------------------------------------------------------------
// Tests the process.cpp stuff
//-----------------------------------------------------------------------------
int main( int argc, char **argv )
{
CommandLine()->CreateCmdLine( argc, argv );
InstallSpewFunction();
float flDelay = CommandLine()->ParmValue( "-delay", 0.0f );
const char *pEndMessage = CommandLine()->ParmValue( "-message", "Test Finished!\n" );
int nEndExtraBytes = CommandLine()->ParmValue( "-extrabytes", 0 );
if ( flDelay > 0.0f )
{
float t = Plat_FloatTime();
while ( Plat_FloatTime() - t < flDelay )
{
}
}
Msg( pEndMessage );
if ( nEndExtraBytes )
{
while( --nEndExtraBytes >= 0 )
{
Msg( "%c", ( nEndExtraBytes % 10 ) + '0' );
}
}
return 0;
}
示例11: IsExternalBuild
// FIXME, this is BS
bool IsExternalBuild()
{
if ( CommandLine()->FindParm( "-publicbuild" ) )
{
return true;
}
if ( !CommandLine()->FindParm( "-internalbuild" ) &&
!CommandLine()->CheckParm("-dev") )
{
return true;
}
// It's an external build...
if ( m_bPhoneHome )
{
if ( !Q_stricmp( m_szBuildIdentifier, "beta-playtest" ) )
{
// Still internal
return false;
}
return true;
}
return false;
}
示例12: sigemptyset
bool CTextConsoleUnix::Init( )
{
static struct termios termNew;
sigset_t block_ttou;
sigemptyset (&block_ttou);
sigaddset (&block_ttou, SIGTTOU);
sigprocmask (SIG_BLOCK, &block_ttou, NULL);
tty = stdout;
// this code is for echo-ing key presses to the connected tty
// (which is != STDOUT)
if ( isatty(STDIN_FILENO) )
{
tty = fopen( ctermid( NULL ), "w+" );
if ( !tty )
{
printf("Unable to open tty(%s) for output\n", ctermid( NULL ) );
tty = stdout;
}
else
{
setbuf( tty, NULL ); // turn buffering off
}
}
else
{
tty = fopen( "/dev/null", "w+" );
if ( !tty )
{
tty = stdout;
}
}
tcgetattr( STDIN_FILENO, &termStored );
memcpy( &termNew, &termStored, sizeof( struct termios ) );
/* Disable canonical mode, and set buffer size to 1 byte */
termNew.c_lflag &= ( ~ICANON );
termNew.c_cc[ VMIN ] = 1;
termNew.c_cc[ VTIME ] = 0;
/* disable echo */
termNew.c_lflag &= ( ~ECHO );
tcsetattr( STDIN_FILENO, TCSANOW, &termNew );
sigprocmask (SIG_UNBLOCK, &block_ttou, NULL);
m_bConDebug = CommandLine()->FindParm( "-condebug" ) != 0;
if ( m_bConDebug && CommandLine()->FindParm( "-conclearlog" ) )
{
g_pFullFileSystem->RemoveFile( CONSOLE_LOG_FILE, "GAME" );
}
return CTextConsole::Init();
}
示例13: Message
virtual void Message( byte msgtype, char const *mapname )
{
if ( !m_bPhoneHome )
return;
if ( !m_pSocket )
return;
switch ( msgtype )
{
default:
break;
case PHONE_MSG_ENGINESTART:
if ( !RequestSessionId( m_uSessionID ) )
{
ExitApp();
}
// Note we always return here!!!
return;
case PHONE_MSG_ENGINEEND:
break;
case PHONE_MSG_MAPSTART:
{
if ( m_bLevelStarted )
{
return;
}
m_bLevelStarted = true;
// Tracker 22394: Don't send map start/finish when building reslists...
if ( CommandLine()->FindParm( "-makereslists" ) )
{
return;
}
}
break;
case PHONE_MSG_MAPEND:
{
if ( !m_bLevelStarted )
{
return;
}
m_bLevelStarted = false;
// Tracker 22394: Don't send map start/finish when building reslists...
if ( CommandLine()->FindParm( "-makereslists" ) )
{
return;
}
}
break;
}
SendSessionMessage( msgtype, mapname );
}
示例14: get_variant_object
static CommandLine get_variant_object( const QVariantMap& m )
{
QString command = CalamaresUtils::getString( m, "command" );
int timeout = CalamaresUtils::getInteger( m, "timeout", CommandLine::TimeoutNotSet );
if ( !command.isEmpty() )
return CommandLine( command, timeout );
cWarning() << "Bad CommandLine element" << m;
return CommandLine();
}
示例15: SystemParametersInfo
//-----------------------------------------------------------------------------
// Purpose: One-time initialization
//-----------------------------------------------------------------------------
void CInput::Init_Mouse (void)
{
if ( CommandLine()->FindParm("-nomouse" ) )
return;
m_flPreviousMouseXPosition = 0.0f;
m_flPreviousMouseYPosition = 0.0f;
m_fMouseInitialized = true;
m_fMouseParmsValid = false;
if ( CommandLine()->FindParm ("-useforcedmparms" ) )
{
#ifdef WIN32
m_fMouseParmsValid = SystemParametersInfo( SPI_GETMOUSE, 0, m_rgOrigMouseParms, 0 ) ? true : false;
#else
m_fMouseParmsValid = false;
#endif
if ( m_fMouseParmsValid )
{
if ( CommandLine()->FindParm ("-noforcemspd" ) )
{
m_rgNewMouseParms[ MOUSE_SPEED_FACTOR ] = m_rgOrigMouseParms[ MOUSE_SPEED_FACTOR ];
/*
int mouseAccel[3];
SystemParametersInfo(SPI_GETMOUSE, 0, &mouseAccel, 0); mouseAccel[2] = 0;
bool ok = SystemParametersInfo(SPI_SETMOUSE, 0, &mouseAccel, SPIF_UPDATEINIFILE);
// Now check registry and close/re-open Control Panel > Mouse and see 'Enhance pointer precision' is OFF
mouseAccel[2] = 1;
ok = SystemParametersInfo(SPI_SETMOUSE, 0, &mouseAccel, SPIF_UPDATEINIFILE);
// Now check registry and close/re-open Control Panel > Mouse and see 'Enhance pointer precision' is ON
*/
}
else
{
m_rgCheckMouseParam[ MOUSE_SPEED_FACTOR ] = 1;
}
if ( CommandLine()->FindParm ("-noforcemaccel" ) )
{
m_rgNewMouseParms[ MOUSE_ACCEL_THRESHHOLD1 ] = m_rgOrigMouseParms[ MOUSE_ACCEL_THRESHHOLD1 ];
m_rgNewMouseParms[ MOUSE_ACCEL_THRESHHOLD2 ] = m_rgOrigMouseParms[ MOUSE_ACCEL_THRESHHOLD2 ];
}
else
{
m_rgCheckMouseParam[ MOUSE_ACCEL_THRESHHOLD1 ] = true;
m_rgCheckMouseParam[ MOUSE_ACCEL_THRESHHOLD2 ] = true;
}
}
}
}