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


C++ CommandLine函数代码示例

本文整理汇总了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; 
}
开发者ID:newroob,项目名称:bg2-2007,代码行数:38,代码来源:mdlviewer.cpp

示例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;
}
开发者ID:SCell555,项目名称:hl2-asw-port,代码行数:25,代码来源:spritecard.cpp

示例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; 
}
开发者ID:RaisingTheDerp,项目名称:raisingthebar,代码行数:35,代码来源:vmtedit.cpp

示例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;
}
开发者ID:AeroHand,项目名称:dota2-lua-engine,代码行数:30,代码来源:filesystem_init.cpp

示例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;
}
开发者ID:SizzlingStats,项目名称:hl2sdk-ob-valve,代码行数:34,代码来源:filesystem_init.cpp

示例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;
}
开发者ID:DeadZoneLuna,项目名称:SourceEngine2007,代码行数:34,代码来源:inputtest.cpp

示例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;
}
开发者ID:SizzlingStats,项目名称:sizzlingplugins,代码行数:31,代码来源:serverplugin_empty.cpp

示例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;
}
开发者ID:Cameron-D,项目名称:DeathmatchClassicSource,代码行数:34,代码来源:vprojtomake.cpp

示例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;
}
开发者ID:Axitonium,项目名称:SourceEngine2007,代码行数:31,代码来源:sys_dll2.cpp

示例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;
}
开发者ID:DeadZoneLuna,项目名称:SourceEngine2007,代码行数:32,代码来源:testprocess.cpp

示例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;
	}
开发者ID:Axitonium,项目名称:SourceEngine2007,代码行数:26,代码来源:host_phonehome.cpp

示例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();
}
开发者ID:Axitonium,项目名称:SourceEngine2007,代码行数:58,代码来源:TextConsoleUnix.cpp

示例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 );
	}
开发者ID:Axitonium,项目名称:SourceEngine2007,代码行数:57,代码来源:host_phonehome.cpp

示例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();
}
开发者ID:calamares,项目名称:calamares,代码行数:10,代码来源:CommandList.cpp

示例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;
			}
		}
	}
}
开发者ID:WorldGamers,项目名称:Mobile-Forces-Source,代码行数:58,代码来源:in_mouse.cpp


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