From 073044747b5a3f172e5b03ab58b373cdd645c087 Mon Sep 17 00:00:00 2001 From: Damian Kaczmarek Date: Tue, 14 Dec 2010 01:20:47 +0100 Subject: -Working ui_scale parameter. (doing it properly would require lots of framework/interface job ...) --- src/game/client/ui.cpp | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) (limited to 'src/game/client/ui.cpp') diff --git a/src/game/client/ui.cpp b/src/game/client/ui.cpp index 3b323e56..020a0c70 100644 --- a/src/game/client/ui.cpp +++ b/src/game/client/ui.cpp @@ -69,13 +69,18 @@ CUIRect *CUI::Screen() void CUI::SetScale(float s) { - //config.UI()->Scale = (int)(s*100.0f); + g_Config.m_UiScale = (int)(s*100.0f); } -/*float CUI::Scale() +float CUI::Scale() { - return config.UI()->Scale/100.0f; -}*/ + return g_Config.m_UiScale/100.0f; +} + +float CUIRect::Scale() const +{ + return g_Config.m_UiScale/100.0f; +} void CUI::ClipEnable(const CUIRect *r) { @@ -138,6 +143,7 @@ void CUIRect::VSplitMid(CUIRect *pLeft, CUIRect *pRight) const { CUIRect r = *this; float Cut = r.w/2; +// Cut *= Scale(); if (pLeft) { @@ -313,7 +319,6 @@ void CUI::DoLabel(const CUIRect *r, const char *pText, float Size, int Align, in { // TODO: FIX ME!!!! //Graphics()->BlendNormal(); - Size *= Scale(); if(Align == 0) { float tw = TextRender()->TextWidth(0, Size, pText, MaxWidth); @@ -327,3 +332,8 @@ void CUI::DoLabel(const CUIRect *r, const char *pText, float Size, int Align, in TextRender()->Text(0, r->x + r->w-tw, r->y - Size/10, Size, pText, MaxWidth); } } + +void CUI::DoLabelScaled(const CUIRect *r, const char *pText, float Size, int Align, int MaxWidth) +{ + DoLabel(r, pText, Size*Scale(), Align, MaxWidth); +} \ No newline at end of file -- cgit 1.4.1