@@ -20,22 +20,26 @@ extern volatile bool g_Quit;
20
20
21
21
namespace RTE {
22
22
23
- GUIControlManager *LoadingGUI::s_LoadingGUI = 0 ;
24
- AllegroInput *LoadingGUI::s_GUIInput = 0 ;
25
- AllegroScreen *LoadingGUI::s_GUIScreen = 0 ;
26
- Writer *LoadingGUI::s_LoadingLogWriter = 0 ;
27
- BITMAP *LoadingGUI::s_LoadingGUIBitmap = 0 ;
28
- int LoadingGUI::s_LoadingGUIPosX = 0 ;
29
- int LoadingGUI::s_LoadingGUIPosY = 0 ;
23
+ // ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
24
+
25
+ void LoadingGUI::Clear () {
26
+ m_ControlManager = 0 ;
27
+ m_GUIInput = 0 ;
28
+ m_GUIScreen = 0 ;
29
+ m_LoadingLogWriter = 0 ;
30
+ m_LoadingGUIBitmap = 0 ;
31
+ m_PosX = 0 ;
32
+ m_PosY = 0 ;
33
+ }
30
34
31
35
// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
32
36
33
37
void LoadingGUI::InitLoadingScreen () {
34
38
g_FrameMan.LoadPalette (" Base.rte/palette.bmp" );
35
39
36
40
// Create the main GUI
37
- s_GUIInput = new AllegroInput (-1 );
38
- s_GUIScreen = new AllegroScreen (g_FrameMan.GetBackBuffer32 ());
41
+ m_GUIInput = new AllegroInput (-1 );
42
+ m_GUIScreen = new AllegroScreen (g_FrameMan.GetBackBuffer32 ());
39
43
40
44
// Loading splash screen
41
45
g_FrameMan.ClearBackBuffer32 ();
@@ -55,22 +59,22 @@ namespace RTE {
55
59
g_FrameMan.FlipFrameBuffers ();
56
60
57
61
// Set up the loading GUI
58
- if (!s_LoadingGUI ) {
59
- s_LoadingGUI = new GUIControlManager ();
62
+ if (!m_ControlManager ) {
63
+ m_ControlManager = new GUIControlManager ();
60
64
61
65
// TODO: This should be using the 32bpp main menu skin, but isn't because it needs the config of the base for its listbox
62
66
// Can get away with this hack for now because the list box that the loading menu uses displays ok when drawn on a 32bpp buffer,
63
67
// when it's 8bpp internally, since it does not use any masked_blit calls to draw list boxes.
64
68
// Note also how the GUIScreen passed in here has been created with an 8bpp bitmap, since that is what determines what the GUI manager uses internally
65
- if (!s_LoadingGUI ->Create (s_GUIScreen, s_GUIInput , " Base.rte/GUIs/Skins/MainMenu" , " LoadingSkin.ini" )) {
69
+ if (!m_ControlManager ->Create (m_GUIScreen, m_GUIInput , " Base.rte/GUIs/Skins/MainMenu" , " LoadingSkin.ini" )) {
66
70
RTEAbort (" Failed to create GUI Control Manager and load it from Base.rte/GUIs/Skins/MainMenu/LoadingSkin.ini" );
67
71
}
68
- s_LoadingGUI ->Load (" Base.rte/GUIs/LoadingGUI.ini" );
72
+ m_ControlManager ->Load (" Base.rte/GUIs/LoadingGUI.ini" );
69
73
}
70
74
71
75
// Place and clear the sectionProgress box
72
- dynamic_cast <GUICollectionBox *>(s_LoadingGUI ->GetControl (" root" ))->SetSize (g_FrameMan.GetResX (), g_FrameMan.GetResY ());
73
- GUIListBox *pBox = dynamic_cast <GUIListBox *>(s_LoadingGUI ->GetControl (" ProgressBox" ));
76
+ dynamic_cast <GUICollectionBox *>(m_ControlManager ->GetControl (" root" ))->SetSize (g_FrameMan.GetResX (), g_FrameMan.GetResY ());
77
+ GUIListBox *pBox = dynamic_cast <GUIListBox *>(m_ControlManager ->GetControl (" ProgressBox" ));
74
78
// Make the box a bit bigger if there's room in higher, HD resolutions
75
79
if (g_FrameMan.GetResX () >= 960 ) {
76
80
// Make the loading progress box fill the right third of the screen
@@ -83,17 +87,17 @@ namespace RTE {
83
87
pBox->ClearList ();
84
88
85
89
// New mechanism to speed up loading times as it turned out that a massive amount of time is spent to update GUI control.
86
- if (!g_SettingsMan.DisableLoadingScreen () && !s_LoadingGUIBitmap ) {
90
+ if (!g_SettingsMan.DisableLoadingScreen () && !m_LoadingGUIBitmap ) {
87
91
pBox->SetVisible (false );
88
- s_LoadingGUIBitmap = create_bitmap_ex (8 , pBox->GetWidth (), pBox->GetHeight ());
89
- clear_to_color (s_LoadingGUIBitmap , 54 );
90
- rect (s_LoadingGUIBitmap , 0 , 0 , pBox->GetWidth () - 1 , pBox->GetHeight () - 1 , 33 );
91
- rect (s_LoadingGUIBitmap , 1 , 1 , pBox->GetWidth () - 2 , pBox->GetHeight () - 2 , 33 );
92
- s_LoadingGUIPosX = pBox->GetXPos ();
93
- s_LoadingGUIPosY = pBox->GetYPos ();
92
+ m_LoadingGUIBitmap = create_bitmap_ex (8 , pBox->GetWidth (), pBox->GetHeight ());
93
+ clear_to_color (m_LoadingGUIBitmap , 54 );
94
+ rect (m_LoadingGUIBitmap , 0 , 0 , pBox->GetWidth () - 1 , pBox->GetHeight () - 1 , 33 );
95
+ rect (m_LoadingGUIBitmap , 1 , 1 , pBox->GetWidth () - 2 , pBox->GetHeight () - 2 , 33 );
96
+ m_PosX = pBox->GetXPos ();
97
+ m_PosY = pBox->GetYPos ();
94
98
}
95
99
// Create the loading log writer
96
- if (!s_LoadingLogWriter ) { s_LoadingLogWriter = new Writer (" LogLoading.txt" ); }
100
+ if (!m_LoadingLogWriter ) { m_LoadingLogWriter = new Writer (" LogLoading.txt" ); }
97
101
98
102
// Load all the data modules
99
103
LoadDataModules ();
@@ -104,26 +108,26 @@ namespace RTE {
104
108
void LoadingGUI::LoadingSplashProgressReport (std::string reportString, bool newItem) {
105
109
if (g_System.GetLogToCLI ()) { g_System.PrintLoadingToCLI (reportString, newItem); }
106
110
107
- if (s_LoadingGUI ) {
111
+ if (g_LoadingGUI. m_ControlManager ) {
108
112
g_UInputMan.Update ();
109
113
if (newItem) {
110
114
// Write out the last line to the log file before starting a new one
111
- if (s_LoadingLogWriter ->WriterOK ()) { *s_LoadingLogWriter << reportString << " \n " ; }
115
+ if (g_LoadingGUI. m_LoadingLogWriter ->WriterOK ()) { *g_LoadingGUI. m_LoadingLogWriter << reportString << " \n " ; }
112
116
// Scroll bitmap upwards
113
- if (s_LoadingGUIBitmap ) { blit (s_LoadingGUIBitmap, s_LoadingGUIBitmap , 2 , 12 , 2 , 2 , s_LoadingGUIBitmap ->w - 3 , s_LoadingGUIBitmap ->h - 12 ); }
117
+ if (g_LoadingGUI. m_LoadingGUIBitmap ) { blit (g_LoadingGUI. m_LoadingGUIBitmap , g_LoadingGUI. m_LoadingGUIBitmap , 2 , 12 , 2 , 2 , g_LoadingGUI. m_LoadingGUIBitmap ->w - 3 , g_LoadingGUI. m_LoadingGUIBitmap ->h - 12 ); }
114
118
}
115
- if (s_LoadingGUIBitmap ) {
116
- AllegroBitmap bmp (s_LoadingGUIBitmap );
119
+ if (g_LoadingGUI. m_LoadingGUIBitmap ) {
120
+ AllegroBitmap bmp (g_LoadingGUI. m_LoadingGUIBitmap );
117
121
// Clear current line
118
- rectfill (s_LoadingGUIBitmap , 2 , s_LoadingGUIBitmap ->h - 12 , s_LoadingGUIBitmap ->w - 3 , s_LoadingGUIBitmap ->h - 3 , 54 );
122
+ rectfill (g_LoadingGUI. m_LoadingGUIBitmap , 2 , g_LoadingGUI. m_LoadingGUIBitmap ->h - 12 , g_LoadingGUI. m_LoadingGUIBitmap ->w - 3 , g_LoadingGUI. m_LoadingGUIBitmap ->h - 3 , 54 );
119
123
// Print new line
120
- g_FrameMan.GetSmallFont ()->DrawAligned (&bmp, 5 , s_LoadingGUIBitmap ->h - 12 , reportString.c_str (), GUIFont::Left);
124
+ g_FrameMan.GetSmallFont ()->DrawAligned (&bmp, 5 , g_LoadingGUI. m_LoadingGUIBitmap ->h - 12 , reportString.c_str (), GUIFont::Left);
121
125
// DrawAligned - MaxWidth is useless here, so we're just drawing lines manually
122
- vline (s_LoadingGUIBitmap, s_LoadingGUIBitmap ->w - 2 , s_LoadingGUIBitmap ->h - 12 , s_LoadingGUIBitmap ->h - 2 , 33 );
123
- vline (s_LoadingGUIBitmap, s_LoadingGUIBitmap ->w - 1 , s_LoadingGUIBitmap ->h - 12 , s_LoadingGUIBitmap ->h - 2 , 33 );
126
+ vline (g_LoadingGUI. m_LoadingGUIBitmap , g_LoadingGUI. m_LoadingGUIBitmap ->w - 2 , g_LoadingGUI. m_LoadingGUIBitmap ->h - 12 , g_LoadingGUI. m_LoadingGUIBitmap ->h - 2 , 33 );
127
+ vline (g_LoadingGUI. m_LoadingGUIBitmap , g_LoadingGUI. m_LoadingGUIBitmap ->w - 1 , g_LoadingGUI. m_LoadingGUIBitmap ->h - 12 , g_LoadingGUI. m_LoadingGUIBitmap ->h - 2 , 33 );
124
128
125
129
// Draw onto current frame buffer
126
- blit (s_LoadingGUIBitmap , g_FrameMan.GetBackBuffer32 (), 0 , 0 , s_LoadingGUIPosX, s_LoadingGUIPosY, s_LoadingGUIBitmap ->w , s_LoadingGUIBitmap ->h );
130
+ blit (g_LoadingGUI. m_LoadingGUIBitmap , g_FrameMan.GetBackBuffer32 (), 0 , 0 , g_LoadingGUI. m_PosX , g_LoadingGUI. m_PosY , g_LoadingGUI. m_LoadingGUIBitmap ->w , g_LoadingGUI. m_LoadingGUIBitmap ->h );
127
131
128
132
g_FrameMan.FlipFrameBuffers ();
129
133
}
0 commit comments