本文整理汇总了C++中IScheme::GetColor方法的典型用法代码示例。如果您正苦于以下问题:C++ IScheme::GetColor方法的具体用法?C++ IScheme::GetColor怎么用?C++ IScheme::GetColor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IScheme
的用法示例。
在下文中一共展示了IScheme::GetColor方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetTextColorForClient
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
Color CHudChat::GetTextColorForClient( TextColor colorNum, int clientIndex )
{
IScheme *pScheme = scheme()->GetIScheme( GetScheme() );
if ( pScheme == NULL )
return Color( 255, 255, 255, 255 );
Color c;
switch ( colorNum )
{
case COLOR_PLAYERNAME:
c = GetClientColor( clientIndex );
break;
case COLOR_LOCATION:
c = g_ColorDarkGreen;
break;
case COLOR_ACHIEVEMENT:
{
IScheme *pSourceScheme = scheme()->GetIScheme( scheme()->GetScheme( "SourceScheme" ) );
if ( pSourceScheme )
{
c = pSourceScheme->GetColor( "SteamLightGreen", GetBgColor() );
}
else
{
c = pScheme->GetColor( "TFColors.ChatTextYellow", GetBgColor() );
}
}
break;
default:
c = pScheme->GetColor( "TFColors.ChatTextYellow", GetBgColor() );
}
return Color( c[0], c[1], c[2], 255 );
}
示例2: GetClientColor
//-----------------------------------------------------------------------------
Color CHudChat::GetClientColor( int clientIndex )
{
IScheme *pScheme = scheme()->GetIScheme( GetScheme() );
if ( pScheme == NULL )
return Color( 255, 255, 255, 255 );
if ( clientIndex == 0 ) // console msg
{
return g_ColorGreen;
}
else if( g_PR )
{
int iTeam = g_PR->GetTeam( clientIndex );
C_TFPlayer *pPlayer = ToTFPlayer( UTIL_PlayerByIndex( clientIndex ) );
C_TFPlayer *pLocalPlayer = C_TFPlayer::GetLocalTFPlayer();
if ( IsVoiceSubtitle() == true )
{
// if this player is on the other team, disguised as my team, show disguised color
if ( pPlayer && pLocalPlayer && pPlayer->m_Shared.InCond( TF_COND_DISGUISED ) &&
pPlayer->m_Shared.GetDisguiseTeam() == pLocalPlayer->GetTeamNumber() )
{
iTeam = pPlayer->m_Shared.GetDisguiseTeam();
}
}
switch ( iTeam )
{
case TF_TEAM_RED : return pScheme->GetColor( "TFColors.ChatTextRed", g_ColorRed );
case TF_TEAM_BLUE : return pScheme->GetColor( "TFColors.ChatTextBlue", g_ColorBlue );;
default : return g_ColorGrey;
}
}
return g_ColorYellow;
}
示例3: ApplySettings
//-----------------------------------------------------------------------------
// Purpose: Applies designer settings from res file
//-----------------------------------------------------------------------------
void ImagePanel::ApplySettings(KeyValues *inResourceData)
{
delete [] m_pszImageName;
delete [] m_pszFillColorName;
delete [] m_pszDrawColorName; // HPE addition
m_pszImageName = NULL;
m_pszFillColorName = NULL;
m_pszDrawColorName = NULL; // HPE addition
//Center image isn't implemented in Source 2013. - Solokiller
m_bCenterImage = inResourceData->GetInt( "centerImage", 0 ) != 0;
m_bScaleImage = inResourceData->GetInt("scaleImage", 0) != 0;
m_fScaleAmount = inResourceData->GetFloat( "scaleAmount", 0.0f );
m_bTileImage = inResourceData->GetInt( "tileImage", 0 ) != 0;
m_bTileHorizontally = inResourceData->GetInt( "tileHorizontally", m_bTileImage ) != 0;
m_bTileVertically = inResourceData->GetInt( "tileVertically", m_bTileImage ) != 0;
const char *imageName = inResourceData->GetString("image", "");
if (*imageName)
{
SetImage( imageName );
}
const char *pszFillColor = inResourceData->GetString("fillcolor", "");
if (*pszFillColor)
{
int r = 0, g = 0, b = 0, a = 255;
int len = Q_strlen(pszFillColor) + 1;
m_pszFillColorName = new char[ len ];
Q_strncpy( m_pszFillColorName, pszFillColor, len );
if (sscanf(pszFillColor, "%d %d %d %d", &r, &g, &b, &a) >= 3)
{
// it's a direct color
m_FillColor = SDK_Color(r, g, b, a);
}
else
{
IScheme *pScheme = scheme()->GetIScheme( GetScheme() );
m_FillColor = pScheme->GetColor(pszFillColor, SDK_Color(0, 0, 0, 0));
}
}
//=============================================================================
// HPE_BEGIN:
// [pfreese] Added support for specifying drawcolor
//=============================================================================
const char *pszDrawColor = inResourceData->GetString( "drawcolor", "" );
if( *pszDrawColor )
{
int r = 255, g = 255, b = 255, a = 255;
int len = Q_strlen( pszDrawColor ) + 1;
m_pszDrawColorName = new char[ len ];
Q_strncpy( m_pszDrawColorName, pszDrawColor, len );
if( sscanf( pszDrawColor, "%d %d %d %d", &r, &g, &b, &a ) >= 3 )
{
// it's a direct color
m_DrawColor = SDK_Color( r, g, b, a );
}
else
{
IScheme *pScheme = scheme()->GetIScheme( GetScheme() );
m_DrawColor = pScheme->GetColor( pszDrawColor, SDK_Color( 255, 255, 255, 255 ) );
}
}
//=============================================================================
// HPE_END
//=============================================================================
const char *pszBorder = inResourceData->GetString("border", "");
if (*pszBorder)
{
IScheme *pScheme = scheme()->GetIScheme( GetScheme() );
SetBorder(pScheme->GetBorder(pszBorder));
}
BaseClass::ApplySettings(inResourceData);
}
示例4: LoadDictionary
void CViewport::LoadDictionary(void)
{
CSV::CSVDocument doc;
CSV::CSVDocument::row_index_type row_count;
//Parse from the document
try
{
row_count = doc.load_file("captionmod/dictionary.csv");
}
catch(std::exception &err)
{
Sys_ErrorEx("%s\n%s", "LoadDictionary: ", err.what());
}
if(row_count < 2)
return;
IScheme *ischeme = scheme()->GetIScheme(GetScheme());
if(!ischeme)
return;
Color defaultColor = ischeme->GetColor("BaseText", Color(255, 255, 255, 200));
//Initialize the dictionary hashtable
m_StringsHashTable.SetSize(2048);
for (int i = 0; i < m_StringsHashTable.Count(); i++)
m_StringsHashTable[i].next = NULL;
EmptyDictionaryHash();
int nRowCount = row_count;
//parse the dictionary line by line...
for (int i = 1;i < nRowCount; ++i)
{
CSV::CSVDocument::row_type row = doc.get_row(i);
if(row.size() < 1)
continue;
const char *title = row[0].c_str();
if(!title || !title[0])
continue;
CDictionary *Dict = new CDictionary;
Dict->Load(row, defaultColor, ischeme);
m_Dictionary.AddToTail(Dict);
AddDictionaryHash(Dict, Dict->m_szTitle);
}
//Link the dictionaries
for(int i = 0; i < m_Dictionary.Count(); ++i)
{
CDictionary *Dict = m_Dictionary[i];
if(Dict->m_szNext[0])
{
Dict->m_pNext = FindDictionary(Dict->m_szNext);
}
}
}
示例5: ParseScriptFile
//.........这里部分代码省略.........
cmdAnimate.variable = g_ScriptSymbols.AddString(token);
// target value
pMem = ParseFile(pMem, token, NULL);
if (cmdAnimate.variable == m_sPosition)
{
// Get first token
SetupPosition( cmdAnimate, &cmdAnimate.target.a, token, screenWide );
// Get second token from "token"
char token2[32];
char *psz = ParseFile(token, token2, NULL);
psz = ParseFile(psz, token2, NULL);
psz = token2;
// Position Y goes into ".b"
SetupPosition( cmdAnimate, &cmdAnimate.target.b, psz, screenTall );
}
else if ( cmdAnimate.variable == m_sXPos )
{
// XPos and YPos both use target ".a"
SetupPosition( cmdAnimate, &cmdAnimate.target.a, token, screenWide );
}
else if ( cmdAnimate.variable == m_sYPos )
{
// XPos and YPos both use target ".a"
SetupPosition( cmdAnimate, &cmdAnimate.target.a, token, screenTall );
}
else
{
// parse the floating point values right out
if (0 == sscanf(token, "%f %f %f %f", &cmdAnimate.target.a, &cmdAnimate.target.b, &cmdAnimate.target.c, &cmdAnimate.target.d))
{
// could be referencing a value in the scheme file, lookup
Color col = scheme->GetColor(token, Color(0, 0, 0, 0));
cmdAnimate.target.a = col[0];
cmdAnimate.target.b = col[1];
cmdAnimate.target.c = col[2];
cmdAnimate.target.d = col[3];
}
}
// fix up scale
if (cmdAnimate.variable == m_sSize)
{
if (IsProportional())
{
cmdAnimate.target.a = static_cast<float>( vgui::scheme()->GetProportionalScaledValueEx(GetScheme(), cmdAnimate.target.a) );
cmdAnimate.target.b = static_cast<float>( vgui::scheme()->GetProportionalScaledValueEx(GetScheme(), cmdAnimate.target.b) );
}
}
else if (cmdAnimate.variable == m_sWide ||
cmdAnimate.variable == m_sTall )
{
if (IsProportional())
{
// Wide and tall both use.a
cmdAnimate.target.a = static_cast<float>( vgui::scheme()->GetProportionalScaledValueEx(GetScheme(), cmdAnimate.target.a) );
}
}
// interpolation function
pMem = ParseFile(pMem, token, NULL);
if (!stricmp(token, "Accel"))
{
cmdAnimate.interpolationFunction = INTERPOLATOR_ACCEL;
}