本文整理汇总了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;
//.........这里部分代码省略.........