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


C++ BaseModHybridButton::HasFocus方法代码示例

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


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

示例1: PaintBackground

void GameModes::PaintBackground()
{
	if ( !m_GameModeInfos.Count() )
		return;

	BaseModHybridButton *pHybridButton = m_GameModeInfos[m_nActive].m_pHybridButton;
	bool bHasFocus = pHybridButton->HasFocus() || 
					( pHybridButton->GetCurrentState() == BaseModHybridButton::Focus ) ||
					( pHybridButton->GetCurrentState() == BaseModHybridButton::FocusDisabled );
	bool bIsOpen = ( pHybridButton->GetCurrentState() == BaseModHybridButton::Open );

	// update scroll
	// varies between [0..1] or [1..0]
	float t = 0;
	if ( m_startScrollTime )
	{
		float rate = ( m_nScrollMultipleCount >= 1 ) ? 8.0f : 5.0f;
		t = ( Plat_FloatTime() - m_startScrollTime ) * rate;
		if ( t >= 1.0f )
		{
			// finished, scroll is circular warp around
			t = 1.0f;
			m_startScrollTime = 0;

			int nNewActive = 0;
			if ( m_bLeftScroll )
			{
				nNewActive = ( m_nActive + 1 ) % m_GameModeInfos.Count();
			}
			else
			{
				nNewActive = ( m_nActive - 1 + m_GameModeInfos.Count() ) % m_GameModeInfos.Count();
			}
			SetActiveGameMode( nNewActive, bHasFocus );

			if ( --m_nScrollMultipleCount > 0 )
			{
				m_startScrollTime = Plat_FloatTime();
				t = 0;
			}
		}
	}

	int panelWidth, panelHeight;
	GetSize( panelWidth, panelHeight );

// need this to see panel bounds during debugging
//vgui::surface()->DrawSetColor( Color( 255, 0, 0, 255 ) );
//vgui::surface()->DrawFilledRect( 0, 0, panelWidth, panelHeight );

	// the main pic and all the subpics
	int nPicCount = 1 + m_nSubPics;
	if ( m_startScrollTime && m_bLeftScroll )
	{
		// scrolling means one extra sub pic must be drawn at the far right edge
		// either coming/going
		nPicCount++;
	}

	int nOffscreenSubPicX = m_nPicOffsetX - m_nSubPicOffsetX - m_nSubPicWidth;
	int nOffscreenSubPicY = m_nSubPicY;
	int nOffscreenSubPicW = m_nSubPicWidth;
	int nOffscreenSubPicH = m_nSubPicHeight;

	int nActivePicX = m_nPicOffsetX;
	int nActivePicY = 0;
	int nActivePicW = m_nPicWidth;
	int nActivePicH = m_nPicHeight;
	float nActiveAngle = 0; //-3;

	int x, y;
	int w, h;

	int iPrevActiveMode = ( m_nActive - 1 + m_GameModeInfos.Count() ) % m_GameModeInfos.Count(); 
	int iNextActiveMode = ( m_nActive + 1 ) % m_GameModeInfos.Count();

	// center the vertical smear
	y = nActivePicY + nActivePicH + m_nMenuTitleY + ( m_nMenuTitleActualTall - m_nMenuTitleTall )/2;
	vgui::surface()->DrawSetColor( m_smearColor );
	DrawSmearBackgroundFade( 
		m_nMenuTitleX - ( 0.30f * m_nMenuTitleX ), 
		y, 
		m_nSubPicX + m_nSubPics * ( m_nSubPicWidth + m_nSubPicGap ), 
		y + m_nMenuTitleTall ); 

	// cyclical carousel
	// the first pic to be drawn is the active main pic, followed by all the sub pics
	for ( int i = 0; i < nPicCount; i++ )
	{
		int iGameMode = ( m_nActive + i ) % m_GameModeInfos.Count();

		// in between scrolling, this image transition gets handled by specialized lerp drawing
		bool bSkipSubPicDraw = m_startScrollTime && ( m_bLeftScroll && ( iGameMode == iNextActiveMode ) );

		if ( !i )
		{
			// active pic
			x = nActivePicX;
			y = nActivePicY;
			w = nActivePicW;
//.........这里部分代码省略.........
开发者ID:Muini,项目名称:Nag-asw,代码行数:101,代码来源:gamemodes.cpp


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