Skip to content

Commit

Permalink
xrGame/ui/UILoadingScreen: robust loading screen.
Browse files Browse the repository at this point in the history
It will exist even if there's no XML file for it.
  • Loading branch information
Xottab-DUTY committed Sep 25, 2018
1 parent 6f26ab8 commit b7b3401
Show file tree
Hide file tree
Showing 2 changed files with 90 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/xrGame/ui/UILoadingScreen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

#include "StdAfx.h"
#include "UILoadingScreen.h"
#include "UILoadingScreenHardcoded.h"

#include "xrEngine/x_ray.h"
#include "xrEngine/GameFont.h"
Expand All @@ -27,7 +28,15 @@ UILoadingScreen::UILoadingScreen()
void UILoadingScreen::Initialize()
{
CUIXml uiXml;
uiXml.Load(CONFIG_PATH, UI_PATH, UI_PATH_DEFAULT, "ui_mm_loading_screen.xml");
bool result = uiXml.Load(CONFIG_PATH, UI_PATH, UI_PATH_DEFAULT, "ui_mm_loading_screen.xml");

if (!result) // Robustness? Yes!
{
if (UI().is_widescreen())
uiXml.Set(LoadingScreenXML16x9);
else
uiXml.Set(LoadingScreenXML);
}

loadingProgressBackground = UIHelper::CreateStatic(uiXml, "loading_progress_background", this);
loadingProgress = UIHelper::CreateProgressBar(uiXml, "loading_progress", this);
Expand Down
80 changes: 80 additions & 0 deletions src/xrGame/ui/UILoadingScreenHardcoded.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
#pragma once

constexpr pcstr LoadingScreenXML =
"<w>\
<background width=\"1024\" height=\"768\">\
<auto_static width=\"1024\" height=\"768\">\
<texture>ui_mm_loading_screen</texture>\
</auto_static>\
</background>\
<loading_logo x=\"0\" y=\"173\" width=\"1024\" height=\"399\">\
</loading_logo>\
<loading_progress_background x=\"260\" y=\"599\" width=\"506\" height=\"4\">\
<texture color=\"black\" a=\"255\">ui_mm_loading_progress_bar</texture>\
</loading_progress_background>\
<loading_progress x=\"260\" y=\"599\" width=\"506\" height=\"4\" horz=\"1\" min=\"0\" max=\"100\" pos=\"0\" inertion=\"5.0\">\
<progress>\
<texture>ui_mm_loading_progress_bar</texture>\
</progress>\
<min_color r=\"30\" g=\"88\" b=\"126\"/>\
<middle_color r=\"60\" g=\"118\" b=\"156\"/>\
<max_color r=\"90\" g=\"148\" b=\"186\"/>\
</loading_progress>\
<loading_progress_percent x=\"260\" y=\"574\" width=\"506\" height=\"20\">\
<text align=\"c\" r=\"170\" g=\"170\" b=\"170\" a=\"0\" font=\"letterica18\"/>\
</loading_progress_percent>\
<loading_stage x=\"260\" y=\"530\" width=\"506\" height=\"20\">\
<text align=\"c\" r=\"170\" g=\"170\" b=\"170\" font=\"letterica18\"/>\
</loading_stage>\
<loading_header x=\"260\" y=\"622\" width=\"506\" height=\"20\">\
<text align=\"c\" r=\"103\" g=\"103\" b=\"103\" font=\"letterica18\"/>\
</loading_header>\
<loading_tip_number x=\"260\" y=\"658\" width=\"506\" height=\"20\">\
<text align=\"c\" r=\"103\" g=\"103\" b=\"103\" font=\"letterica18\"/>\
</loading_tip_number>\
<loading_tip x=\"163\" y=\"676\" width=\"700\" height=\"80\" complex_mode=\"1\">\
<text alignment=\"c\" align=\"c\" r=\"103\" g=\"103\" b=\"103\" font=\"letterica18\"/>\
</loading_tip>\
</w>";

constexpr pcstr LoadingScreenXML16x9 =
"<w>\
<background width=\"1024\" height=\"768\">\
<auto_static x=\"102\" y=\"0\" width=\"819\" height=\"768\" stretch=\"1\">\
<texture>ui_mm_loading_screen</texture>\
</auto_static>\
<auto_static x=\"0\" y=\"0\" width=\"104\" height=\"768\" stretch=\"1\">\
<texture>ui_mm_loading_left_widepanel</texture>\
</auto_static>\
<auto_static x=\"920\" y=\"0\" width=\"104\" height=\"768\" stretch=\"1\">\
<texture>ui_mm_loading_right_widepanel</texture>\
</auto_static>\
</background>\
<loading_logo x=\"102\" y=\"173\" width=\"819\" height=\"512\" stretch=\"1\"/>\
<loading_progress_background x=\"310\" y=\"599\" width=\"405\" height=\"5\" stretch=\"1\">\
<texture width=\"405\" height=\"4\" color=\"black\" a=\"255\" stretch=\"1\">ui_mm_loading_progress_bar</texture>\
</loading_progress_background>\
<loading_progress x=\"310\" y=\"599\" width=\"405\" height=\"5\" horz=\"1\" min=\"0\" max=\"100\" pos=\"0\" inertion=\"5.0\">\
<progress>\
<texture>ui_mm_loading_progress_bar</texture>\
</progress>\
<min_color r=\"30\" g=\"88\" b=\"126\"/>\
<middle_color r=\"60\" g=\"118\" b=\"156\"/>\
<max_color r=\"90\" g=\"148\" b=\"186\"/>\
</loading_progress>\
<loading_progress_percent x=\"310\" y=\"574\" width=\"405\" height=\"20\" stretch=\"1\">\
<text align=\"c\" r=\"170\" g=\"170\" b=\"170\" a=\"0\" font=\"letterica18\"/>\
</loading_progress_percent>\
<loading_stage x=\"310\" y=\"530\" width=\"405\" height=\"20\" stretch=\"1\">\
<text align=\"c\" r=\"170\" g=\"170\" b=\"170\" font=\"letterica18\"/>\
</loading_stage>\
<loading_header x=\"310\" y=\"622\" width=\"405\" height=\"20\" stretch=\"1\">\
<text align=\"c\" r=\"103\" g=\"103\" b=\"103\" font=\"letterica18\"/>\
</loading_header>\
<loading_tip_number x=\"310\" y=\"658\" width=\"405\" height=\"20\" stretch=\"1\">\
<text align=\"c\" r=\"103\" g=\"103\" b=\"103\" font=\"letterica18\"/>\
</loading_tip_number>\
<loading_tip x=\"273\" y=\"676\" width=\"480\" height=\"80\" complex_mode=\"1\" stretch=\"1\">\
<text alignment=\"c\" align=\"c\" r=\"103\" g=\"103\" b=\"103\" font=\"letterica18\"/>\
</loading_tip>\
</w>";

0 comments on commit b7b3401

Please sign in to comment.