Skip to content

Commit

Permalink
xrGame: move UICore to GEnv
Browse files Browse the repository at this point in the history
  • Loading branch information
Xottab-DUTY committed Sep 23, 2018
1 parent 7c1a02d commit b91372a
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 2 additions & 0 deletions src/Include/xrAPI/xrAPI.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ class CRender;
class CScriptEngine;
class AISpaceBase;
class ISoundManager;
class UICore;

class XRAPI_API EngineGlobalEnvironment
{
Expand All @@ -27,6 +28,7 @@ class XRAPI_API EngineGlobalEnvironment
CScriptEngine* ScriptEngine;
AISpaceBase* AISpace;
ISoundManager* Sound;
UICore* UI;

bool isEditor;
bool isDedicatedServer;
Expand Down
5 changes: 2 additions & 3 deletions src/xrGame/GamePersistent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@ CGamePersistent::CGamePersistent(void)

ZeroMemory(ambient_sound_next_time, sizeof(ambient_sound_next_time));

m_pUI_core = NULL;
m_pMainMenu = NULL;
m_intro = NULL;
m_intro_event.bind(this, &CGamePersistent::start_logo_intro);
Expand Down Expand Up @@ -207,7 +206,7 @@ void CGamePersistent::OnAppStart()
GMLib.Load();
init_game_globals();
inherited::OnAppStart();
m_pUI_core = new UICore();
GEnv.UI = new UICore();
m_pMainMenu = new CMainMenu();
}

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

xr_delete(m_pMainMenu);
xr_delete(m_pUI_core);
xr_delete(GEnv.UI);

inherited::OnAppEnd();

Expand Down
1 change: 0 additions & 1 deletion src/xrGame/GamePersistent.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ class CGamePersistent : public IGame_Persistent, public IEventReceiver
void UpdateDof();

public:
UICore* m_pUI_core;
IReader* pDemoFile;
u32 uTime2Change;
EVENT eDemoStart;
Expand Down
4 changes: 2 additions & 2 deletions src/xrGame/ui_base.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@

pcstr UI_PATH = "ui";

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

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

0 comments on commit b91372a

Please sign in to comment.