Skip to content

Commit

Permalink
Replaced CUITextWnd with CUIStatic in the engine (#382)
Browse files Browse the repository at this point in the history
  • Loading branch information
Xottab-DUTY committed Feb 9, 2024
1 parent 5aec8e6 commit 56832f1
Show file tree
Hide file tree
Showing 101 changed files with 375 additions and 430 deletions.
12 changes: 6 additions & 6 deletions src/xrGame/UIGameAHunt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ void CUIGameAHunt::Init(int stage)
if (stage == 0)
{ // shared
inherited::Init(stage);
m_buy_msg_caption = UIHelper::CreateTextWnd(*MsgConfig, "mp_ah_buy", Window);
m_buy_msg_caption = UIHelper::CreateStatic(*MsgConfig, "mp_ah_buy", Window);
}
if (stage == 1)
{ // unique
Expand All @@ -31,16 +31,16 @@ void CUIGameAHunt::Init(int stage)
uiXml.Load(CONFIG_PATH, UI_PATH, UI_PATH_DEFAULT, "ui_game_ahunt.xml");

CUIXmlInit::InitWindow(uiXml, "global", 0, Window);
CUIXmlInit::InitTextWnd(uiXml, "fraglimit", 0, m_pFragLimitIndicator);
CUIXmlInit::InitStatic(uiXml, "fraglimit", 0, m_pFragLimitIndicator);

m_pReinforcementInidcator = xr_new<CUITextWnd>();
m_pReinforcementInidcator = xr_new<CUIStatic>("Reinforcement indicator");
m_pReinforcementInidcator->SetAutoDelete(true);
CUIXmlInit::InitTextWnd(uiXml, "reinforcement", 0, m_pReinforcementInidcator);
CUIXmlInit::InitStatic(uiXml, "reinforcement", 0, m_pReinforcementInidcator);

CUIXmlInit::InitStatic(uiXml, "team1_icon", 0, m_team1_icon);
CUIXmlInit::InitStatic(uiXml, "team2_icon", 0, m_team2_icon);
CUIXmlInit::InitTextWnd(uiXml, "team1_score", 0, m_team1_score);
CUIXmlInit::InitTextWnd(uiXml, "team2_score", 0, m_team2_score);
CUIXmlInit::InitStatic(uiXml, "team1_score", 0, m_team1_score);
CUIXmlInit::InitStatic(uiXml, "team2_score", 0, m_team2_score);

m_pMoneyIndicator->InitFromXML(uiXml);
m_pRankIndicator->InitFromXml(uiXml);
Expand Down
5 changes: 2 additions & 3 deletions src/xrGame/UIGameAHunt.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
class CUIAHuntFragList;
class CUIAHuntPlayerList;
class game_cl_ArtefactHunt;
class CUITextWnd;
class CUIMessageBoxEx;

class CUIGameAHunt : public CUIGameTDM
Expand All @@ -20,7 +19,7 @@ class CUIGameAHunt : public CUIGameTDM
typedef CUIGameTDM inherited;

public:
CUITextWnd* m_pReinforcementInidcator;
CUIStatic* m_pReinforcementInidcator;
CUIMessageBoxEx* m_pBuySpawnMsgBox;

public:
Expand All @@ -33,5 +32,5 @@ class CUIGameAHunt : public CUIGameTDM
void SetBuyMsgCaption(LPCSTR str);

protected:
CUITextWnd* m_buy_msg_caption;
CUIStatic* m_buy_msg_caption;
};
32 changes: 16 additions & 16 deletions src/xrGame/UIGameCTA.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,14 @@ void CUIGameCTA::Init(int stage)
{
if (stage == 0)
{
m_round_result_caption = UIHelper::CreateTextWnd(*MsgConfig, "mp_round_result", Window);
m_pressbuy_caption = UIHelper::CreateTextWnd(*MsgConfig, "mp_pressbuy", Window);
m_pressjump_caption = UIHelper::CreateTextWnd(*MsgConfig, "mp_pressjump", Window);
m_spectator_caption = UIHelper::CreateTextWnd(*MsgConfig, "mp_spectator", Window);
m_spectrmode_caption = UIHelper::CreateTextWnd(*MsgConfig, "mp_spetatormode", Window);
m_warm_up_caption = UIHelper::CreateTextWnd(*MsgConfig, "mp_warm_up", Window);
m_time_caption = UIHelper::CreateTextWnd(*MsgConfig, "mp_timelimit", Window);
m_demo_play_caption = UIHelper::CreateTextWnd(*MsgConfig, "mp_demo_play", Window);
m_round_result_caption = UIHelper::CreateStatic(*MsgConfig, "mp_round_result", Window);
m_pressbuy_caption = UIHelper::CreateStatic(*MsgConfig, "mp_pressbuy", Window);
m_pressjump_caption = UIHelper::CreateStatic(*MsgConfig, "mp_pressjump", Window);
m_spectator_caption = UIHelper::CreateStatic(*MsgConfig, "mp_spectator", Window);
m_spectrmode_caption = UIHelper::CreateStatic(*MsgConfig, "mp_spetatormode", Window);
m_warm_up_caption = UIHelper::CreateStatic(*MsgConfig, "mp_warm_up", Window);
m_time_caption = UIHelper::CreateStatic(*MsgConfig, "mp_timelimit", Window);
m_demo_play_caption = UIHelper::CreateStatic(*MsgConfig, "mp_demo_play", Window);

teamPanels = xr_new<UITeamPanels>();
teamPanels->Init(TEAM_PANELS_XML_NAME, "team_panels_wnd");
Expand All @@ -75,25 +75,25 @@ void CUIGameCTA::Init(int stage)
m_pRankIndicator->SetAutoDelete(true);
m_pRankIndicator->InitFromXml(uiXml);

m_pReinforcementInidcator = xr_new<CUITextWnd>();
m_pReinforcementInidcator = xr_new<CUIStatic>("Reinforcement indicator");
m_pReinforcementInidcator->SetAutoDelete(true);
CUIXmlInit::InitTextWnd(uiXml, "reinforcement", 0, m_pReinforcementInidcator);
CUIXmlInit::InitStatic(uiXml, "reinforcement", 0, m_pReinforcementInidcator);

m_team1_icon = xr_new<CUIStatic>("Team 1 icon");
m_team2_icon = xr_new<CUIStatic>("Team 2 icon");
CUIXmlInit::InitStatic(uiXml, "team1_icon", 0, m_team1_icon);
CUIXmlInit::InitStatic(uiXml, "team2_icon", 0, m_team2_icon);

m_team1_score = xr_new<CUITextWnd>();
m_team2_score = xr_new<CUITextWnd>();
m_team1_score = xr_new<CUIStatic>("Team 1 score");
m_team2_score = xr_new<CUIStatic>("Team 2 score");
m_team1_score->SetAutoDelete(true);
m_team2_score->SetAutoDelete(true);
CUIXmlInit::InitTextWnd(uiXml, "team1_score", 0, m_team1_score);
CUIXmlInit::InitTextWnd(uiXml, "team2_score", 0, m_team2_score);
CUIXmlInit::InitStatic(uiXml, "team1_score", 0, m_team1_score);
CUIXmlInit::InitStatic(uiXml, "team2_score", 0, m_team2_score);

m_pFragLimitIndicator = xr_new<CUITextWnd>();
m_pFragLimitIndicator = xr_new<CUIStatic>("Frag limit indicator");
m_pFragLimitIndicator->SetAutoDelete(true);
CUIXmlInit::InitTextWnd(uiXml, "fraglimit", 0, m_pFragLimitIndicator);
CUIXmlInit::InitStatic(uiXml, "fraglimit", 0, m_pFragLimitIndicator);
}

if (stage == 2)
Expand Down
27 changes: 13 additions & 14 deletions src/xrGame/UIGameCTA.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,22 +23,21 @@ class CUIProgressShape;
class CUIMessageBoxEx;
class UIVoteStatusWnd;
class game_cl_CaptureTheArtefact;
class CUITextWnd;

/// This class used to control UI part of client for Capture the Artefact mp game mode.
class CUIGameCTA : public UIGameMP
{
CUISpawnWnd* m_pUITeamSelectWnd;
CUIStatic* m_team1_icon;
CUIStatic* m_team2_icon;
CUITextWnd* m_team1_score{};
CUITextWnd* m_team2_score{};
CUITextWnd* m_pFragLimitIndicator{};
CUIStatic* m_team1_score{};
CUIStatic* m_team2_score{};
CUIStatic* m_pFragLimitIndicator{};
game_cl_CaptureTheArtefact* m_game{};

CUIMoneyIndicator* m_pMoneyIndicator;
CUIRankIndicator* m_pRankIndicator;
CUITextWnd* m_pReinforcementInidcator;
CUIStatic* m_pReinforcementInidcator;
CUIMessageBoxEx* m_pBuySpawnMsgBox{};
UIVoteStatusWnd* m_voteStatusWnd{};

Expand All @@ -52,15 +51,15 @@ class CUIGameCTA : public UIGameMP
UITeamPanels* teamPanels{};
bool m_team_panels_shown{};

CUITextWnd* m_spectator_caption;
CUITextWnd* m_pressjump_caption;
CUITextWnd* m_pressbuy_caption;
CUITextWnd* m_round_result_caption;
CUITextWnd* m_force_respawn_time_caption;
CUITextWnd* m_spectrmode_caption;
CUITextWnd* m_warm_up_caption;
CUITextWnd* m_time_caption;
CUITextWnd* m_demo_play_caption;
CUIStatic* m_spectator_caption;
CUIStatic* m_pressjump_caption;
CUIStatic* m_pressbuy_caption;
CUIStatic* m_round_result_caption;
CUIStatic* m_force_respawn_time_caption;
CUIStatic* m_spectrmode_caption;
CUIStatic* m_warm_up_caption;
CUIStatic* m_time_caption;
CUIStatic* m_demo_play_caption;

struct PresetItem
{
Expand Down
22 changes: 11 additions & 11 deletions src/xrGame/UIGameDM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,19 +51,19 @@ void CUIGameDM::Init(int stage)
m_pMoneyIndicator->SetAutoDelete(true);
m_pRankIndicator = xr_new<CUIRankIndicator>();
m_pRankIndicator->SetAutoDelete(true);
m_pFragLimitIndicator = xr_new<CUITextWnd>();
m_pFragLimitIndicator = xr_new<CUIStatic>("Frag limit indicator");
m_pFragLimitIndicator->SetAutoDelete(true);

inherited::Init(stage);
m_time_caption = UIHelper::CreateTextWnd(*MsgConfig, "mp_timelimit", Window);
m_spectrmode_caption = UIHelper::CreateTextWnd(*MsgConfig, "mp_spetatormode", Window);
m_spectator_caption = UIHelper::CreateTextWnd(*MsgConfig, "mp_spectator", Window);
m_pressjump_caption = UIHelper::CreateTextWnd(*MsgConfig, "mp_pressjump", Window);
m_pressbuy_caption = UIHelper::CreateTextWnd(*MsgConfig, "mp_pressbuy", Window);
m_round_result_caption = UIHelper::CreateTextWnd(*MsgConfig, "mp_round_result", Window);
m_force_respawn_time_caption = UIHelper::CreateTextWnd(*MsgConfig, "mp_force_respawn_time", Window);
m_demo_play_caption = UIHelper::CreateTextWnd(*MsgConfig, "mp_demo_play", Window);
m_warm_up_caption = UIHelper::CreateTextWnd(*MsgConfig, "mp_warm_up", Window);
m_time_caption = UIHelper::CreateStatic(*MsgConfig, "mp_timelimit", Window);
m_spectrmode_caption = UIHelper::CreateStatic(*MsgConfig, "mp_spetatormode", Window);
m_spectator_caption = UIHelper::CreateStatic(*MsgConfig, "mp_spectator", Window);
m_pressjump_caption = UIHelper::CreateStatic(*MsgConfig, "mp_pressjump", Window);
m_pressbuy_caption = UIHelper::CreateStatic(*MsgConfig, "mp_pressbuy", Window);
m_round_result_caption = UIHelper::CreateStatic(*MsgConfig, "mp_round_result", Window);
m_force_respawn_time_caption = UIHelper::CreateStatic(*MsgConfig, "mp_force_respawn_time", Window);
m_demo_play_caption = UIHelper::CreateStatic(*MsgConfig, "mp_demo_play", Window);
m_warm_up_caption = UIHelper::CreateStatic(*MsgConfig, "mp_warm_up", Window);
}
if (stage == 1)
{ // unique
Expand All @@ -73,7 +73,7 @@ void CUIGameDM::Init(int stage)
CUIXmlInit::InitWindow(uiXml, "global", 0, Window);
m_pMoneyIndicator->InitFromXML(uiXml);
m_pRankIndicator->InitFromXml(uiXml);
CUIXmlInit::InitTextWnd(uiXml, "fraglimit", 0, m_pFragLimitIndicator);
CUIXmlInit::InitStatic(uiXml, "fraglimit", 0, m_pFragLimitIndicator);
}
if (stage == 2)
{ // after
Expand Down
21 changes: 10 additions & 11 deletions src/xrGame/UIGameDM.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ class CUIRankIndicator;
class UIVoteStatusWnd;
class CUIMapDesc;
class UITeamPanels;
class CUITextWnd;

class CUIGameDM : public UIGameMP
{
Expand All @@ -27,19 +26,19 @@ class CUIGameDM : public UIGameMP

UITeamPanels* m_pTeamPanels;

CUITextWnd* m_time_caption;
CUITextWnd* m_spectrmode_caption;
CUITextWnd* m_spectator_caption;
CUITextWnd* m_pressjump_caption;
CUITextWnd* m_pressbuy_caption;
CUITextWnd* m_round_result_caption;
CUITextWnd* m_force_respawn_time_caption;
CUITextWnd* m_demo_play_caption;
CUITextWnd* m_warm_up_caption;
CUIStatic* m_time_caption;
CUIStatic* m_spectrmode_caption;
CUIStatic* m_spectator_caption;
CUIStatic* m_pressjump_caption;
CUIStatic* m_pressbuy_caption;
CUIStatic* m_round_result_caption;
CUIStatic* m_force_respawn_time_caption;
CUIStatic* m_demo_play_caption;
CUIStatic* m_warm_up_caption;

CUIMoneyIndicator* m_pMoneyIndicator;
CUIRankIndicator* m_pRankIndicator;
CUITextWnd* m_pFragLimitIndicator;
CUIStatic* m_pFragLimitIndicator;
UIVoteStatusWnd* m_voteStatusWnd;

public:
Expand Down
14 changes: 7 additions & 7 deletions src/xrGame/UIGameTDM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,15 @@ void CUIGameTDM::Init(int stage)
m_pUITeamSelectWnd = xr_new<CUISpawnWnd>();
m_team1_icon = xr_new<CUIStatic>("Team 1 icon");
m_team2_icon = xr_new<CUIStatic>("Team 2 icon");
m_team1_score = xr_new<CUITextWnd>();
m_team1_score = xr_new<CUIStatic>("Team 1 score");
m_team1_score->SetAutoDelete(true);
m_team2_score = xr_new<CUITextWnd>();
m_team2_score = xr_new<CUIStatic>("Team 2 score");
m_team2_score->SetAutoDelete(true);
m_buy_msg_caption = xr_new<CUITextWnd>();
m_buy_msg_caption = xr_new<CUIStatic>("Buy message caption");
m_buy_msg_caption->SetAutoDelete(true);

inherited::Init(stage);
CUIXmlInit::InitTextWnd(*MsgConfig, "mp_tdm_buy", 0, m_buy_msg_caption);
CUIXmlInit::InitStatic(*MsgConfig, "mp_tdm_buy", 0, m_buy_msg_caption);
}
if (stage == 1)
{ // unique
Expand All @@ -52,9 +52,9 @@ void CUIGameTDM::Init(int stage)
CUIXmlInit::InitWindow(uiXml, "global", 0, Window);
CUIXmlInit::InitStatic(uiXml, "team1_icon", 0, m_team1_icon);
CUIXmlInit::InitStatic(uiXml, "team2_icon", 0, m_team2_icon);
CUIXmlInit::InitTextWnd(uiXml, "team1_score", 0, m_team1_score);
CUIXmlInit::InitTextWnd(uiXml, "team2_score", 0, m_team2_score);
CUIXmlInit::InitTextWnd(uiXml, "fraglimit", 0, m_pFragLimitIndicator);
CUIXmlInit::InitStatic(uiXml, "team1_score", 0, m_team1_score);
CUIXmlInit::InitStatic(uiXml, "team2_score", 0, m_team2_score);
CUIXmlInit::InitStatic(uiXml, "fraglimit", 0, m_pFragLimitIndicator);

m_pMoneyIndicator->InitFromXML(uiXml);
m_pRankIndicator->InitFromXml(uiXml);
Expand Down
7 changes: 3 additions & 4 deletions src/xrGame/UIGameTDM.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ class CUITDMPlayerList;
class CUISkinSelectorWnd;
class game_cl_TeamDeathmatch;
class CUIStatic;
class CUITextWnd;
class CUISpawnWnd;

class CUIGameTDM : public CUIGameDM
Expand All @@ -28,9 +27,9 @@ class CUIGameTDM : public CUIGameDM
protected:
CUIStatic* m_team1_icon;
CUIStatic* m_team2_icon;
CUITextWnd* m_team1_score;
CUITextWnd* m_team2_score;
CUITextWnd* m_buy_msg_caption;
CUIStatic* m_team1_score;
CUIStatic* m_team2_score;
CUIStatic* m_buy_msg_caption;

public:
CUIGameTDM();
Expand Down
12 changes: 6 additions & 6 deletions src/xrGame/UIPlayerItem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,11 @@ void UIPlayerItem::InitTextParams(CUIXml& uiXml)
if (!text_param_node)
break;
LPCSTR param_name = uiXml.ReadAttrib(text_param_node, "name", "param_name_not_set_in_name_attribute");
CUITextWnd* temp_static = xr_new<CUITextWnd>();
auto* temp_static = xr_new<CUIStatic>("Text param");
VERIFY(temp_static);
this->AttachChild(temp_static);
temp_static->SetAutoDelete(true);
CUIXmlInit::InitTextWnd(uiXml, TEXTPARAM_NODE_NAME, i, temp_static);
CUIXmlInit::InitStatic(uiXml, TEXTPARAM_NODE_NAME, i, temp_static);
m_text_params.emplace(shared_str(param_name), temp_static);
}
}
Expand Down Expand Up @@ -85,8 +85,8 @@ void UIPlayerItem::InitIconParams(CUIXml& uiXml)
void UIPlayerItem::UpdateTextParams(game_PlayerState const* ps)
{
buffer_vector<char> value_store(xr_alloca(512), 512, 512, char(0));
TMapStrToUIText::iterator ie = m_text_params.end();
for (TMapStrToUIText::iterator i = m_text_params.begin(); i != ie; ++i)
const auto ie = m_text_params.end();
for (auto i = m_text_params.begin(); i != ie; ++i)
{
VERIFY(i->second);
GetTextParamValue(ps, i->first, value_store);
Expand All @@ -98,8 +98,8 @@ void UIPlayerItem::UpdateTextParams(game_PlayerState const* ps)
void UIPlayerItem::UpdateIconParams(game_PlayerState const* ps)
{
buffer_vector<char> value_store(xr_alloca(512), 512, 512, char(0));
TMapStrToUIStatic::iterator ie = m_icon_params.end();
for (TMapStrToUIStatic::iterator i = m_icon_params.begin(); i != ie; ++i)
const auto ie = m_icon_params.end();
for (auto i = m_icon_params.begin(); i != ie; ++i)
{
VERIFY(i->second);
GetIconParamValue(ps, i->first, value_store);
Expand Down
6 changes: 3 additions & 3 deletions src/xrGame/UIPlayerItem.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ class UIPlayerItem final : public CUIWindow
{
private:
typedef CUIWindow inherited;
typedef AssociativeVector<shared_str, CUITextWnd*> TMapStrToUIText;
typedef AssociativeVector<shared_str, CUIStatsIcon*> TMapStrToUIStatic;
typedef AssociativeVector<shared_str, CUIStatic*> TMapStrToUIText;
typedef AssociativeVector<shared_str, CUIStatsIcon*> TMapStrToUIStats;
// this is for the case when user disconnects.
// we just call method RemovePlayer
UITeamState* m_teamState;
Expand All @@ -30,7 +30,7 @@ class UIPlayerItem final : public CUIWindow
s32 m_checkPoints;

TMapStrToUIText m_text_params;
TMapStrToUIStatic m_icon_params;
TMapStrToUIStats m_icon_params;

ClientID myClientId;
UIPlayerItem();
Expand Down
2 changes: 1 addition & 1 deletion src/xrGame/UIZoneMap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ void CUIZoneMap::Init(bool motionIconAttached)
{
CUIXmlInit::InitStatic(uiXml, "minimap:static_counter", 0, &m_Counter);
m_background.AttachChild(&m_Counter);
CUIXmlInit::InitTextWnd(uiXml, "minimap:static_counter:text_static", 0, &m_Counter_text);
CUIXmlInit::InitStatic(uiXml, "minimap:static_counter:text_static", 0, &m_Counter_text);
m_Counter.AttachChild(&m_Counter_text);

if (motionIconAttached)
Expand Down
2 changes: 1 addition & 1 deletion src/xrGame/UIZoneMap.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class CUIZoneMap
CUIStatic m_compass{ "Compass" };
CUIWindow m_clipFrame{ "Clip frame" };
CUIStatic m_Counter{ "Counter" };
CUITextWnd m_Counter_text{};
CUIStatic m_Counter_text{ "Counter text" };
CUIStatic* m_clock_wnd{};
CUIStatic* m_pointerDistanceText{};

Expand Down
Loading

0 comments on commit 56832f1

Please sign in to comment.