Skip to content

Commit b91372a

Browse files
committed
xrGame: move UICore to GEnv
1 parent 7c1a02d commit b91372a

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

src/Include/xrAPI/xrAPI.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ class CRender;
1111
class CScriptEngine;
1212
class AISpaceBase;
1313
class ISoundManager;
14+
class UICore;
1415

1516
class XRAPI_API EngineGlobalEnvironment
1617
{
@@ -27,6 +28,7 @@ class XRAPI_API EngineGlobalEnvironment
2728
CScriptEngine* ScriptEngine;
2829
AISpaceBase* AISpace;
2930
ISoundManager* Sound;
31+
UICore* UI;
3032

3133
bool isEditor;
3234
bool isDedicatedServer;

src/xrGame/GamePersistent.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,6 @@ CGamePersistent::CGamePersistent(void)
116116

117117
ZeroMemory(ambient_sound_next_time, sizeof(ambient_sound_next_time));
118118

119-
m_pUI_core = NULL;
120119
m_pMainMenu = NULL;
121120
m_intro = NULL;
122121
m_intro_event.bind(this, &CGamePersistent::start_logo_intro);
@@ -207,7 +206,7 @@ void CGamePersistent::OnAppStart()
207206
GMLib.Load();
208207
init_game_globals();
209208
inherited::OnAppStart();
210-
m_pUI_core = new UICore();
209+
GEnv.UI = new UICore();
211210
m_pMainMenu = new CMainMenu();
212211
}
213212

@@ -217,7 +216,7 @@ void CGamePersistent::OnAppEnd()
217216
m_pMainMenu->Activate(false);
218217

219218
xr_delete(m_pMainMenu);
220-
xr_delete(m_pUI_core);
219+
xr_delete(GEnv.UI);
221220

222221
inherited::OnAppEnd();
223222

src/xrGame/GamePersistent.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ class CGamePersistent : public IGame_Persistent, public IEventReceiver
5353
void UpdateDof();
5454

5555
public:
56-
UICore* m_pUI_core;
5756
IReader* pDemoFile;
5857
u32 uTime2Change;
5958
EVENT eDemoStart;

src/xrGame/ui_base.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55

66
pcstr UI_PATH = "ui";
77

8-
CUICursor& GetUICursor() { return UI().GetUICursor(); };
9-
UICore& UI() { return *GamePersistent().m_pUI_core; };
8+
CUICursor& GetUICursor() { return GEnv.UI->GetUICursor(); }
9+
UICore& UI() { return *GEnv.UI; }
1010
extern ENGINE_API Fvector2 g_current_font_scale;
1111

1212
void S2DVert::rotate_pt(const Fvector2& pivot, const float cosA, const float sinA, const float kx)

0 commit comments

Comments
 (0)