Skip to content

Commit b7b3401

Browse files
committed
xrGame/ui/UILoadingScreen: robust loading screen.
It will exist even if there's no XML file for it.
1 parent 6f26ab8 commit b7b3401

File tree

2 files changed

+90
-1
lines changed

2 files changed

+90
-1
lines changed

src/xrGame/ui/UILoadingScreen.cpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
#include "StdAfx.h"
1111
#include "UILoadingScreen.h"
12+
#include "UILoadingScreenHardcoded.h"
1213

1314
#include "xrEngine/x_ray.h"
1415
#include "xrEngine/GameFont.h"
@@ -27,7 +28,15 @@ UILoadingScreen::UILoadingScreen()
2728
void UILoadingScreen::Initialize()
2829
{
2930
CUIXml uiXml;
30-
uiXml.Load(CONFIG_PATH, UI_PATH, UI_PATH_DEFAULT, "ui_mm_loading_screen.xml");
31+
bool result = uiXml.Load(CONFIG_PATH, UI_PATH, UI_PATH_DEFAULT, "ui_mm_loading_screen.xml");
32+
33+
if (!result) // Robustness? Yes!
34+
{
35+
if (UI().is_widescreen())
36+
uiXml.Set(LoadingScreenXML16x9);
37+
else
38+
uiXml.Set(LoadingScreenXML);
39+
}
3140

3241
loadingProgressBackground = UIHelper::CreateStatic(uiXml, "loading_progress_background", this);
3342
loadingProgress = UIHelper::CreateProgressBar(uiXml, "loading_progress", this);
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
#pragma once
2+
3+
constexpr pcstr LoadingScreenXML =
4+
"<w>\
5+
<background width=\"1024\" height=\"768\">\
6+
<auto_static width=\"1024\" height=\"768\">\
7+
<texture>ui_mm_loading_screen</texture>\
8+
</auto_static>\
9+
</background>\
10+
<loading_logo x=\"0\" y=\"173\" width=\"1024\" height=\"399\">\
11+
</loading_logo>\
12+
<loading_progress_background x=\"260\" y=\"599\" width=\"506\" height=\"4\">\
13+
<texture color=\"black\" a=\"255\">ui_mm_loading_progress_bar</texture>\
14+
</loading_progress_background>\
15+
<loading_progress x=\"260\" y=\"599\" width=\"506\" height=\"4\" horz=\"1\" min=\"0\" max=\"100\" pos=\"0\" inertion=\"5.0\">\
16+
<progress>\
17+
<texture>ui_mm_loading_progress_bar</texture>\
18+
</progress>\
19+
<min_color r=\"30\" g=\"88\" b=\"126\"/>\
20+
<middle_color r=\"60\" g=\"118\" b=\"156\"/>\
21+
<max_color r=\"90\" g=\"148\" b=\"186\"/>\
22+
</loading_progress>\
23+
<loading_progress_percent x=\"260\" y=\"574\" width=\"506\" height=\"20\">\
24+
<text align=\"c\" r=\"170\" g=\"170\" b=\"170\" a=\"0\" font=\"letterica18\"/>\
25+
</loading_progress_percent>\
26+
<loading_stage x=\"260\" y=\"530\" width=\"506\" height=\"20\">\
27+
<text align=\"c\" r=\"170\" g=\"170\" b=\"170\" font=\"letterica18\"/>\
28+
</loading_stage>\
29+
<loading_header x=\"260\" y=\"622\" width=\"506\" height=\"20\">\
30+
<text align=\"c\" r=\"103\" g=\"103\" b=\"103\" font=\"letterica18\"/>\
31+
</loading_header>\
32+
<loading_tip_number x=\"260\" y=\"658\" width=\"506\" height=\"20\">\
33+
<text align=\"c\" r=\"103\" g=\"103\" b=\"103\" font=\"letterica18\"/>\
34+
</loading_tip_number>\
35+
<loading_tip x=\"163\" y=\"676\" width=\"700\" height=\"80\" complex_mode=\"1\">\
36+
<text alignment=\"c\" align=\"c\" r=\"103\" g=\"103\" b=\"103\" font=\"letterica18\"/>\
37+
</loading_tip>\
38+
</w>";
39+
40+
constexpr pcstr LoadingScreenXML16x9 =
41+
"<w>\
42+
<background width=\"1024\" height=\"768\">\
43+
<auto_static x=\"102\" y=\"0\" width=\"819\" height=\"768\" stretch=\"1\">\
44+
<texture>ui_mm_loading_screen</texture>\
45+
</auto_static>\
46+
<auto_static x=\"0\" y=\"0\" width=\"104\" height=\"768\" stretch=\"1\">\
47+
<texture>ui_mm_loading_left_widepanel</texture>\
48+
</auto_static>\
49+
<auto_static x=\"920\" y=\"0\" width=\"104\" height=\"768\" stretch=\"1\">\
50+
<texture>ui_mm_loading_right_widepanel</texture>\
51+
</auto_static>\
52+
</background>\
53+
<loading_logo x=\"102\" y=\"173\" width=\"819\" height=\"512\" stretch=\"1\"/>\
54+
<loading_progress_background x=\"310\" y=\"599\" width=\"405\" height=\"5\" stretch=\"1\">\
55+
<texture width=\"405\" height=\"4\" color=\"black\" a=\"255\" stretch=\"1\">ui_mm_loading_progress_bar</texture>\
56+
</loading_progress_background>\
57+
<loading_progress x=\"310\" y=\"599\" width=\"405\" height=\"5\" horz=\"1\" min=\"0\" max=\"100\" pos=\"0\" inertion=\"5.0\">\
58+
<progress>\
59+
<texture>ui_mm_loading_progress_bar</texture>\
60+
</progress>\
61+
<min_color r=\"30\" g=\"88\" b=\"126\"/>\
62+
<middle_color r=\"60\" g=\"118\" b=\"156\"/>\
63+
<max_color r=\"90\" g=\"148\" b=\"186\"/>\
64+
</loading_progress>\
65+
<loading_progress_percent x=\"310\" y=\"574\" width=\"405\" height=\"20\" stretch=\"1\">\
66+
<text align=\"c\" r=\"170\" g=\"170\" b=\"170\" a=\"0\" font=\"letterica18\"/>\
67+
</loading_progress_percent>\
68+
<loading_stage x=\"310\" y=\"530\" width=\"405\" height=\"20\" stretch=\"1\">\
69+
<text align=\"c\" r=\"170\" g=\"170\" b=\"170\" font=\"letterica18\"/>\
70+
</loading_stage>\
71+
<loading_header x=\"310\" y=\"622\" width=\"405\" height=\"20\" stretch=\"1\">\
72+
<text align=\"c\" r=\"103\" g=\"103\" b=\"103\" font=\"letterica18\"/>\
73+
</loading_header>\
74+
<loading_tip_number x=\"310\" y=\"658\" width=\"405\" height=\"20\" stretch=\"1\">\
75+
<text align=\"c\" r=\"103\" g=\"103\" b=\"103\" font=\"letterica18\"/>\
76+
</loading_tip_number>\
77+
<loading_tip x=\"273\" y=\"676\" width=\"480\" height=\"80\" complex_mode=\"1\" stretch=\"1\">\
78+
<text alignment=\"c\" align=\"c\" r=\"103\" g=\"103\" b=\"103\" font=\"letterica18\"/>\
79+
</loading_tip>\
80+
</w>";

0 commit comments

Comments
 (0)