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


C++ Panel::GetTall方法代码示例

本文整理汇总了C++中Panel::GetTall方法的典型用法代码示例。如果您正苦于以下问题:C++ Panel::GetTall方法的具体用法?C++ Panel::GetTall怎么用?C++ Panel::GetTall使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Panel的用法示例。


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

示例1: OnThink

void QuickJoinPanel::OnThink()
{
	int iNumItems = MIN( m_FriendInfo.Count(), cl_quick_join_scroll_max.GetInt() );

	const int iItemTallMin = 2;
	int iItemTall = iItemTallMin;

	Panel *pItem = m_GplQuickJoinList->GetPanelItem( 0 );
	if ( pItem )
	{
		iItemTall = pItem->GetTall();

		Panel *pItem2 = m_GplQuickJoinList->GetPanelItem( 1 );
		if ( pItem2 )
		{
			int iXPos1, iYPos1;
			int iXPos2, iYPos2;

			pItem->GetPos( iXPos1, iYPos1 );
			pItem2->GetPos( iXPos2, iYPos2 );

			iItemTall = iYPos2 - iYPos1;
		}
	}

	iItemTall = MAX( iItemTall, iItemTallMin );

	long lRateValue = ( system()->GetTimeMillis() / cl_quick_join_scroll_rate.GetInt() );
	int iWrap = ( lRateValue / iItemTall ) + cl_quick_join_scroll_max.GetInt();

	if ( iWrap != m_iPrevWrap )
	{
		RefreshContents( iWrap );
		m_iPrevWrap = iWrap;

		UpdateNumGamesFoundLabel();

		SetVisible( m_FriendInfo.Count() > 0 );

		// Fade out last item completely since we wrapped around and done!
		pItem = m_GplQuickJoinList->GetPanelItem( ( iNumItems > 1 ) ? ( iNumItems - 1 ) : ( 1 ) );
		if ( pItem )
			pItem->SetAlpha( 0.0f );
		return;
	}

	int screenWide, screenTall;
	vgui::surface()->GetScreenSize( screenWide, screenTall );

	int iYOffset = 110;
	if ( IsPC() )
	{
		iYOffset = 30;
	}

	bool bScrolling = ( iNumItems >= cl_quick_join_scroll_start.GetInt() );

	int iCurrentX, iCurrentY;
	GetPos( iCurrentX, iCurrentY );
	iCurrentY = GetSmoothPanelY( iCurrentY, screenTall
								 - vgui::scheme()->GetProportionalScaledValue( iYOffset )
								 - MAX( iNumItems, ( bScrolling ) ? ( 2 ) : ( 1 ) ) * iItemTall );
	SetPos( iCurrentX, iCurrentY );

	if ( iNumItems > cl_quick_join_scroll_start.GetInt() - 1 )
	{
		// Scrolling list illusion
		int iTimeOffset = lRateValue % iItemTall;

		float fTimeOffset = iTimeOffset;

		m_GplQuickJoinList->GetPos( iCurrentX, iCurrentY );
		m_GplQuickJoinList->SetPos( iCurrentX, fTimeOffset + vgui::scheme()->GetProportionalScaledValue( cl_quick_join_scroll_offset.GetFloat() ) );

		float fListEdgeAlphas = 255.0f * ( fTimeOffset / static_cast<float>( iItemTall ) );

		// Fade in first item
		pItem = m_GplQuickJoinList->GetPanelItem( 0 );
		if ( pItem )
		{
			pItem->SetAlpha( fListEdgeAlphas );
		}

		// Fade out last item
		pItem = m_GplQuickJoinList->GetPanelItem( ( iNumItems > 1 ) ? ( iNumItems - 1 ) : ( 1 ) );

		if ( pItem )
		{
			pItem->SetAlpha( 255.0f - fListEdgeAlphas );
		}
	}
	else
	{
		m_GplQuickJoinList->GetPos( iCurrentX, iCurrentY );
		m_GplQuickJoinList->SetPos( iCurrentX, vgui::scheme()->GetProportionalScaledValue( cl_quick_join_scroll_offset.GetFloat() ) );
	}
}
开发者ID:BenLubar,项目名称:SwarmDirector2,代码行数:97,代码来源:vquickjoin.cpp


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