MCPcopy Create free account
hub / github.com/OGSR/OGSR-Engine / InitWindow

Method InitWindow

ogsr_engine/xrGame/ui/UIXmlInit.cpp:76–121  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

74}
75
76bool CUIXmlInit::InitWindow(CUIXml& xml_doc, LPCSTR path, int index, CUIWindow* pWnd)
77{
78 R_ASSERT3(xml_doc.NavigateToNode(path, index), "XML node not found", path);
79
80 float x = xml_doc.ReadAttribFlt(path, index, "x");
81 float y = xml_doc.ReadAttribFlt(path, index, "y");
82 InitAlignment(xml_doc, path, index, x, y, pWnd);
83 float width = xml_doc.ReadAttribFlt(path, index, "width");
84 float height = xml_doc.ReadAttribFlt(path, index, "height");
85 // Add by Zander
86 int as_is = xml_doc.ReadAttribInt(path, index, "as_is", 0);
87 if (as_is)
88 {
89 Fvector2 device_scale;
90 device_scale.x = 1024.0f / _max((float)Device.dwWidth, 1.0f);
91 device_scale.y = 768.0f / _max((float)Device.dwHeight, 1.0f);
92 width = width * device_scale.x;
93 height = height * device_scale.y;
94 }
95
96 int auto_kx = xml_doc.ReadAttribInt(path, index, "auto_kx", 0);
97 if (auto_kx)
98 {
99 width = width * UI()->get_current_kx();
100 }
101
102 pWnd->Init(x, y, width, height);
103
104 string512 buf;
105 CGameFont* LocalFont = NULL;
106 u32 cl;
107
108 strconcat(sizeof(buf), buf, path, ":font");
109 InitFont(xml_doc, buf, index, cl, LocalFont);
110 if (LocalFont)
111 pWnd->SetFont(LocalFont);
112
113 strconcat(sizeof(buf), buf, path, ":window_name");
114 if (xml_doc.NavigateToNode(buf, index))
115 pWnd->SetWindowName(xml_doc.Read(buf, index, NULL));
116 else if (xr_strlen(path))
117 pWnd->SetWindowName(path, TRUE);
118
119 InitAutoStaticGroup(xml_doc, path, index, pWnd);
120 return true;
121}
122
123//////////////////////////////////////////////////////////////////////////
124

Callers 15

InitMethod · 0.45
InitMethod · 0.45
InitMethod · 0.45
CUIQuestionItemMethod · 0.45
CUIAnswerItemMethod · 0.45
InitMethod · 0.45
CUIButtonHintMethod · 0.45
LoadMethod · 0.45
InitMethod · 0.45
InitMethod · 0.45
InitMethod · 0.45
InitMethod · 0.45

Calls 11

UIFunction · 0.85
NavigateToNodeMethod · 0.80
ReadAttribFltMethod · 0.80
ReadAttribIntMethod · 0.80
get_current_kxMethod · 0.80
SetWindowNameMethod · 0.80
_maxFunction · 0.50
xr_strlenFunction · 0.50
InitMethod · 0.45
SetFontMethod · 0.45
ReadMethod · 0.45

Tested by

no test coverage detected