Skip to content

Commit

Permalink
xrGame: rename ui_core -> UICore
Browse files Browse the repository at this point in the history
  • Loading branch information
Xottab-DUTY committed Sep 23, 2018
1 parent 5f33228 commit 7c1a02d
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 24 deletions.
2 changes: 1 addition & 1 deletion src/xrGame/GamePersistent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ void CGamePersistent::OnAppStart()
GMLib.Load();
init_game_globals();
inherited::OnAppStart();
m_pUI_core = new ui_core();
m_pUI_core = new UICore();
m_pMainMenu = new CMainMenu();
}

Expand Down
4 changes: 2 additions & 2 deletions src/xrGame/GamePersistent.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class CMainMenu;
class CUICursor;
class CParticlesObject;
class CUISequencer;
class ui_core;
class UICore;

class CGamePersistent : public IGame_Persistent, public IEventReceiver
{
Expand Down Expand Up @@ -53,7 +53,7 @@ class CGamePersistent : public IGame_Persistent, public IEventReceiver
void UpdateDof();

public:
ui_core* m_pUI_core;
UICore* m_pUI_core;
IReader* pDemoFile;
u32 uTime2Change;
EVENT eDemoStart;
Expand Down
34 changes: 17 additions & 17 deletions src/xrGame/ui_base.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
pcstr UI_PATH = "ui";

CUICursor& GetUICursor() { return UI().GetUICursor(); };
ui_core& UI() { return *GamePersistent().m_pUI_core; };
UICore& UI() { return *GamePersistent().m_pUI_core; };
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 Expand Up @@ -112,46 +112,46 @@ sPoly2D* C2DFrustum::ClipPoly(sPoly2D& S, sPoly2D& D) const
return dest;
}

void ui_core::OnDeviceReset()
void UICore::OnDeviceReset()
{
m_scale_.set(float(Device.dwWidth) / UI_BASE_WIDTH, float(Device.dwHeight) / UI_BASE_HEIGHT);

m_2DFrustum.CreateFromRect(Frect().set(0.0f, 0.0f, float(Device.dwWidth), float(Device.dwHeight)));
}

void ui_core::ClientToScreenScaled(Fvector2& dest, float left, float top) const
void UICore::ClientToScreenScaled(Fvector2& dest, float left, float top) const
{
if (m_currentPointType != IUIRender::pttLIT)
dest.set(ClientToScreenScaledX(left), ClientToScreenScaledY(top));
else
dest.set(left, top);
}

void ui_core::ClientToScreenScaled(Fvector2& src_and_dest) const
void UICore::ClientToScreenScaled(Fvector2& src_and_dest) const
{
if (m_currentPointType != IUIRender::pttLIT)
src_and_dest.set(ClientToScreenScaledX(src_and_dest.x), ClientToScreenScaledY(src_and_dest.y));
}

void ui_core::ClientToScreenScaledWidth(float& src_and_dest) const
void UICore::ClientToScreenScaledWidth(float& src_and_dest) const
{
if (m_currentPointType != IUIRender::pttLIT)
src_and_dest /= m_current_scale->x;
}

void ui_core::ClientToScreenScaledHeight(float& src_and_dest) const
void UICore::ClientToScreenScaledHeight(float& src_and_dest) const
{
if (m_currentPointType != IUIRender::pttLIT)
src_and_dest /= m_current_scale->y;
}

void ui_core::AlignPixel(float& src_and_dest) const
void UICore::AlignPixel(float& src_and_dest) const
{
if (m_currentPointType != IUIRender::pttLIT)
src_and_dest = (float)iFloor(src_and_dest);
}

void ui_core::PushScissor(const Frect& r_tgt, bool overlapped)
void UICore::PushScissor(const Frect& r_tgt, bool overlapped)
{
if (UI().m_currentPointType == IUIRender::pttLIT)
return;
Expand Down Expand Up @@ -186,7 +186,7 @@ void ui_core::PushScissor(const Frect& r_tgt, bool overlapped)
GEnv.UIRender->SetScissor(&r);
}

void ui_core::PopScissor()
void UICore::PopScissor()
{
if (UI().m_currentPointType == IUIRender::pttLIT)
return;
Expand All @@ -209,7 +209,7 @@ void ui_core::PopScissor()
}
}

ui_core::ui_core()
UICore::UICore()
{
if (!GEnv.isDedicatedServer)
{
Expand All @@ -230,13 +230,13 @@ ui_core::ui_core()
m_currentPointType = IUIRender::pttTL;
}

ui_core::~ui_core()
UICore::~UICore()
{
xr_delete(m_pFontManager);
xr_delete(m_pUICursor);
}

void ui_core::pp_start()
void UICore::pp_start()
{
m_bPostprocess = true;

Expand All @@ -251,20 +251,20 @@ void ui_core::pp_start()
float(GEnv.Render->getTarget()->get_height()) / float(Device.dwHeight));
}

void ui_core::pp_stop()
void UICore::pp_stop()
{
m_bPostprocess = false;
m_current_scale = &m_scale_;
g_current_font_scale.set(1.0f, 1.0f);
}

void ui_core::RenderFont() { Font().Render(); }
bool ui_core::is_widescreen()
void UICore::RenderFont() { Font().Render(); }
bool UICore::is_widescreen()
{
return (Device.dwWidth) / float(Device.dwHeight) > (UI_BASE_WIDTH / UI_BASE_HEIGHT + 0.01f);
}

float ui_core::get_current_kx()
float UICore::get_current_kx()
{
float h = float(Device.dwHeight);
float w = float(Device.dwWidth);
Expand All @@ -273,7 +273,7 @@ float ui_core::get_current_kx()
return res;
}

shared_str ui_core::get_xml_name(LPCSTR fn)
shared_str UICore::get_xml_name(LPCSTR fn)
{
string_path str;
if (!is_widescreen())
Expand Down
8 changes: 4 additions & 4 deletions src/xrGame/ui_base.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ struct CFontManager : public pureDeviceReset
virtual void OnDeviceReset();
};

class ui_core : public CDeviceResetNotifier
class UICore : public CDeviceResetNotifier
{
C2DFrustum m_2DFrustum;
C2DFrustum m_2DFrustumPP;
Expand All @@ -68,8 +68,8 @@ class ui_core : public CDeviceResetNotifier
public:
xr_stack<Frect> m_Scissors;

ui_core();
~ui_core();
UICore();
~UICore();
CFontManager& Font() { return *m_pFontManager; }
CUICursor& GetUICursor() { return *m_pUICursor; }
IC float ClientToScreenScaledX(float left) const { return left * m_current_scale->x; };
Expand Down Expand Up @@ -98,5 +98,5 @@ class ui_core : public CDeviceResetNotifier
};

extern CUICursor& GetUICursor();
extern ui_core& UI();
extern UICore& UI();
extern CUIGameCustom* CurrentGameUI();

0 comments on commit 7c1a02d

Please sign in to comment.