Skip to content

Commit ba5f22c

Browse files
authored
Add unicode server name to the scoreboard (#88)
* Add unicode server name to the scoreboard * Initialize m_pTitleImage with nullptr
1 parent f9e0f60 commit ba5f22c

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

cl_dll/vgui_ScorePanel.cpp

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,14 @@ ScorePanel::ScorePanel(int x,int y,int wide,int tall) : Panel(x,y,wide,tall)
137137
m_TitleLabel.setFgColor( Scheme::sc_primary1 );
138138
m_TitleLabel.setContentAlignment( vgui::Label::a_west );
139139

140+
if (!UnicodeTextImage::shouldFallback())
141+
{
142+
m_pTitleImage = new UnicodeTextImage();
143+
m_pTitleImage->setFont(m_UTitleFont, tfont);
144+
m_pTitleImage->setColor(Scheme::sc_primary1);
145+
m_TitleLabel.setImage(m_pTitleImage);
146+
}
147+
140148
LineBorder *border = new LineBorder(Color(60, 60, 60, 128));
141149
setBorder(border);
142150
setPaintBorderEnabled(true);
@@ -268,6 +276,9 @@ ScorePanel::~ScorePanel()
268276
#endif
269277
if (m_pFlagIcon)
270278
delete m_pFlagIcon;
279+
280+
m_TitleLabel.setImage(nullptr);
281+
delete m_pTitleImage;
271282
#ifdef POSIX
272283
#pragma GCC diagnostic pop
273284
#endif
@@ -304,7 +315,11 @@ void ScorePanel::Update()
304315
// {
305316
char sz[MAX_SERVERNAME_LENGTH + 16];
306317
sprintf(sz, "%s", gViewPort->m_szServerName );
307-
m_TitleLabel.setText(sz);
318+
319+
if (!m_pTitleImage->shouldFallback())
320+
m_pTitleImage->setText(sz);
321+
else
322+
m_TitleLabel.setText(sz);
308323
// }
309324

310325
m_iRows = 0;

cl_dll/vgui_ScorePanel.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,8 @@ class ScorePanel : public Panel, public vgui::CDefaultInputSignal
284284
UnicodeTextImage::HFont m_USmallFont;
285285
UnicodeTextImage::HFont m_UTitleFont;
286286

287+
UnicodeTextImage *m_pTitleImage = nullptr;
288+
287289
public:
288290

289291
int m_iNumTeams;

0 commit comments

Comments
 (0)