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


C++ VarArgs函数代码示例

本文整理汇总了C++中VarArgs函数的典型用法代码示例。如果您正苦于以下问题:C++ VarArgs函数的具体用法?C++ VarArgs怎么用?C++ VarArgs使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: FindChildByName

void CEditorRoot::OnThink(void)
{
	BaseClass::OnThink();

	if ( IsBuildModeActive() )
	{
		Panel *pBuild = FindChildByName( "BuildModeDialog" );
		if ( pBuild && !pBuild->IsCursorOver() && input()->IsKeyDown( KEY_LCONTROL ) )
			pBuild->MoveToFront();
	}

	input()->GetCursorPosition( Mx, My );
	ScreenToLocal(Mx,My);

	Vector2D mCoords = GetSafeFlowgraph()->GetMousePosInNodeSpace();
	m_pLabel_Coords->SetText( VarArgs( "position: %10.1f / %10.1f", mCoords.x, mCoords.y ) );

	static CFastTimer _timer;
	_timer.End();
	double _frametime = _timer.GetDuration().GetSeconds();
	_timer.Start();
	m_pLabel_FrameTime->SetText( VarArgs( "fps: %4.1f, ms: %8.7f", 1.0f/max( 0.00001f, _frametime ), _frametime ) );

	if ( m_bPainting )
		input()->SetCursorOveride( dc_hand );

	// FML
	SortButtons();
	//if ( m_bNeedsButtonPush )
	//	SortButtons();

#ifdef SHADER_EDITOR_DLL_SWARM
	VPANEL modal = input()->GetAppModalSurface();
	static bool bFailed = false;

	if ( !bFailed && modal > 0 && modal != GetVPanel() )
	{
		if ( !m_bHalfView && IsVisible() && !ipanel()->HasParent( modal, GetVPanel() ) )
		{
			const char *pszModalName = ipanel()->GetName( modal );
			const char *names[] = {
				"SteamCloudConfirmation",
				"AddonAssociation",
			};

			const int numnames = ARRAYSIZE( names );
			for ( int i = 0; i < numnames; i++ )
			{
				if ( !Q_stricmp( names[i], pszModalName ) )
				{
					ToggleVisible();
					return;
				}
			}

			bFailed = true;
		}
	}
#endif
}
开发者ID:Biohazard90,项目名称:source-shader-editor,代码行数:60,代码来源:veditorroot.cpp

示例2: VarArgs

void CSheet_Array::OnResetData()
{
	int num_x = pData->GetInt( "i_array_size_x", 1 );
	int num_y = pData->GetInt( "i_array_size_y", 1 );
	m_pTEntry_Size_X->SetText( VarArgs( "%i", num_x ) );
	m_pTEntry_Size_Y->SetText( VarArgs( "%i", num_y ) );
	m_pTEntry_Gauss_Bias->SetText( "0.0" );
	int iEnum = ::GetVarFlagsVarValue( pData->GetInt( "i_array_datatype" ) );
	m_pCBox_Datatype->ActivateItem( iEnum );

	UpdateArrayBlocks( num_x, num_y );

	::TokenChannels_t tokens;
	for ( int x = 0; x < num_x; x++ )
	{
		for ( int y = 0; y < num_y; y++ )
		{
			int element = num_y * x + y;

			char tmp[MAX_PATH];
			Q_snprintf( tmp, sizeof( tmp ), "%s", pData->GetString( VarArgs( "pfl_arraydata_%03i", element ) ) );

			tokens.bAllowChars = false;
			tokens.SetDefaultChannels();
			tokens.Tokenize( tmp );
			tokens.iActiveChannels = iEnum + 1;
			tokens.PrintTargetString( tmp, sizeof( tmp ) );

			m_hArray_Y_Major[ y ]->Element( x )->SetText( tmp );
		}
	}
}
开发者ID:BSVino,项目名称:source-shader-editor,代码行数:32,代码来源:vsheet_array.cpp

示例3: Assert

void CNodeCustom::FillJackDataFromKV( KeyValues *pKV, CUtlVector< __funcParamSetup* > &m_hIn, CUtlVector< __funcParamSetup* > &m_hOut )
{
	Assert( m_hIn.Count() == 0 );
	Assert( m_hOut.Count() == 0 );

	const char *nullString = "";
	int itr = 0;

	for (;;)
	{
		const char *read_name = pKV->GetString( VarArgs( "varName_In_%i", itr ), nullString );
		const int read_type = pKV->GetInt( VarArgs( "varType_In_%i", itr ), 0 );

		if ( read_type == 0 )
			break;

		m_hIn.AddToTail( AllocOutputSetup( false, read_name, read_type ) );
		itr++;
	}

	itr = 0;

	for (;;)
	{
		const char *read_name = pKV->GetString( VarArgs( "varName_Out_%i", itr ), nullString );
		const int read_type = pKV->GetInt( VarArgs( "varType_Out_%i", itr ), 0 );

		if ( read_type == 0 )
			break;

		m_hOut.AddToTail( AllocOutputSetup( true, read_name, read_type ) );
		itr++;
	}
}
开发者ID:BSVino,项目名称:source-shader-editor,代码行数:34,代码来源:vnode_custom.cpp

示例4: GetRTManager

void CDialog_RendertargetList::FillList()
{
	ScrollBar *pScroll = m_pList_RT->GetScrollbar();
	int scrollValue = pScroll ? pScroll->GetValue() : 0;

	m_pList_RT->DeleteAllItems();

	GetRTManager()->SortRTsByName();
	for ( int i = 0; i < GetRTManager()->GetNumRTs(); i++ )
	{
		RTDef *rt = GetRTManager()->GetRT( i );

		if ( rt->IsFlaggedForDeletion() )
			continue;

		Label *pL = new Label( m_pList_RT, "", rt->GetName() );
		Button *pBDel = new Button( m_pList_RT, "", "Delete", this, VarArgs("del_rt_%i",i) );
		Button *pBEdit = new Button( m_pList_RT, "", "Edit", this, VarArgs("edit_rt_%i",i) );

		pBDel->SetContentAlignment( Label::a_center );
		pBEdit->SetContentAlignment( Label::a_center );

		m_pList_RT->AddItem( pL, pBDel );
		m_pList_RT->AddItem( NULL, pBEdit );
	}

	if ( pScroll )
		pScroll->SetValue( scrollValue );
}
开发者ID:Biohazard90,项目名称:source-shader-editor,代码行数:29,代码来源:vdialogrtlist.cpp

示例5: ObjectiveMap

StatsReport::StatsReport( vgui::Panel *parent, const char *name ) : vgui::EditablePanel( parent, name )
{
	m_pObjectiveMap = new ObjectiveMap( this, "ObjectiveMap" );
	
	for ( int i = 0; i < ASW_STATS_REPORT_CATEGORIES; i++ )
	{
		const char *pButtonName = VarArgs( "CategoryButton%d", i );
		m_pCategoryButtons[ i ] = new vgui::Button( this, pButtonName, "", this, pButtonName );
	}

	for ( int i = 0; i < ASW_STATS_REPORT_MAX_PLAYERS; i++ )
	{
		m_pPlayerNames[ i ] = new vgui::Label( this, VarArgs( "PlayerName%d", i ), "" );
		m_pReadyCheckImages[ i ] = new vgui::ImagePanel( this, VarArgs( "ReadyCheck%d", i ) );
		m_pReadyCheckImages[ i ]->SetShouldScaleImage( true );
		m_pAvatarImages[ i ] = new CAvatarImagePanel( this, VarArgs( "AvatarImage%d", i ) );
	}

	m_pPlayerNamesPosition = new vgui::Panel( this, "PlayerNamesPosition" );

	m_pStatGraphPlayer = new StatGraphPlayer( this, "StatGraphPlayer" );

	m_pDebrief = new DebriefTextPage( this, "Debrief" );

	m_rgbaStatsReportPlayerColors[ 0 ] = Color( 225, 60, 60, 255 );
	m_rgbaStatsReportPlayerColors[ 1 ] = Color( 200, 200, 60, 255 );
	m_rgbaStatsReportPlayerColors[ 2 ] = Color( 60, 225, 60, 255 );
	m_rgbaStatsReportPlayerColors[ 3 ] = Color( 30, 90, 225, 255 );
}
开发者ID:plaYer2k,项目名称:client,代码行数:29,代码来源:stats_report.cpp

示例6: VarArgs

void CNodeCustom::WriteJackDataFromKV( KeyValues *pKV, CUtlVector< __funcParamSetup* > &m_hIn, CUtlVector< __funcParamSetup* > &m_hOut,
										int maxIn, int maxOut )
{
	for ( int i = 0; i < maxIn; i++ )
	{
		const char *pName = VarArgs( "varName_In_%i", i );
		if ( i < m_hIn.Count() )
			pKV->SetString( pName, m_hIn[ i ]->pszName );
		else
			pKV->SetString( pName, "" );

		pName = VarArgs( "varType_In_%i", i );
		if ( i < m_hIn.Count() )
			pKV->SetInt( pName, m_hIn[ i ]->iFlag );
		else
			pKV->SetInt( pName, HLSLVAR_FLOAT1 );
	}

	for ( int i = 0; i < maxOut; i++ )
	{
		const char *pName = VarArgs( "varName_Out_%i", i );
		if ( i < m_hOut.Count() )
			pKV->SetString( pName, m_hOut[ i ]->pszName );
		else
			pKV->SetString( pName, "" );

		pName = VarArgs( "varType_Out_%i", i );
		if ( i < m_hOut.Count() )
			pKV->SetInt( pName, m_hOut[ i ]->iFlag );
		else
			pKV->SetInt( pName, HLSLVAR_FLOAT1 );
	}
}
开发者ID:BSVino,项目名称:source-shader-editor,代码行数:33,代码来源:vnode_custom.cpp

示例7: GetActiveWeapon

//-----------------------------------------------------------------------------
// Purpose: called every frame to get ammo info from the weapon
//-----------------------------------------------------------------------------
void CDoDHudAmmo::OnThink()
{
    C_BaseCombatWeapon *wpn = GetActiveWeapon();
    C_BasePlayer *player = C_BasePlayer::GetLocalPlayer();

    hudlcd->SetGlobalStat( "(weapon_print_name)", wpn ? wpn->GetPrintName() : " " );
    hudlcd->SetGlobalStat( "(weapon_name)", wpn ? wpn->GetName() : " " );

    if ( !wpn || !player || !wpn->UsesPrimaryAmmo() )
    {
        hudlcd->SetGlobalStat( "(ammo_primary)", "n/a" );
        hudlcd->SetGlobalStat( "(ammo_secondary)", "n/a" );

        SetPaintEnabled( false );
        SetPaintBackgroundEnabled( false );
        return;
    }
    else
    {
        SetPaintEnabled( true );
        SetPaintBackgroundEnabled( true );
    }

    // get the ammo in our clip
    int ammo1 = wpn->Clip1();
    int ammo2;
    if ( ammo1 < 0 )
    {
        // we don't use clip ammo, just use the total ammo count
        ammo1 = player->GetAmmoCount( wpn->GetPrimaryAmmoType() );
        ammo2 = 0;
    }
    else
    {
        // we use clip ammo, so the second ammo is the total ammo
        ammo2 = player->GetAmmoCount( wpn->GetPrimaryAmmoType() );
    }

    hudlcd->SetGlobalStat( "(ammo_primary)", VarArgs( "%d", ammo1 ) );
    hudlcd->SetGlobalStat( "(ammo_secondary)", VarArgs( "%d", ammo2 ) );

    if ( wpn == m_hCurrentActiveWeapon )
    {
        // same weapon, just update counts
        SetAmmo( ammo1, true );
        SetAmmo2( ammo2, true );
    }
    else
    {
        // diferent weapon, change without triggering
        SetAmmo( ammo1, false );
        SetAmmo2( ammo2, false );

        // update whether or not we show the total ammo display
        m_bUsesClips = wpn->UsesClipsForAmmo1();
        m_hCurrentActiveWeapon = wpn;
    }
}
开发者ID:steadyfield,项目名称:SourceEngine2007,代码行数:61,代码来源:dod_hud_playerstatus_ammo.cpp

示例8: VarArgs

void CSheet_VSInput::OnSliderMoved( int position )
{
	int numTex = m_pSlider_tex->GetValue();
	int numCol = m_pSlider_col->GetValue();

	m_pLabel_Info_Num_TexCoords->SetText( VarArgs( "%1i", numTex ) );
	m_pLabel_Info_Num_Colors->SetText( VarArgs( "%1i", numCol ) );

	for ( int d = 0; d < 3; d++ )
		m_pCBox_DType_TexCoords[d]->SetEnabled( numTex - 1 >= d );
	for ( int d = 0; d < 2; d++ )
		m_pCBox_DType_Color[d]->SetEnabled( numCol - 1 >= d );
}
开发者ID:Biohazard90,项目名称:source-shader-editor,代码行数:13,代码来源:vsheet_vsinput.cpp

示例9: ObjectiveResource

//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CControlPointIcon::UpdateImage( void )
{
	int iOwner = ObjectiveResource()->GetOwningTeam( m_iCPIndex );

	if ( m_pBaseImage )
	{
		int iOwnerIcon = ObjectiveResource()->GetCPCurrentOwnerIcon( m_iCPIndex, iOwner );
		const char *szMatName = GetMaterialNameFromIndex( iOwnerIcon );

		if ( IsPointLocked() )
		{
			m_pBaseImage->SetImage( VarArgs("..\\%s_locked", szMatName ) );
		}
		else
		{
			m_pBaseImage->SetImage( VarArgs("..\\%s", szMatName ) );
		}
	}

	if ( m_pOverlayImage )
	{
		int iOverlayIcon = ObjectiveResource()->GetOverlayForTeam( m_iCPIndex, iOwner );
		if ( iOverlayIcon )
		{
			const char *szMatName = GetMaterialNameFromIndex( iOverlayIcon );
			m_pOverlayImage->SetImage( VarArgs("..\\%s", szMatName ) );
			m_pOverlayImage->SetVisible( true );
		}
		else
		{
			m_pOverlayImage->SetVisible( false );
		}
	}

	// Whenever a successful cap occurs, flash the cap point
	if ( m_pCapPulseImage )
	{
		if ( m_iPrevCappers != 0 && iOwner == m_iPrevCappers )
		{
			m_iPrevCappers = 0;

			if ( ShouldDraw() )
			{
				m_pCapPulseImage->SetVisible( true );
				m_pCapPulseImage->StartPulse( gpGlobals->curtime, GetWide() );
			}
			m_pBaseImage->StartPulsing( FINISHCAPANIM_SWOOP_LENGTH, 0.5, false );
		}
		
	}
}
开发者ID:0xFEEDC0DE64,项目名称:UltraGame,代码行数:54,代码来源:hud_controlpointicons.cpp

示例10: VarArgs

void CDialog_RendertargetSettings::SetDefaults()
{
	m_pText_RTName->SetText( "" );
	m_pText_SizeX->SetText( VarArgs( "%i", RT_DEFAULT_SIZE ) );
	m_pText_SizeY->SetText( VarArgs( "%i", RT_DEFAULT_SIZE ) );

	m_pCBox_ImgFormat->ActivateItem( 0 );
	m_pCBox_SizeMode->ActivateItem( 0 );
	m_pCBox_DepthMode->ActivateItem( 2 );

	for ( int i = 0; i < m_hFlag_Buttons.Count(); i++ )
	{
		m_hFlag_Buttons[i]->SetSelected( (TEXTUREFLAGS_RENDERTARGET & ( 1 << i )) != 0 );
	}
}
开发者ID:Biohazard90,项目名称:source-shader-editor,代码行数:15,代码来源:vdialogrtlist.cpp

示例11: BuildStringSheet

void CSheet_Array::OnApplyChanges()
{
	int cur_x, cur_y;
	char ***entries = BuildStringSheet( cur_x, cur_y );
	int iEnum = clamp( m_pCBox_Datatype->GetActiveItem(), 0, 3 );

	pData->SetInt( "i_array_datatype", ::GetVarTypeFlag( iEnum ) );
	pData->SetInt( "i_array_size_x", cur_x );
	pData->SetInt( "i_array_size_y", cur_y );

	::TokenChannels_t tokens;

	for ( int x = 0; x < cur_x; x++ )
	{
		for ( int y = 0; y < cur_y; y++ )
		{
			int element = cur_y * x + y;
			//m_hArray_X_Major[ x ]->Element( y )->GetText( tmp, sizeof( tmp ) );
			char *str = entries[x][y];
			char tmp[MAX_PATH];

			tokens.bAllowChars = false;
			tokens.Tokenize( str );
			tokens.PrintTargetString( tmp, sizeof( tmp ) );
			pData->SetString( VarArgs( "pfl_arraydata_%03i", element ), tmp );
		}
	}

	DestroyStringSheet( entries, cur_x, cur_y );
}
开发者ID:BSVino,项目名称:source-shader-editor,代码行数:30,代码来源:vsheet_array.cpp

示例12: KeyValues

void CEditorRoot::SaveLayout()
{
	KeyValues *pKV = new KeyValues( "config" );

	pKV->SetInt( "preview_visible", (pPreview && pPreview->IsVisible()) );
	if ( pPreview )
		pPreview->GetBounds( px, py, psx, psy );

	pKV->SetInt( "p_x", px );
	pKV->SetInt( "p_y", py );
	pKV->SetInt( "p_sx", psx );
	pKV->SetInt( "p_sy", psy );

	pKV->SetInt( "draw_datatypes", m_bDraw_Datatypes ? 1 : 0 );
	pKV->SetInt( "draw_shadows", m_bDraw_Shadows ? 1 : 0 );
	pKV->SetInt( "draw_all_limits", m_bDraw_AllLimits ? 1 : 0 );
	pKV->SetInt( "compile_preview", m_bAutoCompile ? 1 : 0 );
	pKV->SetInt( "enable_nodeview_tooltips", m_bDoTooltips ? 1 : 0 );
	pKV->SetInt( "compile_always_full", m_bAutoFullcompile ? 1 : 0 );
	pKV->SetInt( "compile_auto_publish_to_materials", m_bAutoShaderPublish ? 1 : 0 );
	pKV->SetInt( "precache_auto_reload", m_bAutoPrecacheUpdate ? 1 : 0 );
	pKV->SetInt( "warn_unsaved_changes", m_bWarnOnClose ? 1 : 0 );

	pKV->SetInt( "cedit_x", cedit_x );
	pKV->SetInt( "cedit_y", cedit_y );
	pKV->SetInt( "cedit_sx", cedit_sx );
	pKV->SetInt( "cedit_sy", cedit_sy );
	
	pKV->SaveToFile( filesystem, VarArgs( "%s/shadereditorui/editor_config.txt", engine->GetGameDirectory()), "MOD" );
	pKV->deleteThis();

	//DeallocPingPongRTs();
}
开发者ID:Biohazard90,项目名称:source-shader-editor,代码行数:33,代码来源:veditorroot.cpp

示例13: CreateBridgeRestoreData_In

void CNodePSOutput::Setup( SETUP_HLSL_PS_Output info )
{
	int numInputs = 0;
	numInputs += info.iNumRTs;
	if ( info.bDepth )
		numInputs += 1;

	CUtlVector< BridgeRestoreInfo* >m_hRestoreBridges;
	CreateBridgeRestoreData_In( CBaseNode::BY_RESTYPE, m_hRestoreBridges );

	GenerateJacks_Input( numInputs );

	int curInput = 0;

	for ( int i = 0; i < info.iNumRTs; i++ )
	{
		GetJack_In( curInput )->SetResourceType( RESOURCETYPE_COLOR_0 + i );
		LockJackInput_Flags( curInput, HLSLVAR_FLOAT4, VarArgs("Color %i",i) );
		curInput++;
	}
	if ( info.bDepth )
	{
		GetJack_In( curInput )->SetResourceType( RESOURCETYPE_DEPTH );
		LockJackInput_Flags( curInput, HLSLVAR_FLOAT1, "Depth" );
		curInput++;
	}

	curSetup = info;
	RestoreBridgesFromList_In( m_hRestoreBridges );
}
开发者ID:BSVino,项目名称:source-shader-editor,代码行数:30,代码来源:vnode_psoutput.cpp

示例14: LevelInitPreEntity

	virtual void LevelInitPreEntity()
	{
		BaseClass::LevelInitPreEntity();

		if (engine->IsPlayingDemo())
			return;

		if (engine->IsRecordingDemo())
			return;

		if (asw_auto_record.GetBool())
		{
			if (asw_auto_record.GetInt() > 0)
			{
				DeleteOldRecordings(asw_auto_record.GetInt() - 1);
			}

			struct tm now;
			Plat_GetLocalTime(&now);
			// we assume a map will only be started once per second, and that if a map is started multiple times per second, the old recordings aren't useful.
			// our date format is RFC2550 compliant until January 1st 10000.
			engine->ClientCmd_Unrestricted(VarArgs("record \"aswauto-%04d%02d%02d%02d%02d%02d_%s\"", now.tm_year + 1900, now.tm_mon + 1, now.tm_mday, now.tm_hour, now.tm_min, now.tm_sec, MapName()));
			m_bIsRecording = true;
		}
	}
开发者ID:BenLubar,项目名称:SwarmDirector2,代码行数:25,代码来源:asw_auto_record.cpp

示例15: Briefing

void CNB_Spend_Skill_Points::OnThink()
{
	BaseClass::OnThink();

	CASW_Marine_Profile *pProfile = Briefing()->GetMarineProfileByProfileIndex( m_nProfileIndex );
	if ( pProfile )
	{
		char imagename[255];
		Q_snprintf( imagename, sizeof(imagename), "briefing/face_%s", pProfile->m_PortraitName );
		m_pSelectedMarine->SetImage( imagename );

		m_pMarineNameLabel->SetText( pProfile->GetShortName() );
		m_pBioLabel->SetText( pProfile->m_Bio );
		int nMouseOverSkill = -1;
		for ( int i = 0; i < NUM_SKILL_PANELS; i++ )
		{
			m_pSkillPanel[ i ]->SetSkillDetails( m_nProfileIndex, i, Briefing()->GetProfileSkillPoints( m_nProfileIndex, i ) );
			m_pSkillPanel[ i ]->m_bSpendPointsMode = true;
			if ( m_pSkillPanel[ i ]->IsCursorOver() )
			{
				nMouseOverSkill = i;
			}
		}	
		if ( nMouseOverSkill != -1 && MarineSkills() )
		{
			ASW_Skill nSkillIndex = pProfile->GetSkillMapping( nMouseOverSkill );		// translate from skill slot to skill index

			m_pSkillTitle->SetText( MarineSkills()->GetSkillName( nSkillIndex ) );
			m_pSkillDescription->SetText( MarineSkills()->GetSkillDescription( nSkillIndex ) );
		}
		m_pSpareSkillPointsLabel->SetText( VarArgs( "%d", Briefing()->GetProfileSkillPoints( m_nProfileIndex, ASW_SKILL_SLOT_SPARE ) ) );
	}
}
开发者ID:BenLubar,项目名称:SwarmDirector2,代码行数:33,代码来源:nb_spend_skill_points.cpp


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