about summary refs log tree commit diff
path: root/src/game
diff options
context:
space:
mode:
authorDamian Kaczmarek <rush@rushbase.net>2010-12-14 01:20:47 +0100
committeroy <Tom_Adams@web.de>2011-01-05 12:14:36 +0100
commit073044747b5a3f172e5b03ab58b373cdd645c087 (patch)
tree6c8425d2346f61d5f9bab3a0ae79a1a0281c8d5a /src/game
parentaad2438882943b23a72cee28c1b71d217883ebf9 (diff)
downloadzcatch-073044747b5a3f172e5b03ab58b373cdd645c087.tar.gz
zcatch-073044747b5a3f172e5b03ab58b373cdd645c087.zip
-Working ui_scale parameter.
(doing it properly would require lots of framework/interface job ...)
Diffstat (limited to 'src/game')
-rw-r--r--src/game/client/components/menus.cpp32
-rw-r--r--src/game/client/components/menus.h2
-rw-r--r--src/game/client/components/menus_browser.cpp44
-rw-r--r--src/game/client/components/menus_demo.cpp2
-rw-r--r--src/game/client/components/menus_ingame.cpp10
-rw-r--r--src/game/client/components/menus_settings.cpp51
-rw-r--r--src/game/client/ui.cpp20
-rw-r--r--src/game/client/ui.h5
-rw-r--r--src/game/variables.h2
9 files changed, 92 insertions, 76 deletions
diff --git a/src/game/client/components/menus.cpp b/src/game/client/components/menus.cpp
index f06543a9..8e8a8654 100644
--- a/src/game/client/components/menus.cpp
+++ b/src/game/client/components/menus.cpp
@@ -164,6 +164,8 @@ int CMenus::DoEditBox(void *pID, const CUIRect *pRect, char *pStr, unsigned StrS
 	static bool s_DoScroll = false;
 	static float s_ScrollStart = 0.0f;
 
+	FontSize *= UI()->Scale();
+
 	if(UI()->LastActiveItem() == pID)
 	{
 		int Len = str_length(pStr);
@@ -259,11 +261,11 @@ int CMenus::DoEditBox(void *pID, const CUIRect *pRect, char *pStr, unsigned StrS
 	// check if the text has to be moved
 	if(UI()->LastActiveItem() == pID && !JustGotActive && (UpdateOffset || m_NumInputEvents))
 	{
-		float w = TextRender()->TextWidth(0, FontSize, pDisplayStr, s_AtIndex)*UI()->Scale();
+		float w = TextRender()->TextWidth(0, FontSize, pDisplayStr, s_AtIndex);
 		if(w-*Offset > Textbox.w)
 		{
 			// move to the left
-			float wt = TextRender()->TextWidth(0, FontSize, pDisplayStr, -1)*UI()->Scale();
+			float wt = TextRender()->TextWidth(0, FontSize, pDisplayStr, -1);
 			do
 			{
 				*Offset += min(wt-*Offset-Textbox.w, Textbox.w/3);
@@ -281,7 +283,7 @@ int CMenus::DoEditBox(void *pID, const CUIRect *pRect, char *pStr, unsigned StrS
 		}
 	}
 	UI()->ClipEnable(pRect);
-	Textbox.x -= *Offset*UI()->Scale();
+	Textbox.x -= *Offset;
 
 	UI()->DoLabel(&Textbox, pDisplayStr, FontSize, -1);
 	
@@ -291,7 +293,7 @@ int CMenus::DoEditBox(void *pID, const CUIRect *pRect, char *pStr, unsigned StrS
 		float w = TextRender()->TextWidth(0, FontSize, pDisplayStr, s_AtIndex);
 		Textbox = *pRect;
 		Textbox.VSplitLeft(2.0f, 0, &Textbox);
-		Textbox.x += (w-*Offset-TextRender()->TextWidth(0, FontSize, "|", -1)/2)*UI()->Scale();
+		Textbox.x += (w-*Offset-TextRender()->TextWidth(0, FontSize, "|", -1)/2);
 
 		if((2*time_get()/time_freq()) % 2)	// make it blink
 			UI()->DoLabel(&Textbox, "|", FontSize, -1);
@@ -609,7 +611,7 @@ void CMenus::RenderLoading(float Percent)
 	
     CUIRect Screen = *UI()->Screen();
 	Graphics()->MapScreen(Screen.x, Screen.y, Screen.w, Screen.h);
-	
+
 	RenderBackground();
 
 	float tw;
@@ -860,23 +862,23 @@ int CMenus::Render()
 		
 		CUIRect Box, Part;
 		Box = Screen;
-		Box.VMargin(150.0f, &Box);
-		Box.HMargin(150.0f, &Box);
+		Box.VMargin(150.0f/UI()->Scale(), &Box);
+		Box.HMargin(150.0f/UI()->Scale(), &Box);
 		
 		// render the box
 		RenderTools()->DrawUIRect(&Box, vec4(0,0,0,0.5f), CUI::CORNER_ALL, 15.0f);
 		 
-		Box.HSplitTop(20.f, &Part, &Box);
-		Box.HSplitTop(24.f, &Part, &Box);
-		UI()->DoLabel(&Part, pTitle, 24.f, 0);
-		Box.HSplitTop(20.f, &Part, &Box);
-		Box.HSplitTop(24.f, &Part, &Box);
-		Part.VMargin(20.f, &Part);
+		Box.HSplitTop(20.f/UI()->Scale(), &Part, &Box);
+		Box.HSplitTop(24.f/UI()->Scale(), &Part, &Box);
+		UI()->DoLabelScaled(&Part, pTitle, 24.f, 0);
+		Box.HSplitTop(20.f/UI()->Scale(), &Part, &Box);
+		Box.HSplitTop(24.f/UI()->Scale(), &Part, &Box);
+		Part.VMargin(20.f/UI()->Scale(), &Part);
 		
 		if(ExtraAlign == -1)
-			UI()->DoLabel(&Part, pExtraText, 20.f, -1, (int)Part.w);
+			UI()->DoLabelScaled(&Part, pExtraText, 20.f, -1, (int)Part.w);
 		else
-			UI()->DoLabel(&Part, pExtraText, 20.f, 0, -1);
+			UI()->DoLabelScaled(&Part, pExtraText, 20.f, 0, -1);
 
 		if(m_Popup == POPUP_QUIT)
 		{
diff --git a/src/game/client/components/menus.h b/src/game/client/components/menus.h
index 37d34224..c44b9dab 100644
--- a/src/game/client/components/menus.h
+++ b/src/game/client/components/menus.h
@@ -81,7 +81,7 @@ class CMenus : public CComponent
 	void UiDoListboxStart(void *pId, const CUIRect *pRect, float RowHeight, const char *pTitle, const char *pBottomText, int NumItems,
 						  int ItemsPerRow, int SelectedIndex, float ScrollValue);
 	CListboxItem UiDoListboxNextItem(void *pID, bool Selected = false);
-	static CListboxItem UiDoListboxNextRow();
+	CListboxItem UiDoListboxNextRow();
 	int UiDoListboxEnd(float *pScrollValue, bool *pItemActivated);
 	
 	//static void demolist_listdir_callback(const char *name, int is_dir, void *user);
diff --git a/src/game/client/components/menus_browser.cpp b/src/game/client/components/menus_browser.cpp
index 0048d3d0..08e5a3bc 100644
--- a/src/game/client/components/menus_browser.cpp
+++ b/src/game/client/components/menus_browser.cpp
@@ -130,11 +130,11 @@ void CMenus::RenderServerbrowserServerList(CUIRect View)
 		MsgBox.y += View.h/3;
 
 		if(m_ActivePage == PAGE_INTERNET && ServerBrowser()->IsRefreshingMasters())
-			UI()->DoLabel(&MsgBox, Localize("Refreshing master servers"), 16.0f, 0);
+			UI()->DoLabelScaled(&MsgBox, Localize("Refreshing master servers"), 16.0f, 0);
 		else if(!ServerBrowser()->NumServers())
-			UI()->DoLabel(&MsgBox, Localize("No servers found"), 16.0f, 0);
+			UI()->DoLabelScaled(&MsgBox, Localize("No servers found"), 16.0f, 0);
 		else if(ServerBrowser()->NumServers() && !NumServers)
-			UI()->DoLabel(&MsgBox, Localize("No servers match your filter criteria"), 16.0f, 0);
+			UI()->DoLabelScaled(&MsgBox, Localize("No servers match your filter criteria"), 16.0f, 0);
 	}
 
 	int Num = (int)(View.h/s_aCols[0].m_Rect.h) + 1;
@@ -323,7 +323,7 @@ void CMenus::RenderServerbrowserServerList(CUIRect View)
 			else if(Id == COL_MAP)
 			{
 				CTextCursor Cursor;
-				TextRender()->SetCursor(&Cursor, Button.x, Button.y, 12.0f, TEXTFLAG_RENDER|TEXTFLAG_STOP_AT_END);
+				TextRender()->SetCursor(&Cursor, Button.x, Button.y, 12.0f * UI()->Scale(), TEXTFLAG_RENDER|TEXTFLAG_STOP_AT_END);
 				Cursor.m_LineWidth = Button.w;
 				TextRender()->TextEx(&Cursor, pItem->m_aMap, -1);
 			}
@@ -332,25 +332,23 @@ void CMenus::RenderServerbrowserServerList(CUIRect View)
 				str_format(aTemp, sizeof(aTemp), "%i/%i", pItem->m_NumPlayers, pItem->m_MaxPlayers);
 				if(g_Config.m_BrFilterString[0] && (pItem->m_QuickSearchHit&IServerBrowser::QUICK_PLAYERNAME))
 					TextRender()->TextColor(0.4f,0.4f,1.0f,1);
-				UI()->DoLabel(&Button, aTemp, 12.0f, 1);
+				UI()->DoLabelScaled(&Button, aTemp, 12.0f, 1);
 				TextRender()->TextColor(1,1,1,1);
 			}
 			else if(Id == COL_PING)
 			{
 				str_format(aTemp, sizeof(aTemp), "%i", pItem->m_Latency);
-				UI()->DoLabel(&Button, aTemp, 12.0f, 1);
+				UI()->DoLabelScaled(&Button, aTemp, 12.0f, 1);
 			}
 			else if(Id == COL_VERSION)
 			{
 				const char *pVersion = pItem->m_aVersion;
-				if(str_comp(pVersion, "0.3 e2d7973c6647a13c") == 0) // TODO: remove me later on
-					pVersion = "0.3.0";
-				UI()->DoLabel(&Button, pVersion, 12.0f, 1);
+				UI()->DoLabelScaled(&Button, pVersion, 12.0f, 1);
 			}
 			else if(Id == COL_GAMETYPE)
 			{
 				CTextCursor Cursor;
-				TextRender()->SetCursor(&Cursor, Button.x, Button.y, 12.0f, TEXTFLAG_RENDER|TEXTFLAG_STOP_AT_END);
+				TextRender()->SetCursor(&Cursor, Button.x, Button.y, 12.0f*UI()->Scale(), TEXTFLAG_RENDER|TEXTFLAG_STOP_AT_END);
 				Cursor.m_LineWidth = Button.w;
 				TextRender()->TextEx(&Cursor, pItem->m_aGameType, -1);
 			}
@@ -376,7 +374,7 @@ void CMenus::RenderServerbrowserServerList(CUIRect View)
 	CUIRect QuickSearch, Button;
 	Status.VSplitLeft(260.0f, &QuickSearch, &Status);
 	const char *pLabel = Localize("Quick search:");
-	UI()->DoLabel(&QuickSearch, pLabel, 12.0f, -1);
+	UI()->DoLabelScaled(&QuickSearch, pLabel, 12.0f, -1);
 	float w = TextRender()->TextWidth(0, 12.0f, pLabel, -1);
 	QuickSearch.VSplitLeft(w, 0, &QuickSearch);
 	QuickSearch.VSplitLeft(5.0f, 0, &QuickSearch);
@@ -402,7 +400,7 @@ void CMenus::RenderServerbrowserServerList(CUIRect View)
 	else
 		str_format(aBuf, sizeof(aBuf), Localize("%d of %d servers, %d players"), ServerBrowser()->NumSortedServers(), ServerBrowser()->NumServers(), NumPlayers);
 	Status.VSplitRight(TextRender()->TextWidth(0, 14.0f, aBuf, -1), 0, &Status);
-	UI()->DoLabel(&Status, aBuf, 14.0f, -1);
+	UI()->DoLabelScaled(&Status, aBuf, 14.0f, -1);
 }
 
 void CMenus::RenderServerbrowserFilters(CUIRect View)
@@ -444,7 +442,7 @@ void CMenus::RenderServerbrowserFilters(CUIRect View)
 	View.HSplitTop(5.0f, 0, &View);
 
 	View.HSplitTop(19.0f, &Button, &View);
-	UI()->DoLabel(&Button, Localize("Game types:"), 12.0f, -1);
+	UI()->DoLabelScaled(&Button, Localize("Game types:"), 12.0f, -1);
 	Button.VSplitLeft(95.0f, 0, &Button);
 	View.HSplitTop(3.0f, 0, &View);
 	static float Offset = 0.0f;
@@ -456,7 +454,7 @@ void CMenus::RenderServerbrowserFilters(CUIRect View)
 		Button.VSplitRight(50.0f, &Button, &EditBox);
 		EditBox.VSplitRight(5.0f, &EditBox, 0);
 		
-		UI()->DoLabel(&Button, Localize("Maximum ping:"), 12.0f, -1);
+		UI()->DoLabelScaled(&Button, Localize("Maximum ping:"), 12.0f, -1);
 		
 		char aBuf[5];
 		str_format(aBuf, sizeof(aBuf), "%d", g_Config.m_BrFilterPing);
@@ -500,7 +498,7 @@ void CMenus::RenderServerbrowserServerDetail(CUIRect View)
 	RenderTools()->DrawUIRect(&ServerHeader, vec4(1,1,1,0.25f), CUI::CORNER_T, 4.0f);
 	RenderTools()->DrawUIRect(&ServerDetails, vec4(0,0,0,0.15f), CUI::CORNER_B, 4.0f);
 	ServerHeader.VSplitLeft(8.0f, 0x0, &ServerHeader);
-	UI()->DoLabel(&ServerHeader, Localize("Server details"), FontSize+2.0f, -1);
+	UI()->DoLabelScaled(&ServerHeader, Localize("Server details"), FontSize+2.0f, -1);
 
 	ServerDetails.VSplitLeft(5.0f, 0x0, &ServerDetails);
 
@@ -538,19 +536,19 @@ void CMenus::RenderServerbrowserServerDetail(CUIRect View)
 		for (unsigned int i = 0; i < sizeof(s_aLabels) / sizeof(s_aLabels[0]); i++)
 		{
 			LeftColumn.HSplitTop(15.0f, &Row, &LeftColumn);
-			UI()->DoLabel(&Row, s_aLabels[i], FontSize, -1);
+			UI()->DoLabelScaled(&Row, s_aLabels[i], FontSize, -1);
 		}
 
 		RightColumn.HSplitTop(15.0f, &Row, &RightColumn);
-		UI()->DoLabel(&Row, pSelectedServer->m_aVersion, FontSize, -1);
+		UI()->DoLabelScaled(&Row, pSelectedServer->m_aVersion, FontSize, -1);
 
 		RightColumn.HSplitTop(15.0f, &Row, &RightColumn);
-		UI()->DoLabel(&Row, pSelectedServer->m_aGameType, FontSize, -1);
+		UI()->DoLabelScaled(&Row, pSelectedServer->m_aGameType, FontSize, -1);
 
 		char aTemp[16];
 		str_format(aTemp, sizeof(aTemp), "%d", pSelectedServer->m_Latency);
 		RightColumn.HSplitTop(15.0f, &Row, &RightColumn);
-		UI()->DoLabel(&Row, aTemp, FontSize, -1);
+		UI()->DoLabelScaled(&Row, aTemp, FontSize, -1);
 
 	}
 
@@ -561,7 +559,7 @@ void CMenus::RenderServerbrowserServerDetail(CUIRect View)
 	RenderTools()->DrawUIRect(&ServerHeader, vec4(1,1,1,0.25f), CUI::CORNER_T, 4.0f);
 	RenderTools()->DrawUIRect(&ServerScoreBoard, vec4(0,0,0,0.15f), CUI::CORNER_B, 4.0f);
 	ServerHeader.VSplitLeft(8.0f, 0x0, &ServerHeader);
-	UI()->DoLabel(&ServerHeader, Localize("Scoreboard"), FontSize+2.0f, -1);
+	UI()->DoLabelScaled(&ServerHeader, Localize("Scoreboard"), FontSize+2.0f, -1);
 
 	ServerScoreBoard.VSplitLeft(5.0f, 0x0, &ServerScoreBoard);
 
@@ -576,7 +574,7 @@ void CMenus::RenderServerbrowserServerDetail(CUIRect View)
 			ServerScoreBoard.HSplitTop(16.0f, &Row, &ServerScoreBoard);
 
 			str_format(aTemp, sizeof(aTemp), "%d", pSelectedServer->m_aPlayers[i].m_Score);
-			UI()->DoLabel(&Row, aTemp, FontSize, -1);
+			UI()->DoLabelScaled(&Row, aTemp, FontSize, -1);
 
 			Row.VSplitLeft(25.0f, 0x0, &Row);
 
@@ -695,7 +693,7 @@ void CMenus::RenderServerbrowser(CUIRect MainView)
 			str_format(aBuf, sizeof(aBuf), Localize("Teeworlds %s is out! Download it at www.teeworlds.com!"), Client()->LatestVersion());
 		else
 			str_format(aBuf, sizeof(aBuf), Localize("Current version: %s"), GAME_VERSION);
-		UI()->DoLabel(&StatusToolBox, aBuf, 14.0f, -1);
+		UI()->DoLabelScaled(&StatusToolBox, aBuf, 14.0f, -1);
 	}
 
 	// do the button box
@@ -722,7 +720,7 @@ void CMenus::RenderServerbrowser(CUIRect MainView)
 		static float Offset = 0.0f;
 		DoEditBox(&g_Config.m_UiServerAddress, &Button, g_Config.m_UiServerAddress, sizeof(g_Config.m_UiServerAddress), 14.0f, &Offset);
 		ButtonBox.HSplitBottom(20.0f, &ButtonBox, &Button);
-		UI()->DoLabel(&Button, Localize("Host address"), 14.0f, -1);
+		UI()->DoLabelScaled(&Button, Localize("Host address"), 14.0f, -1);
 	}
 }
 
diff --git a/src/game/client/components/menus_demo.cpp b/src/game/client/components/menus_demo.cpp
index 7d7e2903..b56f4d7f 100644
--- a/src/game/client/components/menus_demo.cpp
+++ b/src/game/client/components/menus_demo.cpp
@@ -304,7 +304,7 @@ CMenus::CListboxItem CMenus::UiDoListboxNextRow()
 	if(gs_ListBoxItemIndex%gs_ListBoxItemsPerRow == 0)
 		gs_ListBoxView.HSplitTop(gs_ListBoxRowHeight /*-2.0f*/, &s_RowView, &gs_ListBoxView);
 
-	s_RowView.VSplitLeft(s_RowView.w/(gs_ListBoxItemsPerRow-gs_ListBoxItemIndex%gs_ListBoxItemsPerRow), &Item.m_Rect, &s_RowView);
+	s_RowView.VSplitLeft(s_RowView.w/(gs_ListBoxItemsPerRow-gs_ListBoxItemIndex%gs_ListBoxItemsPerRow)/(UI()->Scale()), &Item.m_Rect, &s_RowView);
 
 	Item.m_Visible = 1;
 	//item.rect = row;
diff --git a/src/game/client/components/menus_ingame.cpp b/src/game/client/components/menus_ingame.cpp
index a19961e7..ffb4bdfe 100644
--- a/src/game/client/components/menus_ingame.cpp
+++ b/src/game/client/components/menus_ingame.cpp
@@ -192,8 +192,8 @@ void CMenus::RenderServerInfo(CUIRect MainView)
 	MainView.Margin(10.0f, &View);
 	
 	// serverinfo
-	View.HSplitTop(View.h/2-5.0f, &ServerInfo, &Motd);
-	ServerInfo.VSplitLeft(View.w/2-5.0f, &ServerInfo, &GameInfo);
+	View.HSplitTop(View.h/2/UI()->Scale()-5.0f, &ServerInfo, &Motd);
+	ServerInfo.VSplitLeft(View.w/2/UI()->Scale()-5.0f, &ServerInfo, &GameInfo);
 	RenderTools()->DrawUIRect(&ServerInfo, vec4(1,1,1,0.25f), CUI::CORNER_ALL, 10.0f);
 	
 	ServerInfo.Margin(5.0f, &ServerInfo);
@@ -299,7 +299,7 @@ void CMenus::RenderServerControlServer(CUIRect MainView)
 		CListboxItem Item = UiDoListboxNextItem(pOption);
 		
 		if(Item.m_Visible)
-			UI()->DoLabel(&Item.m_Rect, FormatCommand(pOption->m_aCommand), 16.0f, -1);
+			UI()->DoLabelScaled(&Item.m_Rect, FormatCommand(pOption->m_aCommand), 16.0f, -1);
 	}
 	
 	m_CallvoteSelectedOption = UiDoListboxEnd(&s_ScrollValue, 0);
@@ -335,7 +335,7 @@ void CMenus::RenderServerControlKick(CUIRect MainView)
 			Item.m_Rect.HSplitTop(5.0f, 0, &Item.m_Rect); // some margin from the top
 			RenderTools()->RenderTee(CAnimState::GetIdle(), &Info, EMOTE_NORMAL, vec2(1,0), vec2(Item.m_Rect.x+Item.m_Rect.h/2, Item.m_Rect.y+Item.m_Rect.h/2));
 			Item.m_Rect.x +=Info.m_Size;
-			UI()->DoLabel(&Item.m_Rect, m_pClient->m_aClients[aPlayerIDs[i]].m_aName, 16.0f, -1);
+			UI()->DoLabelScaled(&Item.m_Rect, m_pClient->m_aClients[aPlayerIDs[i]].m_aName, 16.0f, -1);
 		}
 	}
 	
@@ -422,7 +422,7 @@ void CMenus::RenderServerControl(CUIRect MainView)
 			Bottom.VSplitRight(160.0f, &Bottom, &Reason);
 			Reason.HSplitTop(5.0f, 0, &Reason);
 			const char *pLabel = Localize("Reason:");
-			UI()->DoLabel(&Reason, pLabel, 14.0f, -1);
+			UI()->DoLabelScaled(&Reason, pLabel, 14.0f, -1);
 			float w = TextRender()->TextWidth(0, 14.0f, pLabel, -1);
 			Reason.VSplitLeft(w+10.0f, 0, &Reason);
 			static float s_Offset = 0.0f;
diff --git a/src/game/client/components/menus_settings.cpp b/src/game/client/components/menus_settings.cpp
index e2d2fd75..16cfa141 100644
--- a/src/game/client/components/menus_settings.cpp
+++ b/src/game/client/components/menus_settings.cpp
@@ -52,7 +52,7 @@ void CMenus::RenderSettingsPlayer(CUIRect MainView)
 	CUIRect Button;
 	CUIRect LeftView, RightView;
 
-	MainView.VSplitLeft(MainView.w/2, &LeftView, &RightView);
+	MainView.VSplitMid(&LeftView, &RightView);
     LeftView.HSplitTop(20.0f, &Button, &LeftView);
 
 	// render settings
@@ -133,16 +133,16 @@ void CMenus::RenderSettingsPlayer(CUIRect MainView)
                 OwnSkinInfo.m_Texture = pOwnSkin->m_ColorTexture;
             }
 
-            OwnSkinInfo.m_Size = UI()->Scale()*50.0f;
+            OwnSkinInfo.m_Size = 50.0f*UI()->Scale();
 
             LeftView.HSplitTop(20.0f, &Button, &LeftView);
             LeftView.HSplitTop(20.0f, &Button, &LeftView);
 
             str_format(aBuf, sizeof(aBuf), "%s:", Localize("Your skin"));
-            UI()->DoLabel(&Button, aBuf, 14.0, -1);
+            UI()->DoLabelScaled(&Button, aBuf, 14.0f, -1);
 
             CUIRect SkinRect;
-            LeftView.VSplitLeft(LeftView.w/1.2f, &SkinRect, 0);
+            LeftView.VSplitLeft(LeftView.w/1.2f/UI()->Scale(), &SkinRect, 0);
             SkinRect.HSplitTop(50.0f, &SkinRect, 0);
             RenderTools()->DrawUIRect(&SkinRect, vec4(1, 1, 1, 0.25f), CUI::CORNER_ALL, 10.0f);
 
@@ -156,7 +156,7 @@ void CMenus::RenderSettingsPlayer(CUIRect MainView)
 
             str_format(aBuf, sizeof(aBuf), "%s", g_Config.m_PlayerSkin);
 			CTextCursor Cursor;
-			TextRender()->SetCursor(&Cursor, Button.x, Button.y, 14.0f, TEXTFLAG_RENDER|TEXTFLAG_STOP_AT_END);
+			TextRender()->SetCursor(&Cursor, Button.x, Button.y, 14.0f*UI()->Scale(), TEXTFLAG_RENDER|TEXTFLAG_STOP_AT_END);
 			Cursor.m_LineWidth = SkinRect.w-(Button.x-SkinRect.x)-5.0f;
 			TextRender()->TextEx(&Cursor, aBuf, -1);
         }
@@ -191,7 +191,7 @@ void CMenus::RenderSettingsPlayer(CUIRect MainView)
 				CUIRect Text;
 				RightView.HSplitTop(20.0f, &Text, &RightView);
 				Text.VSplitLeft(15.0f, 0, &Text);
-				UI()->DoLabel(&Text, paParts[i], 14.0f, -1);
+				UI()->DoLabelScaled(&Text, paParts[i], 14.0f, -1);
 
 				int PrevColor = *paColors[i];
 				int Color = 0;
@@ -208,7 +208,7 @@ void CMenus::RenderSettingsPlayer(CUIRect MainView)
 					k = DoScrollbarH(&s_aColorSlider[i][s], &Button, k);
 					Color <<= 8;
 					Color += clamp((int)(k*255), 0, 255);
-					UI()->DoLabel(&Text, paLabels[s], 15.0f, -1);
+					UI()->DoLabelScaled(&Text, paLabels[s], 15.0f, -1);
 
 				}
 
@@ -348,7 +348,7 @@ void CMenus::UiDoGetButtons(int Start, int Stop, CUIRect View)
 		char aBuf[64];
 		str_format(aBuf, sizeof(aBuf), "%s:", (const char *)Key.m_Name);
 
-		UI()->DoLabel(&Label, aBuf, 14.0f, -1);
+		UI()->DoLabelScaled(&Label, aBuf, 14.0f, -1);
 		int OldId = Key.m_KeyId;
 		int NewId = DoKeyReader((void *)&gs_aKeys[i].m_Name, &Button, OldId);
 		if(NewId != OldId)
@@ -364,6 +364,9 @@ void CMenus::UiDoGetButtons(int Start, int Stop, CUIRect View)
 
 void CMenus::RenderSettingsControls(CUIRect MainView)
 {
+	float oldScale = UI()->Scale();
+	UI()->SetScale(1.0);
+
 	// this is kinda slow, but whatever
 	for(int i = 0; i < g_KeyCount; i++)
 		gs_aKeys[i].m_KeyId = 0;
@@ -391,7 +394,7 @@ void CMenus::RenderSettingsControls(CUIRect MainView)
 		RenderTools()->DrawUIRect(&MovementSettings, vec4(1,1,1,0.25f), CUI::CORNER_ALL, 10.0f);
 		MovementSettings.Margin(10.0f, &MovementSettings);
 
-		TextRender()->Text(0, MovementSettings.x, MovementSettings.y, 14, Localize("Movement"), -1);
+		TextRender()->Text(0, MovementSettings.x, MovementSettings.y, 14.0f*UI()->Scale(), Localize("Movement"), -1);
 
 		MovementSettings.HSplitTop(14.0f+5.0f+10.0f, 0, &MovementSettings);
 
@@ -399,7 +402,7 @@ void CMenus::RenderSettingsControls(CUIRect MainView)
 			CUIRect Button, Label;
 			MovementSettings.HSplitTop(20.0f, &Button, &MovementSettings);
 			Button.VSplitLeft(130.0f, &Label, &Button);
-			UI()->DoLabel(&Label, Localize("Mouse sens."), 14.0f, -1);
+			UI()->DoLabel(&Label, Localize("Mouse sens."), 14.0f*UI()->Scale(), -1);
 			Button.HMargin(2.0f, &Button);
 			g_Config.m_InpMousesens = (int)(DoScrollbarH(&g_Config.m_InpMousesens, &Button, (g_Config.m_InpMousesens-5)/500.0f)*500.0f)+5;
 			//*key.key = ui_do_key_reader(key.key, &Button, *key.key);
@@ -416,7 +419,7 @@ void CMenus::RenderSettingsControls(CUIRect MainView)
 		RenderTools()->DrawUIRect(&WeaponSettings, vec4(1,1,1,0.25f), CUI::CORNER_ALL, 10.0f);
 		WeaponSettings.Margin(10.0f, &WeaponSettings);
 
-		TextRender()->Text(0, WeaponSettings.x, WeaponSettings.y, 14, Localize("Weapon"), -1);
+		TextRender()->Text(0, WeaponSettings.x, WeaponSettings.y, 14.0f*UI()->Scale(), Localize("Weapon"), -1);
 
 		WeaponSettings.HSplitTop(14.0f+5.0f+10.0f, 0, &WeaponSettings);
 		UiDoGetButtons(5, 12, WeaponSettings);
@@ -429,7 +432,7 @@ void CMenus::RenderSettingsControls(CUIRect MainView)
 		RenderTools()->DrawUIRect(&VotingSettings, vec4(1,1,1,0.25f), CUI::CORNER_ALL, 10.0f);
 		VotingSettings.Margin(10.0f, &VotingSettings);
 
-		TextRender()->Text(0, VotingSettings.x, VotingSettings.y, 14, Localize("Voting"), -1);
+		TextRender()->Text(0, VotingSettings.x, VotingSettings.y, 14.0f*UI()->Scale(), Localize("Voting"), -1);
 
 		VotingSettings.HSplitTop(14.0f+5.0f+10.0f, 0, &VotingSettings);
 		UiDoGetButtons(12, 14, VotingSettings);
@@ -442,7 +445,7 @@ void CMenus::RenderSettingsControls(CUIRect MainView)
 		RenderTools()->DrawUIRect(&ChatSettings, vec4(1,1,1,0.25f), CUI::CORNER_ALL, 10.0f);
 		ChatSettings.Margin(10.0f, &ChatSettings);
 
-		TextRender()->Text(0, ChatSettings.x, ChatSettings.y, 14, Localize("Chat"), -1);
+		TextRender()->Text(0, ChatSettings.x, ChatSettings.y, 14.0f*UI()->Scale(), Localize("Chat"), -1);
 
 		ChatSettings.HSplitTop(14.0f+5.0f+10.0f, 0, &ChatSettings);
 		UiDoGetButtons(14, 17, ChatSettings);
@@ -451,11 +454,11 @@ void CMenus::RenderSettingsControls(CUIRect MainView)
 	// misc settings
 	{
 		MiscSettings.HSplitTop(10.0f, 0, &MiscSettings);
-		MiscSettings.HSplitTop(MainView.h/2-5.0f-45.0f, &MiscSettings, &ResetButton);
+		MiscSettings.HSplitTop(MainView.h/2-5.0f/(UI()->Scale())-45.0f, &MiscSettings, &ResetButton);
 		RenderTools()->DrawUIRect(&MiscSettings, vec4(1,1,1,0.25f), CUI::CORNER_ALL, 10.0f);
 		MiscSettings.Margin(10.0f, &MiscSettings);
 
-		TextRender()->Text(0, MiscSettings.x, MiscSettings.y, 14, Localize("Miscellaneous"), -1);
+		TextRender()->Text(0, MiscSettings.x, MiscSettings.y, 14.0f*UI()->Scale(), Localize("Miscellaneous"), -1);
 
 		MiscSettings.HSplitTop(14.0f+5.0f+10.0f, 0, &MiscSettings);
 		UiDoGetButtons(17, 21, MiscSettings);
@@ -466,6 +469,8 @@ void CMenus::RenderSettingsControls(CUIRect MainView)
 	static int s_DefaultButton = 0;
 	if(DoButton_Menu((void*)&s_DefaultButton, Localize("Reset to defaults"), 0, &ResetButton))
 		m_pClient->m_pBinds->SetDefaults();
+
+	UI()->SetScale(oldScale);
 }
 
 void CMenus::RenderSettingsGraphics(CUIRect MainView)
@@ -517,7 +522,7 @@ void CMenus::RenderSettingsGraphics(CUIRect MainView)
 		if(Item.m_Visible)
 		{
 			str_format(aBuf, sizeof(aBuf), "  %dx%d %d bit", s_aModes[i].m_Width, s_aModes[i].m_Height, Depth);
-			UI()->DoLabel(&Item.m_Rect, aBuf, 16.0f, -1);
+			UI()->DoLabelScaled(&Item.m_Rect, aBuf, 16.0f, -1);
 		}
 	}
 
@@ -594,7 +599,7 @@ void CMenus::RenderSettingsGraphics(CUIRect MainView)
 	MainView.HSplitTop(20.0f, 0, &MainView);
 	MainView.HSplitTop(20.0f, &Text, &MainView);
 	//text.VSplitLeft(15.0f, 0, &text);
-	UI()->DoLabel(&Text, Localize("UI Color"), 14.0f, -1);
+	UI()->DoLabelScaled(&Text, Localize("UI Color"), 14.0f, -1);
 
 	const char *paLabels[] = {
 		Localize("Hue"),
@@ -614,7 +619,7 @@ void CMenus::RenderSettingsGraphics(CUIRect MainView)
 		float k = (*pColorSlider[s]) / 255.0f;
 		k = DoScrollbarH(pColorSlider[s], &Button, k);
 		*pColorSlider[s] = (int)(k*255.0f);
-		UI()->DoLabel(&Text, paLabels[s], 15.0f, -1);
+		UI()->DoLabelScaled(&Text, paLabels[s], 15.0f, -1);
 	}
 }
 
@@ -644,7 +649,7 @@ void CMenus::RenderSettingsSound(CUIRect MainView)
 		char aBuf[64];
 		str_format(aBuf, sizeof(aBuf), "%d", g_Config.m_SndRate);
 		MainView.HSplitTop(20.0f, &Button, &MainView);
-		UI()->DoLabel(&Button, Localize("Sample rate"), 14.0f, -1);
+		UI()->DoLabelScaled(&Button, Localize("Sample rate"), 14.0f, -1);
 		Button.VSplitLeft(110.0f, 0, &Button);
 		Button.VSplitLeft(180.0f, &Button, 0);
 		static float Offset = 0.0f;
@@ -663,7 +668,7 @@ void CMenus::RenderSettingsSound(CUIRect MainView)
 		MainView.HSplitTop(20.0f, &Button, &MainView);
 		Button.VSplitLeft(110.0f, &Label, &Button);
 		Button.HMargin(2.0f, &Button);
-		UI()->DoLabel(&Label, Localize("Sound volume"), 14.0f, -1);
+		UI()->DoLabelScaled(&Label, Localize("Sound volume"), 14.0f, -1);
 		g_Config.m_SndVolume = (int)(DoScrollbarH(&g_Config.m_SndVolume, &Button, g_Config.m_SndVolume/100.0f)*100.0f);
 		MainView.HSplitTop(20.0f, 0, &MainView);
 	}
@@ -748,7 +753,7 @@ void CMenus::RenderLanguageSelection(CUIRect MainView)
 		CListboxItem Item = UiDoListboxNextItem(&r.front());
 
 		if(Item.m_Visible)
-			UI()->DoLabel(&Item.m_Rect, r.front().m_Name, 16.0f, -1);
+			UI()->DoLabelScaled(&Item.m_Rect, r.front().m_Name, 16.0f, -1);
 	}
 
 	s_SelectedLanguage = UiDoListboxEnd(&s_ScrollValue, 0);
@@ -787,7 +792,7 @@ void CMenus::RenderSettingsGeneral(CUIRect MainView)
 			str_format(aBuf, sizeof(aBuf), "%s: %i", Localize("Max demos"), g_Config.m_ClAutoDemoMax);
 		else
 			str_format(aBuf, sizeof(aBuf), "%s: %s", Localize("Max demos"), Localize("no limit"));
-		UI()->DoLabel(&Label, aBuf, 13.0f, -1);
+		UI()->DoLabelScaled(&Label, aBuf, 13.0f, -1);
 		g_Config.m_ClAutoDemoMax = static_cast<int>(DoScrollbarH(&g_Config.m_ClAutoDemoMax, &Button, g_Config.m_ClAutoDemoMax/1000.0f)*1000.0f+0.1f);
 
 		Right.HSplitTop(10.0f, 0, &Right);
@@ -798,7 +803,7 @@ void CMenus::RenderSettingsGeneral(CUIRect MainView)
 			str_format(aBuf, sizeof(aBuf), "%s: %i", Localize("Max Screenshots"), g_Config.m_ClAutoScreenshotMax);
 		else
 			str_format(aBuf, sizeof(aBuf), "%s: %s", Localize("Max Screenshots"), Localize("no limit"));
-		UI()->DoLabel(&Label, aBuf, 13.0f, -1);
+		UI()->DoLabelScaled(&Label, aBuf, 13.0f, -1);
 		g_Config.m_ClAutoScreenshotMax = static_cast<int>(DoScrollbarH(&g_Config.m_ClAutoScreenshotMax, &Button, g_Config.m_ClAutoScreenshotMax/1000.0f)*1000.0f+0.1f);
 	}
 
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
diff --git a/src/game/client/ui.h b/src/game/client/ui.h
index 477799f7..9ff85dd5 100644
--- a/src/game/client/ui.h
+++ b/src/game/client/ui.h
@@ -6,7 +6,7 @@
 class CUIRect
 {
 	// TODO: Refactor: Redo UI scaling
-	float Scale() const { return 1.0f; }
+	float Scale() const;
 public:
     float x, y, w, h;
 	
@@ -85,12 +85,13 @@ public:
 	
 	// TODO: Refactor: Redo UI scaling
 	void SetScale(float s);
-	float Scale() const { return 1.0f; }
+	float Scale();
 
 	int DoButtonLogic(const void *pID, const char *pText /* TODO: Refactor: Remove */, int Checked, const CUIRect *pRect);
 	
 	// TODO: Refactor: Remove this?
 	void DoLabel(const CUIRect *pRect, const char *pText, float Size, int Align, int MaxWidth = -1);
+	void DoLabelScaled(const CUIRect *pRect, const char *pText, float Size, int Align, int MaxWidth = -1);
 };
 
 
diff --git a/src/game/variables.h b/src/game/variables.h
index 2fc04d9d..1a5575d5 100644
--- a/src/game/variables.h
+++ b/src/game/variables.h
@@ -42,7 +42,7 @@ MACRO_CONFIG_STR(PlayerSkin, player_skin, 24, "default", CFGFLAG_CLIENT|CFGFLAG_
 MACRO_CONFIG_INT(UiPage, ui_page, 5, 0, 9, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Interface page")
 MACRO_CONFIG_INT(UiToolboxPage, ui_toolbox_page, 0, 0, 1, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Toolbox page")
 MACRO_CONFIG_STR(UiServerAddress, ui_server_address, 25, "localhost:8303", CFGFLAG_CLIENT|CFGFLAG_SAVE, "Interface server address")
-MACRO_CONFIG_INT(UiScale, ui_scale, 100, 1, 100000, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Interface scale")
+MACRO_CONFIG_INT(UiScale, ui_scale, 100, 50, 150, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Interface scale")
 
 MACRO_CONFIG_INT(UiColorHue, ui_color_hue, 160, 0, 255, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Interface color hue")
 MACRO_CONFIG_INT(UiColorSat, ui_color_sat, 70, 0, 255, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Interface color saturation")