Skip to content

Commit

Permalink
Add unicode server name to the scoreboard (#88)
Browse files Browse the repository at this point in the history
* Add unicode server name to the scoreboard

* Initialize m_pTitleImage with nullptr
  • Loading branch information
tmp64 authored Oct 23, 2020
1 parent f9e0f60 commit ba5f22c
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
17 changes: 16 additions & 1 deletion cl_dll/vgui_ScorePanel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,14 @@ ScorePanel::ScorePanel(int x,int y,int wide,int tall) : Panel(x,y,wide,tall)
m_TitleLabel.setFgColor( Scheme::sc_primary1 );
m_TitleLabel.setContentAlignment( vgui::Label::a_west );

if (!UnicodeTextImage::shouldFallback())
{
m_pTitleImage = new UnicodeTextImage();
m_pTitleImage->setFont(m_UTitleFont, tfont);
m_pTitleImage->setColor(Scheme::sc_primary1);
m_TitleLabel.setImage(m_pTitleImage);
}

LineBorder *border = new LineBorder(Color(60, 60, 60, 128));
setBorder(border);
setPaintBorderEnabled(true);
Expand Down Expand Up @@ -268,6 +276,9 @@ ScorePanel::~ScorePanel()
#endif
if (m_pFlagIcon)
delete m_pFlagIcon;

m_TitleLabel.setImage(nullptr);
delete m_pTitleImage;
#ifdef POSIX
#pragma GCC diagnostic pop
#endif
Expand Down Expand Up @@ -304,7 +315,11 @@ void ScorePanel::Update()
// {
char sz[MAX_SERVERNAME_LENGTH + 16];
sprintf(sz, "%s", gViewPort->m_szServerName );
m_TitleLabel.setText(sz);

if (!m_pTitleImage->shouldFallback())
m_pTitleImage->setText(sz);
else
m_TitleLabel.setText(sz);
// }

m_iRows = 0;
Expand Down
2 changes: 2 additions & 0 deletions cl_dll/vgui_ScorePanel.h
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,8 @@ class ScorePanel : public Panel, public vgui::CDefaultInputSignal
UnicodeTextImage::HFont m_USmallFont;
UnicodeTextImage::HFont m_UTitleFont;

UnicodeTextImage *m_pTitleImage = nullptr;

public:

int m_iNumTeams;
Expand Down

0 comments on commit ba5f22c

Please sign in to comment.