本文整理汇总了C++中CSchemeManager::getSchemeHandle方法的典型用法代码示例。如果您正苦于以下问题:C++ CSchemeManager::getSchemeHandle方法的具体用法?C++ CSchemeManager::getSchemeHandle怎么用?C++ CSchemeManager::getSchemeHandle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CSchemeManager
的用法示例。
在下文中一共展示了CSchemeManager::getSchemeHandle方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CFirstMenu
CFirstMenu :: CFirstMenu(int iTrans, int iRemoveMe, int x, int y, int wide, int tall) : CMenuPanel(iTrans, iRemoveMe, x,y,wide,tall)
{
CSchemeManager *pSchemes = gViewPort->GetSchemeManager();
SchemeHandle_t hTitleScheme = pSchemes->getSchemeHandle( "Title Font" );
int r, g, b, a;
m_pPanel = new CTransparentPanel( 200, XRES(80), YRES(80), XRES(BASE_WIDTH), YRES(BASE_HEIGHT));
m_pPanel->setParent( this );
m_pPanel->setBorder( new LineBorder( Color(255 * 0.7,170 * 0.7,0,0) ) );
m_pCancelButton = new CommandButton( gHUD.m_TextMessage.BufferedLocaliseTextString( "Cancel" ),
XRES(50), YRES(279), XRES(378), YRES(42));
m_pCancelButton->setContentAlignment(vgui::Label::a_center);
m_pCancelButton->setParent( m_pPanel );
m_pCancelButton->addActionSignal( new CMenuHandler_TextWindow(HIDE_TEXTWINDOW) );
m_pTitle = new Label( "", XRES(1), YRES(1), XRES(478), YRES(58) );
m_pTitle->setParent( m_pPanel );
m_pTitle->setFont( pSchemes->getFont(hTitleScheme) );
pSchemes->getFgColor( hTitleScheme, r, g, b, a );
m_pTitle->setFgColor( r, g, b, a );
pSchemes->getBgColor( hTitleScheme, r, g, b, a );
m_pTitle->setBgColor( r, g, b, a );
m_pTitle->setContentAlignment( vgui::Label::a_center );
m_pTitle->setText( "Your First Menu" );
// Start - VGUI Tutorial 2
m_pSpeak = new CommandButton( "Say something", XRES(1), YRES(61), XRES(478), YRES(58));
m_pSpeak->setContentAlignment( vgui::Label::a_center );
m_pSpeak->setParent( m_pPanel );
m_pSpeak->addActionSignal( new CMenuHandler_StringCommand( "test_say" ) );
// End - VGUI Tutorial 2
// Start - VGUI Tutorial 3
/*
m_pEditbox = new TextEntry( "Testing!", XRES(200), YRES(230), XRES(230), 17);
m_pEditbox->setVisible( true );
m_pEditbox->setParent( m_pPanel );
*/
m_pMyPicture = new CImageLabel( "cross", XRES(BASE_WIDTH/2), YRES(BASE_HEIGHT/2) );
m_pMyPicture->setParent( m_pPanel );
m_pMyPicture->setVisible( true );
// End - VGUI Tutorial 3
}
示例2: CMenuPanel
// Creation
CClassMenuPanel::CClassMenuPanel(int iTrans, int iRemoveMe, int x,int y,int wide,int tall) : CMenuPanel(iTrans, iRemoveMe, x,y,wide,tall)
{
// don't show class graphics at below 640x480 resolution
bool bShowClassGraphic = true;
if ( ScreenWidth < 640 )
{
bShowClassGraphic = false;
}
memset( m_pClassImages, 0, sizeof(m_pClassImages) );
// Get the scheme used for the Titles
CSchemeManager *pSchemes = gViewPort->GetSchemeManager();
// schemes
SchemeHandle_t hTitleScheme = pSchemes->getSchemeHandle( "Title Font" );
SchemeHandle_t hClassWindowText = pSchemes->getSchemeHandle( "Briefing Text" );
// color schemes
int r, g, b, a;
// Create the title
Label *pLabel = new Label( "", CLASSMENU_TITLE_X, CLASSMENU_TITLE_Y );
pLabel->setParent( this );
pLabel->setFont( pSchemes->getFont(hTitleScheme) );
pSchemes->getFgColor( hTitleScheme, r, g, b, a );
pLabel->setFgColor( r, g, b, a );
pSchemes->getBgColor( hTitleScheme, r, g, b, a );
pLabel->setBgColor( r, g, b, a );
pLabel->setContentAlignment( vgui::Label::a_west );
pLabel->setText(gHUD.m_TextMessage.BufferedLocaliseTextString("#Title_SelectYourClass"));
// Create the Scroll panel
m_pScrollPanel = new CTFScrollPanel( CLASSMENU_WINDOW_X, CLASSMENU_WINDOW_Y, CLASSMENU_WINDOW_SIZE_X, CLASSMENU_WINDOW_SIZE_Y );
m_pScrollPanel->setParent(this);
//force the scrollbars on, so after the validate clientClip will be smaller
m_pScrollPanel->setScrollBarAutoVisible(false, false);
m_pScrollPanel->setScrollBarVisible(true, true);
m_pScrollPanel->setBorder( new LineBorder( Color(255 * 0.7,170 * 0.7,0,0) ) );
m_pScrollPanel->validate();
int clientWide=m_pScrollPanel->getClient()->getWide();
//turn scrollpanel back into auto show scrollbar mode and validate
m_pScrollPanel->setScrollBarAutoVisible(false,true);
m_pScrollPanel->setScrollBarVisible(false,false);
m_pScrollPanel->validate();
// Create the Class buttons
for (int i = 0; i <= PC_RANDOM; i++)
{
char sz[256];
int iYPos = CLASSMENU_TOPLEFT_BUTTON_Y + ( (CLASSMENU_BUTTON_SIZE_Y + CLASSMENU_BUTTON_SPACER_Y) * i );
ActionSignal *pASignal = new CMenuHandler_StringCommandClassSelect( sTFClassSelection[i], true );
// Class button
sprintf(sz, "%s", CHudTextMessage::BufferedLocaliseTextString( sLocalisedClasses[i] ) );
m_pButtons[i] = new ClassButton( i, sz, CLASSMENU_TOPLEFT_BUTTON_X, iYPos, CLASSMENU_BUTTON_SIZE_X, CLASSMENU_BUTTON_SIZE_Y, true);
// RandomPC uses '0'
if ( i >= 1 && i <= 9 )
{
sprintf(sz,"%d",i);
}
else
{
sprintf(sz,"0");
}
m_pButtons[i]->setBoundKey( sz[0] );
m_pButtons[i]->setContentAlignment( vgui::Label::a_west );
m_pButtons[i]->addActionSignal( pASignal );
m_pButtons[i]->addInputSignal( new CHandler_MenuButtonOver(this, i) );
m_pButtons[i]->setParent( this );
// Create the Class Info Window
//m_pClassInfoPanel[i] = new CTransparentPanel( 255, CLASSMENU_WINDOW_X, CLASSMENU_WINDOW_Y, CLASSMENU_WINDOW_SIZE_X, CLASSMENU_WINDOW_SIZE_Y );
m_pClassInfoPanel[i] = new CTransparentPanel( 255, 0, 0, clientWide, CLASSMENU_WINDOW_SIZE_Y );
m_pClassInfoPanel[i]->setParent( m_pScrollPanel->getClient() );
//m_pClassInfoPanel[i]->setVisible( false );
// don't show class pic in lower resolutions
int textOffs = XRES(8);
if ( bShowClassGraphic )
{
textOffs = CLASSMENU_WINDOW_NAME_X;
}
// Create the Class Name Label
sprintf(sz, "#Title_%s", sTFClassSelection[i]);
char* localName=CHudTextMessage::BufferedLocaliseTextString( sz );
Label *pNameLabel = new Label( "", textOffs, CLASSMENU_WINDOW_NAME_Y );
pNameLabel->setFont( pSchemes->getFont(hTitleScheme) );
pNameLabel->setParent( m_pClassInfoPanel[i] );
pSchemes->getFgColor( hTitleScheme, r, g, b, a );
pNameLabel->setFgColor( r, g, b, a );
pSchemes->getBgColor( hTitleScheme, r, g, b, a );
pNameLabel->setBgColor( r, g, b, a );
pNameLabel->setContentAlignment( vgui::Label::a_west );
//.........这里部分代码省略.........
示例3: CMenuPanel
// Creation
CTeamMenuPanel::CTeamMenuPanel(int iTrans, int iRemoveMe, int x,int y,int wide,int tall) : CMenuPanel(iTrans, iRemoveMe, x,y,wide,tall)
{
// Get the scheme used for the Titles
CSchemeManager *pSchemes = gViewPort->GetSchemeManager();
// schemes
SchemeHandle_t hTitleScheme = pSchemes->getSchemeHandle( "Title Font" );
SchemeHandle_t hTeamWindowText = pSchemes->getSchemeHandle( "Briefing Text" );
SchemeHandle_t hTeamInfoText = pSchemes->getSchemeHandle( "Team Info Text" );
// get the Font used for the Titles
Font *pTitleFont = pSchemes->getFont( hTitleScheme );
int r, g, b, a;
// Create the title
Label *pLabel = new Label( "", TEAMMENU_TITLE_X, TEAMMENU_TITLE_Y );
pLabel->setParent( this );
pLabel->setFont( pTitleFont );
pSchemes->getFgColor( hTitleScheme, r, g, b, a );
pLabel->setFgColor( r, g, b, a );
pSchemes->getBgColor( hTitleScheme, r, g, b, a );
pLabel->setBgColor( r, g, b, a );
pLabel->setContentAlignment( vgui::Label::a_west );
pLabel->setText( "%s", gHUD.m_TextMessage.BufferedLocaliseTextString("#Title_SelectYourTeam"));
// Create the Info Window
m_pTeamWindow = new CTransparentPanel( 255, TEAMMENU_WINDOW_X, TEAMMENU_WINDOW_Y, TEAMMENU_WINDOW_SIZE_X, TEAMMENU_WINDOW_SIZE_Y );
m_pTeamWindow->setParent( this );
m_pTeamWindow->setBorder( new LineBorder( Color(255*0.7,170*0.7,0,0 )) );
// Create the Map Name Label
m_pMapTitle = new Label( "", TEAMMENU_WINDOW_TITLE_X, TEAMMENU_WINDOW_TITLE_Y );
m_pMapTitle->setFont( pTitleFont );
m_pMapTitle->setParent( m_pTeamWindow );
pSchemes->getFgColor( hTitleScheme, r, g, b, a );
m_pMapTitle->setFgColor( r, g, b, a );
pSchemes->getBgColor( hTitleScheme, r, g, b, a );
m_pMapTitle->setBgColor( r, g, b, a );
m_pMapTitle->setContentAlignment( vgui::Label::a_west );
// Create the Scroll panel
m_pScrollPanel = new CTFScrollPanel( TEAMMENU_WINDOW_TEXT_X, TEAMMENU_WINDOW_TEXT_Y, TEAMMENU_WINDOW_SIZE_X - (TEAMMENU_WINDOW_TEXT_X * 2), TEAMMENU_WINDOW_TEXT_SIZE_Y );
m_pScrollPanel->setParent(m_pTeamWindow);
m_pScrollPanel->setScrollBarVisible(false, false);
// Create the Map Briefing panel
m_pBriefing = new TextPanel("", 0,0, TEAMMENU_WINDOW_SIZE_X - TEAMMENU_WINDOW_TEXT_X, TEAMMENU_WINDOW_TEXT_SIZE_Y );
m_pBriefing->setParent( m_pScrollPanel->getClient() );
m_pBriefing->setFont( pSchemes->getFont(hTeamWindowText) );
pSchemes->getFgColor( hTeamWindowText, r, g, b, a );
m_pBriefing->setFgColor( r, g, b, a );
pSchemes->getBgColor( hTeamWindowText, r, g, b, a );
m_pBriefing->setBgColor( r, g, b, a );
m_pBriefing->setText( gHUD.m_TextMessage.BufferedLocaliseTextString("#Map_Description_not_available") );
// Team Menu buttons
for (int i = 1; i <= 5; i++)
{
char sz[256];
int iYPos = TEAMMENU_TOPLEFT_BUTTON_Y + ( (TEAMMENU_BUTTON_SIZE_Y + TEAMMENU_BUTTON_SPACER_Y) * i );
// Team button
m_pButtons[i] = new CommandButton( "", TEAMMENU_TOPLEFT_BUTTON_X, iYPos, TEAMMENU_BUTTON_SIZE_X, TEAMMENU_BUTTON_SIZE_Y, true);
m_pButtons[i]->setParent( this );
m_pButtons[i]->setContentAlignment( vgui::Label::a_west );
m_pButtons[i]->setVisible( false );
// AutoAssign button uses special case
if (i == 5)
{
m_pButtons[5]->setBoundKey( '5' );
m_pButtons[5]->setText( gHUD.m_TextMessage.BufferedLocaliseTextString("#Team_AutoAssign") );
m_pButtons[5]->setVisible( true );
}
// Create the Signals
sprintf(sz, "jointeam %d", i);
m_pButtons[i]->addActionSignal( new CMenuHandler_StringCommandWatch( sz, true ) );
m_pButtons[i]->addInputSignal( new CHandler_MenuButtonOver(this, i) );
// Create the Team Info panel
m_pTeamInfoPanel[i] = new TextPanel("", TEAMMENU_WINDOW_INFO_X, TEAMMENU_WINDOW_INFO_Y, TEAMMENU_WINDOW_SIZE_X - TEAMMENU_WINDOW_INFO_X, TEAMMENU_WINDOW_SIZE_X - TEAMMENU_WINDOW_INFO_Y );
m_pTeamInfoPanel[i]->setParent( m_pTeamWindow );
m_pTeamInfoPanel[i]->setFont( pSchemes->getFont(hTeamInfoText) );
m_pTeamInfoPanel[i]->setFgColor( iTeamColors[i % iNumberOfTeamColors][0],
iTeamColors[i % iNumberOfTeamColors][1],
iTeamColors[i % iNumberOfTeamColors][2],
0 );
m_pTeamInfoPanel[i]->setBgColor( 0,0,0, 255 );
}
// Create the Cancel button
m_pCancelButton = new CommandButton( CHudTextMessage::BufferedLocaliseTextString( "#Menu_Cancel" ), TEAMMENU_TOPLEFT_BUTTON_X, 0, TEAMMENU_BUTTON_SIZE_X, TEAMMENU_BUTTON_SIZE_Y);
m_pCancelButton->setParent( this );
m_pCancelButton->addActionSignal( new CMenuHandler_TextWindow(HIDE_TEXTWINDOW) );
// Create the Spectate button
//.........这里部分代码省略.........
示例4: FillGrid
void ScorePanel::FillGrid()
{
CSchemeManager *pSchemes = gViewPort->GetSchemeManager();
SchemeHandle_t hScheme = pSchemes->getSchemeHandle("Scoreboard Text");
SchemeHandle_t hTitleScheme = pSchemes->getSchemeHandle("Scoreboard Title Text");
SchemeHandle_t hSmallScheme = pSchemes->getSchemeHandle("Scoreboard Small Text");
SchemeHandle_t hTinyScheme = pSchemes->getSchemeHandle("Scoreboard Tiny Text");
Font *sfont = pSchemes->getFont(hScheme);
Font *tfont = pSchemes->getFont(hTitleScheme);
Font *smallfont = pSchemes->getFont(hSmallScheme);
Font *tinyfont = pSchemes->getFont(hTinyScheme);
// update highlight position
int x, y;
getApp()->getCursorPos(x, y);
cursorMoved(x, y, this);
// remove highlight row if we're not in squelch mode
if (!GetClientVoiceMgr()->IsInSquelchMode())
{
m_iHighlightRow = -1;
}
bool bNextRowIsGap = false;
for(int row=0; row < NUM_ROWS; row++)
{
CGrid *pGridRow = &m_PlayerGrids[row];
pGridRow->SetRowUnderline(0, false, 0, 0, 0, 0, 0);
if(row >= m_iRows)
{
for(int col=0; col < NUM_COLUMNS; col++)
m_PlayerEntries[col][row].setVisible(false);
continue;
}
bool bRowIsGap = false;
if (bNextRowIsGap)
{
bNextRowIsGap = false;
bRowIsGap = true;
}
// Get the player's data
int theSortedRow = m_iSortedRows[row];
hud_player_info_t* pl_info = &g_PlayerInfoList[theSortedRow];
extra_player_info_t* theExtraPlayerInfo = &g_PlayerExtraInfo[theSortedRow];
int thePlayerClass = theExtraPlayerInfo->playerclass;
short theTeamNumber = theExtraPlayerInfo->teamnumber;
string theCustomIcon = (string)theExtraPlayerInfo->customicon;
// puzl: 0001073
short thePlayerAuthentication = theExtraPlayerInfo->auth;
bool thePlayerIsDead = false;
switch( thePlayerClass )
{
case PLAYERCLASS_DEAD_MARINE:
case PLAYERCLASS_DEAD_ALIEN:
case PLAYERCLASS_REINFORCING:
thePlayerIsDead = true;
break;
}
// Code to test DEBUG
#if 0
#ifdef DEBUG
extern int gGlobalDebugAuth;
thePlayerAuthentication = 1;
thePlayerAuthentication <<= gGlobalDebugAuth;
#endif
#endif
team_info_t* team_info = &g_TeamInfo[m_iSortedRows[row]];
int theColorIndex = theTeamNumber % iNumberOfTeamColors;
int theLocalPlayerTeam = 0;
if(gEngfuncs.GetLocalPlayer())
{
theLocalPlayerTeam = gEngfuncs.GetLocalPlayer()->curstate.team;
}
for(int col=0; col < NUM_COLUMNS; col++)
{
CLabelHeader *pLabel = &m_PlayerEntries[col][row];
pLabel->setVisible(true);
pLabel->setText2("");
pLabel->setImage(NULL);
pLabel->setFont(sfont);
pLabel->setTextOffset(0, 0);
int rowheight = 13;
if (ScreenHeight() > 480)
{
rowheight = YRES(rowheight);
}
else
{
//.........这里部分代码省略.........
示例5: if
//-----------------------------------------------------------------------------
// Purpose: Create the ScoreBoard panel
//-----------------------------------------------------------------------------
ScorePanel::ScorePanel(int x,int y,int wide,int tall) : Panel(x,y,wide,tall)
{
CSchemeManager *pSchemes = gViewPort->GetSchemeManager();
SchemeHandle_t hTitleScheme = pSchemes->getSchemeHandle("Scoreboard Title Text");
SchemeHandle_t hSmallScheme = pSchemes->getSchemeHandle("Scoreboard Small Text");
SchemeHandle_t hTinyScheme = pSchemes->getSchemeHandle("Scoreboard Tiny Text");
Font *tfont = pSchemes->getFont(hTitleScheme);
Font *smallfont = pSchemes->getFont(hSmallScheme);
Font *tinyfont = pSchemes->getFont(hTinyScheme);
setBgColor(0, 0, 0, 96);
m_pCurrentHighlightLabel = NULL;
m_iHighlightRow = -1;
// puzl: 0001073
m_pTrackerIcon = NULL;
m_pDevIcon = NULL;
m_pPTIcon = NULL;
m_pGuideIcon = NULL;
m_pServerOpIcon = NULL;
m_pContribIcon = NULL;
m_pCheatingDeathIcon = NULL;
m_pVeteranIcon = NULL;
m_pTrackerIcon = vgui_LoadTGANoInvertAlpha("gfx/vgui/640_scoreboardtracker.tga");
m_pDevIcon = vgui_LoadTGANoInvertAlpha("gfx/vgui/640_scoreboarddev.tga");
m_pPTIcon = vgui_LoadTGANoInvertAlpha("gfx/vgui/640_scoreboardpt.tga");
m_pGuideIcon = vgui_LoadTGANoInvertAlpha("gfx/vgui/640_scoreboardguide.tga");
m_pServerOpIcon = vgui_LoadTGANoInvertAlpha("gfx/vgui/640_scoreboardserverop.tga");
m_pContribIcon = vgui_LoadTGANoInvertAlpha("gfx/vgui/640_scoreboardcontrib.tga");
m_pCheatingDeathIcon = vgui_LoadTGANoInvertAlpha("gfx/vgui/640_scoreboardcd.tga");
m_pVeteranIcon = vgui_LoadTGANoInvertAlpha("gfx/vgui/640_scoreboardveteran.tga");
m_iIconFrame = 0;
m_iLastFrameIncrementTime = gHUD.GetTimeOfLastUpdate();
// Initialize the top title.
m_TitleLabel.setFont(tfont);
m_TitleLabel.setText("");
m_TitleLabel.setBgColor( 0, 0, 0, 255 );
m_TitleLabel.setFgColor( Scheme::sc_primary1 );
m_TitleLabel.setContentAlignment( vgui::Label::a_west );
LineBorder *border = new LineBorder(Color(60, 60, 60, 128));
setBorder(border);
setPaintBorderEnabled(true);
int xpos = g_ColumnInfo[0].m_Width + 3;
if (ScreenWidth() >= 640)
{
// only expand column size for res greater than 640
xpos = XRES(xpos);
}
m_TitleLabel.setBounds(xpos, 4, wide, SBOARD_TITLE_SIZE_Y);
m_TitleLabel.setContentFitted(false);
m_TitleLabel.setParent(this);
// Setup the header (labels like "name", "class", etc..).
m_HeaderGrid.SetDimensions(NUM_COLUMNS, 1);
m_HeaderGrid.SetSpacing(0, 0);
for(int i=0; i < NUM_COLUMNS; i++)
{
if (g_ColumnInfo[i].m_pTitle && g_ColumnInfo[i].m_pTitle[0] == '#')
m_HeaderLabels[i].setText(CHudTextMessage::BufferedLocaliseTextString(g_ColumnInfo[i].m_pTitle));
else if(g_ColumnInfo[i].m_pTitle)
m_HeaderLabels[i].setText(g_ColumnInfo[i].m_pTitle);
int xwide = g_ColumnInfo[i].m_Width;
if (ScreenWidth() >= 640)
{
xwide = XRES(xwide);
}
else if (ScreenWidth() == 400)
{
// hack to make 400x300 resolution scoreboard fit
if (i == 1)
{
// reduces size of player name cell
xwide -= 28;
}
else if (i == 0)
{
// tracker icon cell
xwide -= 8;
}
}
m_HeaderGrid.SetColumnWidth(i, xwide);
m_HeaderGrid.SetEntry(i, 0, &m_HeaderLabels[i]);
m_HeaderLabels[i].setBgColor(0,0,0,255);
m_HeaderLabels[i].setBgColor(0,0,0,255);
int theColorIndex = 0;
Color gammaAdjustedTeamColor = BuildColor(kTeamColors[theColorIndex][0], kTeamColors[theColorIndex][1], kTeamColors[theColorIndex][2], gHUD.GetGammaSlope());
int theR, theG, theB, theA;
gammaAdjustedTeamColor.getColor(theR, theG, theB, theA);
//.........这里部分代码省略.........
示例6: Initialize
void SpectatorPanel::Initialize()
{
int x, y, wide, tall;
getBounds(x, y, wide, tall);
CSchemeManager *pSchemes = gViewPort->GetSchemeManager();
SchemeHandle_t hSmallScheme = pSchemes->getSchemeHandle("Team Info Text");
m_TopBorder = new CTransparentPanel(64, 0, 0, ScreenWidth, PANEL_HEIGHT);
m_TopBorder->setParent(this);
m_BottomBorder = new CTransparentPanel(64, 0, ScreenHeight - PANEL_HEIGHT, ScreenWidth, PANEL_HEIGHT);
m_BottomBorder->setParent(this);
setPaintBackgroundEnabled(false);
m_ExtraInfo = new Label("Extra Info", 0, 0, wide, PANEL_HEIGHT);
m_ExtraInfo->setParent(m_TopBorder);
m_ExtraInfo->setFont(pSchemes->getFont(hSmallScheme));
m_ExtraInfo->setPaintBackgroundEnabled(false);
m_ExtraInfo->setFgColor(143, 143, 54, 0);
m_ExtraInfo->setContentAlignment(vgui::Label::a_west);
m_TimerImage = new CImageLabel("timer", 0, 0, 14, 14);
m_TimerImage->setParent(m_TopBorder);
m_TopBanner = new CImageLabel("banner", 0, 0, XRES(BANNER_WIDTH), YRES(BANNER_HEIGHT));
m_TopBanner->setParent(this);
m_CurrentTime = new Label("00:00", 0, 0, wide, PANEL_HEIGHT);
m_CurrentTime->setParent(m_TopBorder);
m_CurrentTime->setFont(pSchemes->getFont(hSmallScheme));
m_CurrentTime->setPaintBackgroundEnabled(false);
m_CurrentTime->setFgColor(143, 143, 54, 0);
m_CurrentTime->setContentAlignment(vgui::Label::a_west);
m_Separator = new Panel(0, 0, XRES(64), YRES(96));
m_Separator->setParent(m_TopBorder);
m_Separator->setFgColor(59, 58, 34, 48);
m_Separator->setBgColor(59, 58, 34, 48);
for(int j = 0; j < TEAM_NUMBER; j++)
{
m_TeamScores[j] = new Label(" ", 0, 0, wide, PANEL_HEIGHT);
m_TeamScores[j]->setParent(m_TopBorder);
m_TeamScores[j]->setFont(pSchemes->getFont(hSmallScheme));
m_TeamScores[j]->setPaintBackgroundEnabled(false);
m_TeamScores[j]->setFgColor(143, 143, 54, 0);
m_TeamScores[j]->setContentAlignment(vgui::Label::a_west);
m_TeamScores[j]->setVisible(false);
}
// Initialize command buttons.
// m_OptionButton = new ColorButton( CHudTextMessage::BufferedLocaliseTextString( "#SPECT_OPTIONS" ), XRES(15), YRES(6), XRES(OPTIONS_BUTTON_X), YRES(20), false, false );
m_OptionButton = new DropDownButton(CHudTextMessage::BufferedLocaliseTextString("#SPECT_OPTIONS"), XRES(15), YRES(6), XRES(OPTIONS_BUTTON_X), YRES(20), false, false);
m_OptionButton->setParent(m_BottomBorder);
m_OptionButton->setContentAlignment(vgui::Label::a_center);
m_OptionButton->setBoundKey((char)255); // special no bound to avoid leading spaces in name
m_OptionButton->addActionSignal(new CSpectatorHandler_Command(this, SPECTATOR_PANEL_CMD_OPTIONS));
m_OptionButton->setUnArmedBorderColor(59, 58, 34, 48);
m_OptionButton->setArmedBorderColor(194, 202, 54, 0);
m_OptionButton->setUnArmedColor(143, 143, 54, 0);
m_OptionButton->setArmedColor(194, 202, 54, 0);
m_CamButton = new DropDownButton(CHudTextMessage::BufferedLocaliseTextString("#CAM_OPTIONS"), ScreenWidth - (XRES(CAMOPTIONS_BUTTON_X) + 15), YRES(6), XRES(CAMOPTIONS_BUTTON_X), YRES(20), false, false);
m_CamButton->setParent(m_BottomBorder);
m_CamButton->setContentAlignment(vgui::Label::a_center);
m_CamButton->setBoundKey((char)255); // special no bound to avoid leading spaces in name
m_CamButton->addActionSignal(new CSpectatorHandler_Command(this, SPECTATOR_PANEL_CMD_CAMERA));
m_CamButton->setUnArmedBorderColor(59, 58, 34, 48);
m_CamButton->setArmedBorderColor(194, 202, 54, 0);
m_CamButton->setUnArmedColor(143, 143, 54, 0);
m_CamButton->setArmedColor(194, 202, 54, 0);
// m_PrevPlayerButton= new ColorButton("<", XRES( 15 + OPTIONS_BUTTON_X + 15 ), YRES(6), XRES(24), YRES(20), false, false );
m_PrevPlayerButton = new CImageButton("arrowleft", XRES(15 + OPTIONS_BUTTON_X + 15), YRES(6), XRES(24), YRES(20), false, false);
m_PrevPlayerButton->setParent(m_BottomBorder);
m_PrevPlayerButton->setContentAlignment(vgui::Label::a_center);
m_PrevPlayerButton->setBoundKey((char)255); // special no bound to avoid leading spaces in name
m_PrevPlayerButton->addActionSignal(new CSpectatorHandler_Command(this, SPECTATOR_PANEL_CMD_PREVPLAYER));
m_PrevPlayerButton->setUnArmedBorderColor(59, 58, 34, 48);
m_PrevPlayerButton->setArmedBorderColor(194, 202, 54, 0);
m_PrevPlayerButton->setUnArmedColor(143, 143, 54, 0);
m_PrevPlayerButton->setArmedColor(194, 202, 54, 0);
// m_NextPlayerButton= new ColorButton(">", (ScreenWidth - (XRES ( CAMOPTIONS_BUTTON_X ) + 15)) - XRES ( 24 + 15 ), YRES(6), XRES(24), YRES(20),false, false );
m_NextPlayerButton = new CImageButton("arrowright", (ScreenWidth - (XRES(CAMOPTIONS_BUTTON_X) + 15)) - XRES(24 + 15), YRES(6), XRES(24), YRES(20), false, false);
m_NextPlayerButton->setParent(m_BottomBorder);
m_NextPlayerButton->setContentAlignment(vgui::Label::a_center);
m_NextPlayerButton->setBoundKey((char)255); // special no bound to avoid leading spaces in name
m_NextPlayerButton->addActionSignal(new CSpectatorHandler_Command(this, SPECTATOR_PANEL_CMD_NEXTPLAYER));
m_NextPlayerButton->setUnArmedBorderColor(59, 58, 34, 48);
m_NextPlayerButton->setArmedBorderColor(194, 202, 54, 0);
m_NextPlayerButton->setUnArmedColor(143, 143, 54, 0);
m_NextPlayerButton->setArmedColor(194, 202, 54, 0);
// Initialize the bottom title.
//.........这里部分代码省略.........
示例7: FillGrid
void ScorePanel::FillGrid()
{
CSchemeManager *pSchemes = gViewPort->GetSchemeManager();
SchemeHandle_t hScheme = pSchemes->getSchemeHandle("Scoreboard Text");
SchemeHandle_t hTitleScheme = pSchemes->getSchemeHandle("Scoreboard Title Text");
SchemeHandle_t hSmallScheme = pSchemes->getSchemeHandle("Scoreboard Small Text");
Font *sfont = pSchemes->getFont(hScheme);
Font *tfont = pSchemes->getFont(hTitleScheme);
/* Font *smallfont = */
pSchemes->getFont(hSmallScheme);
int i = 0;
// update highlight position
int x, y;
getApp()->getCursorPos(x, y);
cursorMoved(x, y, this);
// remove highlight row if we're not in squelch mode
if (!GetClientVoiceMgr()->IsInSquelchMode())
{
m_iHighlightRow = -1;
}
for(int row=0; row < NUM_ROWS; row++)
{
CGrid *pGridRow = &m_PlayerGrids[row];
pGridRow->SetRowUnderline(0, false, 0, 0, 0, 0, 0);
if(row >= m_iRows)
{
for(int col=0; col < NUM_COLUMNS; col++)
m_PlayerEntries[col][row].setVisible(false);
continue;
}
for(int col=0; col < NUM_COLUMNS; col++)
{
CLabelHeader *pLabel = &m_PlayerEntries[col][row];
pLabel->setVisible(true);
pLabel->setText2("");
pLabel->setImage(NULL);
pLabel->setFont(sfont);
pLabel->setTextOffset(0, 0);
int rowheight = 13;
if (ScreenHeight > 480)
{
rowheight = YRES(rowheight);
}
else
{
// more tweaking, make sure icons fit at low res
rowheight = 15;
}
pLabel->setSize(pLabel->getWide(), rowheight);
pLabel->setBgColor(0, 0, 0, 255);
char sz[128];
hud_player_info_t *pl_info = NULL;
team_info_t *team_info = NULL;
if (m_iIsATeam[row] == TEAM_SPECTATORS)
{
pLabel->setText(" ");
continue;
}
else if ( m_iIsATeam[row] == TEAM_YES )
{
// Get the team's data
team_info = &g_TeamInfo[ m_iSortedRows[row] ];
// team color text for team names
pLabel->setFgColor( iTeamColors[team_info->teamnumber % 5][0],
iTeamColors[team_info->teamnumber % 5][1],
iTeamColors[team_info->teamnumber % 5][2],
0 );
// different height for team header rows
rowheight = 20;
if (ScreenHeight >= 480)
{
rowheight = YRES(rowheight);
}
pLabel->setSize(pLabel->getWide(), rowheight);
pLabel->setFont(tfont);
pGridRow->SetRowUnderline( 0,
true,
YRES(3),
iTeamColors[team_info->teamnumber % 5][0],
iTeamColors[team_info->teamnumber % 5][1],
iTeamColors[team_info->teamnumber % 5][2],
0 );
}
else if ( m_iIsATeam[row] == TEAM_SPECTATORS )
{
// grey text for spectators
//.........这里部分代码省略.........
示例8: paintTeamplay
void CScoreBoard::paintTeamplay()
{
CSchemeManager *pSchemes = gViewPort->GetSchemeManager();
SchemeHandle_t hTitleScheme = pSchemes->getSchemeHandle( "Basic_Text" );
Font *pTitleFont = pSchemes->getFont( hTitleScheme );
drawSetColor(255, 255, 0, 200);
drawFilledRect(0, 0, getWide(), pTitleFont->getTall() + YRES(4));
drawSetTextFont(pTitleFont);
drawSetTextColor(250, 250, 250, 40);
drawSetTextPos(XRES(10), YRES(2));
drawPrintText("SCORES:", strlen( "SCORES:" ) );
drawSetTextFont(pTitleFont);
drawSetTextColor(250, 250, 250, 40);
drawSetTextPos(XRES(10), YRES(20));
drawPrintText("Teams", strlen( "Teams" ) );
drawSetTextFont(pTitleFont);
drawSetTextColor(250, 250, 250, 40);
drawSetTextPos(XRES(280), YRES(20));
drawPrintText("Frags", strlen( "Frags" ) );
drawSetTextFont(pTitleFont);
drawSetTextColor(250, 250, 250, 40);
drawSetTextPos(XRES(330), YRES(20));
drawPrintText("Deaths", strlen( "Deaths" ) );
drawSetTextFont(pTitleFont);
drawSetTextColor(250, 250, 250, 40);
drawSetTextPos(XRES(380), YRES(20));
drawPrintText("Ping", strlen( "Ping" ) );
drawSetColor(0, 0, 0, 70);
drawOutlinedRect(0, 0, getWide(), getTall());
drawSetColor(255, 0, 0, 200);
drawFilledRect( XRES( 10 ), YRES( 40 ), XRES( 430 ), pTitleFont->getTall() + YRES(44) );
drawSetTextFont(pTitleFont);
drawSetTextColor(250, 250, 250, 40);
drawSetTextPos(XRES(12), YRES(42));
drawPrintText("Terrorists", strlen( "Terrorists" ) );
drawSetColor(0, 0, 255, 200);
drawFilledRect( XRES( 10 ), YRES( 200 ), XRES( 430 ), pTitleFont->getTall() + YRES(204) );
drawSetTextFont(pTitleFont);
drawSetTextColor(250, 250, 250, 40);
drawSetTextPos(XRES(12), YRES(202));
drawPrintText("Counter-Terrorists", strlen( "Counter-Terrorists" ) );
int TY = YRES(46) + pTitleFont->getTall();
int CTY = YRES(206) + pTitleFont->getTall();
for( int i = 0; i < CountPlayers; i++ )
{
if( ScrBrdPlayerInfo[i].spectator )
continue;
char Name[32];
char Frags[32];
char Deaths[32];
char Ping[32];
int Team;
strcpy( Name, ScrBrdPlayerInfo[i].Name );
sprintf( Frags, "%d", ScrBrdPlayerInfo[i].Frags );
sprintf( Deaths, "%d", ScrBrdPlayerInfo[i].Deaths );
sprintf( Ping, "%d", ScrBrdPlayerInfo[i].Ping );
Team = ScrBrdPlayerInfo[i].Team;
int X = XRES(12);
int Y;
if( Team == 1 )
Y = TY;
else
Y = CTY;
drawSetTextFont(pTitleFont);
drawSetTextColor(250, 250, 250, 40);
drawSetTextPos(X, Y);
drawPrintText(Name, strlen( Name ) );
drawSetTextFont(pTitleFont);
drawSetTextColor(250, 250, 250, 40);
drawSetTextPos(XRES(290), Y);
drawPrintText(Frags, strlen( Frags ) );
drawSetTextFont(pTitleFont);
drawSetTextColor(250, 250, 250, 40);
drawSetTextPos(XRES(340), Y);
drawPrintText(Deaths, strlen( Deaths ) );
drawSetTextFont(pTitleFont);
drawSetTextColor(250, 250, 250, 40);
drawSetTextPos(XRES(390), Y);
drawPrintText(Ping, strlen( Ping ) );
//.........这里部分代码省略.........
示例9: paint
void CScoreBoard::paint()
{
gViewPort->GetAllPlayersInfo();
CountPlayers = 0;
for ( int i = 1; i < MAX_PLAYERS; i++ )
{
if( !g_PlayerInfoList[i].name )
continue;
if( !strlen( g_PlayerInfoList[i].name ) )
continue;
strcpy( ScrBrdPlayerInfo[i - 1].Name, g_PlayerInfoList[i].name );
ScrBrdPlayerInfo[i - 1].Frags = g_PlayerExtraInfo[i].frags;
ScrBrdPlayerInfo[i - 1].Deaths = g_PlayerExtraInfo[i].deaths;
ScrBrdPlayerInfo[i - 1].Ping = g_PlayerInfoList[i].ping;
ScrBrdPlayerInfo[i - 1].Team = g_PlayerExtraInfo[i].teamnumber;
ScrBrdPlayerInfo[i - 1].spectator = g_IsSpectator[i];
CountPlayers++;
}
sort( ScrBrdPlayerInfo, ScrBrdPlayerInfo + CountPlayers, cmp );
if( gHUD.m_GameMode != 1 )
{
paintTeamplay();
return;
}
CSchemeManager *pSchemes = gViewPort->GetSchemeManager();
SchemeHandle_t hTitleScheme = pSchemes->getSchemeHandle( "Basic_Text" );
Font *pTitleFont = pSchemes->getFont( hTitleScheme );
drawSetColor(255, 255, 0, 200);
drawFilledRect(0, 0, getWide(), pTitleFont->getTall() + YRES(4));
drawSetTextFont(pTitleFont);
drawSetTextColor(250, 250, 250, 40);
drawSetTextPos(XRES(10), YRES(2));
drawPrintText("SCORES:", strlen( "SCORES:" ) );
drawSetTextFont(pTitleFont);
drawSetTextColor(250, 250, 250, 40);
drawSetTextPos(XRES(10), YRES(20));
drawPrintText("Teams", strlen( "Teams" ) );
drawSetTextFont(pTitleFont);
drawSetTextColor(250, 250, 250, 40);
drawSetTextPos(XRES(280), YRES(20));
drawPrintText("Frags", strlen( "Frags" ) );
drawSetTextFont(pTitleFont);
drawSetTextColor(250, 250, 250, 40);
drawSetTextPos(XRES(330), YRES(20));
drawPrintText("Deaths", strlen( "Deaths" ) );
drawSetTextFont(pTitleFont);
drawSetTextColor(250, 250, 250, 40);
drawSetTextPos(XRES(380), YRES(20));
drawPrintText("Ping", strlen( "Ping" ) );
drawSetColor(0, 0, 0, 70);
drawOutlinedRect(0, 0, getWide(), getTall());
int Y = YRES(36) + pTitleFont->getTall();
for( int i = 0; i < CountPlayers; i++ )
{
if( ScrBrdPlayerInfo[i].spectator )
continue;
char Name[32];
char Frags[32];
char Deaths[32];
char Ping[32];
int Team;
strcpy( Name, ScrBrdPlayerInfo[i].Name );
sprintf( Frags, "%d", ScrBrdPlayerInfo[i].Frags );
sprintf( Deaths, "%d", ScrBrdPlayerInfo[i].Deaths );
sprintf( Ping, "%d", ScrBrdPlayerInfo[i].Ping );
Team = ScrBrdPlayerInfo[i].Team;
int X = XRES(12);
drawSetTextFont(pTitleFont);
drawSetTextColor(250, 250, 250, 40);
drawSetTextPos(X, Y);
drawPrintText(Name, strlen( Name ) );
drawSetTextFont(pTitleFont);
drawSetTextColor(250, 250, 250, 40);
drawSetTextPos(XRES(290), Y);
drawPrintText(Frags, strlen( Frags ) );
drawSetTextFont(pTitleFont);
drawSetTextColor(250, 250, 250, 40);
drawSetTextPos(XRES(340), Y);
drawPrintText(Deaths, strlen( Deaths ) );
drawSetTextFont(pTitleFont);
drawSetTextColor(250, 250, 250, 40);
//.........这里部分代码省略.........
示例10: CMenuPanel
//-----------------------------------------------------------------------------
// Purpose: Constructs a message panel
//-----------------------------------------------------------------------------
CMessageWindowPanel::CMessageWindowPanel( const char *szMOTD, const char *szTitle, int iShadeFullscreen, int iRemoveMe, int x, int y, int wide, int tall ) : CMenuPanel( iShadeFullscreen ? 100 : 255, iRemoveMe, x, y, wide, tall )
{
// Get the scheme used for the Titles
CSchemeManager *pSchemes = gViewPort->GetSchemeManager();
// schemes
SchemeHandle_t hTitleScheme = pSchemes->getSchemeHandle( "Title Font" );
SchemeHandle_t hMOTDText = pSchemes->getSchemeHandle( "Briefing Text" );
// color schemes
int r, g, b, a;
// Create the window
m_pBackgroundPanel = new CTransparentPanel( iShadeFullscreen ? 255 : 100, MOTD_WINDOW_X, MOTD_WINDOW_Y, MOTD_WINDOW_SIZE_X, MOTD_WINDOW_SIZE_Y );
m_pBackgroundPanel->setParent( this );
m_pBackgroundPanel->setBorder( new LineBorder( Color(255 * 0.7,170 * 0.7,0,0)) );
m_pBackgroundPanel->setVisible( true );
int iXSize,iYSize,iXPos,iYPos;
m_pBackgroundPanel->getPos( iXPos,iYPos );
m_pBackgroundPanel->getSize( iXSize,iYSize );
// Create the title
Label *pLabel = new Label( "", iXPos + MOTD_TITLE_X, iYPos + MOTD_TITLE_Y );
pLabel->setParent( this );
pLabel->setFont( pSchemes->getFont(hTitleScheme) );
pLabel->setFont( Scheme::sf_primary1 );
pSchemes->getFgColor( hTitleScheme, r, g, b, a );
pLabel->setFgColor( r, g, b, a );
pLabel->setFgColor( Scheme::sc_primary1 );
pSchemes->getBgColor( hTitleScheme, r, g, b, a );
pLabel->setBgColor( r, g, b, a );
pLabel->setContentAlignment( vgui::Label::a_west );
pLabel->setText( "%s", szTitle);
// Create the Scroll panel
ScrollPanel *pScrollPanel = new CTFScrollPanel( iXPos + XRES(16), iYPos + MOTD_TITLE_Y*2 + YRES(16), iXSize - XRES(32), iYSize - (YRES(48) + BUTTON_SIZE_Y*2) );
pScrollPanel->setParent(this);
//force the scrollbars on so clientClip will take them in account after the validate
pScrollPanel->setScrollBarAutoVisible(false, false);
pScrollPanel->setScrollBarVisible(true, true);
pScrollPanel->validate();
// Create the text panel
TextPanel *pText = new TextPanel( "", 0,0, 64,64);
pText->setParent( pScrollPanel->getClient() );
// get the font and colors from the scheme
pText->setFont( pSchemes->getFont(hMOTDText) );
pSchemes->getFgColor( hMOTDText, r, g, b, a );
pText->setFgColor( r, g, b, a );
pSchemes->getBgColor( hMOTDText, r, g, b, a );
pText->setBgColor( r, g, b, a );
pText->setText( szMOTD);
// Get the total size of the MOTD text and resize the text panel
int iScrollSizeX, iScrollSizeY;
// First, set the size so that the client's wdith is correct at least because the
// width is critical for getting the "wrapped" size right.
// You'll see a horizontal scroll bar if there is a single word that won't wrap in the
// specified width.
pText->getTextImage()->setSize(pScrollPanel->getClientClip()->getWide(), pScrollPanel->getClientClip()->getTall());
pText->getTextImage()->getTextSizeWrapped( iScrollSizeX, iScrollSizeY );
// Now resize the textpanel to fit the scrolled size
pText->setSize( iScrollSizeX , iScrollSizeY );
//turn the scrollbars back into automode
pScrollPanel->setScrollBarAutoVisible(true, true);
pScrollPanel->setScrollBarVisible(false, false);
pScrollPanel->validate();
CommandButton *pButton = new CommandButton( CHudTextMessage::BufferedLocaliseTextString( "#Menu_OK" ), iXPos + XRES(16), iYPos + iYSize - YRES(16) - BUTTON_SIZE_Y, CMENU_SIZE_X, BUTTON_SIZE_Y);
pButton->addActionSignal(new CMenuHandler_TextWindow(HIDE_TEXTWINDOW));
pButton->setParent(this);
}
示例11: FillGrid
void ScorePanel::FillGrid()
{
CSchemeManager *pSchemes = gViewPort->GetSchemeManager();
SchemeHandle_t hScheme = pSchemes->getSchemeHandle("Scoreboard Text");
SchemeHandle_t hTitleScheme = pSchemes->getSchemeHandle("Scoreboard Title Text");
SchemeHandle_t hSmallScheme = pSchemes->getSchemeHandle("Scoreboard Small Text");
Font *sfont = pSchemes->getFont(hScheme);
Font *tfont = pSchemes->getFont(hTitleScheme);
Font *smallfont = pSchemes->getFont(hSmallScheme);
// update highlight position
int x, y;
getApp()->getCursorPos(x, y);
cursorMoved(x, y, this);
// remove highlight row if we're not in squelch mode
if (!GetClientVoiceMgr()->IsInSquelchMode())
{
m_iHighlightRow = -1;
}
bool bNextRowIsGap = false;
for(int row=0; row < NUM_ROWS; row++)
{
CGrid *pGridRow = &m_PlayerGrids[row];
pGridRow->SetRowUnderline(0, false, 0, 0, 0, 0, 0);
if(row >= m_iRows)
{
for(int col=0; col < NUM_COLUMNS; col++)
m_PlayerEntries[col][row].setVisible(false);
continue;
}
bool bRowIsGap = false;
if (bNextRowIsGap)
{
bNextRowIsGap = false;
bRowIsGap = true;
}
for(int col=0; col < NUM_COLUMNS; col++)
{
CLabelHeader *pLabel = &m_PlayerEntries[col][row];
pLabel->setVisible(true);
pLabel->setText2("");
pLabel->setImage(NULL);
pLabel->setFont(sfont);
pLabel->setTextOffset(0, 0);
int rowheight = 13;
if (ScreenHeight > 480)
{
rowheight = YRES(rowheight);
}
else
{
// more tweaking, make sure icons fit at low res
rowheight = 15;
}
pLabel->setSize(pLabel->getWide(), rowheight);
pLabel->setBgColor(0, 0, 0, 255);
char sz[128];
hud_player_info_t *pl_info = NULL;
team_info_t *team_info = NULL;
if (m_iIsATeam[row] == TEAM_BLANK)
{
pLabel->setText(" ");
continue;
}
else if ( m_iIsATeam[row] == TEAM_YES )
{
// Get the team's data
team_info = &g_TeamInfo[ m_iSortedRows[row] ];
// team color text for team names
pLabel->setFgColor( iTeamColors[team_info->teamnumber % iNumberOfTeamColors][0],
iTeamColors[team_info->teamnumber % iNumberOfTeamColors][1],
iTeamColors[team_info->teamnumber % iNumberOfTeamColors][2],
0 );
// different height for team header rows
rowheight = 20;
if (ScreenHeight >= 480)
{
rowheight = YRES(rowheight);
}
pLabel->setSize(pLabel->getWide(), rowheight);
pLabel->setFont(tfont);
pGridRow->SetRowUnderline( 0,
true,
YRES(3),
iTeamColors[team_info->teamnumber % iNumberOfTeamColors][0],
//.........这里部分代码省略.........