add ui fixes to work with new text renderer

This commit is contained in:
Jupeyy 2018-03-13 21:59:07 +01:00
parent 0930a3b7de
commit c1a962b870
7 changed files with 206 additions and 192 deletions

View file

@ -202,9 +202,20 @@ int CMenus::DoButton_CheckBox_Common(const void *pID, const char *pText, const c
c.Margin(2.0f, &c);
RenderTools()->DrawUIRect(&c, vec4(1,1,1,0.25f)*ButtonColorMul(pID), CUI::CORNER_ALL, 3.0f);
c.y += 2;
UI()->DoLabel(&c, pBoxText, pRect->h*ms_FontmodHeight*0.6f, 0);
UI()->DoLabel(&t, pText, pRect->h*ms_FontmodHeight*0.8f, -1);
TextRender()->SetRenderFlags(ETextRenderFlags::TEXT_RENDER_FLAG_ONLY_ADVANCE_WIDTH | ETextRenderFlags::TEXT_RENDER_FLAG_NO_X_BEARING | ETextRenderFlags::TEXT_RENDER_FLAG_NO_Y_BEARING);
bool CheckAble = *pBoxText == 'X';
if(CheckAble)
{
TextRender()->SetCurFont(TextRender()->GetFont(TEXT_FONT_ICON_FONT));
UI()->DoLabel(&c, "\xEE\x97\x8D", c.h, 0);
TextRender()->SetCurFont(NULL);
}
else
UI()->DoLabel(&c, pBoxText, c.h*ms_FontmodHeight, 0);
TextRender()->SetRenderFlags(0);
UI()->DoLabel(&t, pText, c.h*ms_FontmodHeight, -1);
return UI()->DoButtonLogic(pID, pText, 0, pRect);
}
@ -764,25 +775,32 @@ int CMenus::RenderMenubar(CUIRect r)
box.VSplitRight(30.0f, &box, 0);
*/
Box.VSplitRight(30.0f, &Box, &Button);
TextRender()->SetCurFont(TextRender()->GetFont(TEXT_FONT_ICON_FONT));
TextRender()->SetRenderFlags(ETextRenderFlags::TEXT_RENDER_FLAG_ONLY_ADVANCE_WIDTH | ETextRenderFlags::TEXT_RENDER_FLAG_NO_X_BEARING | ETextRenderFlags::TEXT_RENDER_FLAG_NO_Y_BEARING);
Box.VSplitRight(33.0f, &Box, &Button);
static int s_QuitButton=0;
if(DoButton_MenuTab(&s_QuitButton, "×", 0, &Button, CUI::CORNER_T))
if(DoButton_MenuTab(&s_QuitButton, "\xEE\x97\x8D", 0, &Button, CUI::CORNER_T))
m_Popup = POPUP_QUIT;
Box.VSplitRight(10.0f, &Box, &Button);
Box.VSplitRight(30.0f, &Box, &Button);
Box.VSplitRight(33.0f, &Box, &Button);
static int s_SettingsButton=0;
if(DoButton_MenuTab(&s_SettingsButton, "", m_ActivePage==PAGE_SETTINGS, &Button, CUI::CORNER_T))
if(DoButton_MenuTab(&s_SettingsButton, "\xEE\xA2\xB8", m_ActivePage==PAGE_SETTINGS, &Button, CUI::CORNER_T))
NewPage = PAGE_SETTINGS;
Box.VSplitRight(10.0f, &Box, &Button);
Box.VSplitRight(30.0f, &Box, &Button);
Box.VSplitRight(33.0f, &Box, &Button);
static int s_EditorButton=0;
if(DoButton_MenuTab(&s_EditorButton, "", 0, &Button, CUI::CORNER_T))
if(DoButton_MenuTab(&s_EditorButton, "\xEE\x8F\x89", 0, &Button, CUI::CORNER_T))
{
g_Config.m_ClEditor = 1;
}
TextRender()->SetRenderFlags(0);
TextRender()->SetCurFont(NULL);
if(NewPage != -1)
{
if(Client()->State() == IClient::STATE_OFFLINE)
@ -837,7 +855,7 @@ void CMenus::RenderLoading()
r.x = x;
r.y = y+20;
r.w = w;
r.h = h;
r.h = h - 130;
UI()->DoLabel(&r, pCaption, 48.0f, 0, -1);
Graphics()->TextureSet(-1);
@ -2011,6 +2029,7 @@ void CMenus::RenderUpdating(const char *pCaption, int current, int total)
CUIRect Screen = *UI()->Screen();
Graphics()->MapScreen(Screen.x, Screen.y, Screen.w, Screen.h);
Graphics()->BlendNormal();
RenderBackground();
float w = 700;
@ -2018,8 +2037,6 @@ void CMenus::RenderUpdating(const char *pCaption, int current, int total)
float x = Screen.w/2-w/2;
float y = Screen.h/2-h/2;
Graphics()->BlendNormal();
Graphics()->TextureSet(-1);
Graphics()->QuadsBegin();
Graphics()->SetColor(0,0,0,0.50f);

View file

@ -141,7 +141,6 @@ void CMenus::RenderServerbrowserServerList(CUIRect View)
// users misses it
{
CUIRect MsgBox = View;
MsgBox.y += View.h/3;
if(m_ActivePage == PAGE_INTERNET && ServerBrowser()->IsRefreshingMasters())
UI()->DoLabelScaled(&MsgBox, Localize("Refreshing master servers"), 16.0f, 0);
@ -285,7 +284,7 @@ void CMenus::RenderServerbrowserServerList(CUIRect View)
if(Selected)
{
CUIRect r = Row;
r.Margin(1.5f, &r);
r.Margin(0.5f, &r);
RenderTools()->DrawUIRect(&r, vec4(1,1,1,0.5f), CUI::CORNER_ALL, 4.0f);
}
@ -340,7 +339,8 @@ void CMenus::RenderServerbrowserServerList(CUIRect View)
else if(ID == COL_NAME)
{
CTextCursor Cursor;
TextRender()->SetCursor(&Cursor, Button.x, Button.y, 12.0f * UI()->Scale(), TEXTFLAG_RENDER|TEXTFLAG_STOP_AT_END);
float FontSize = 12.0f * UI()->Scale();
TextRender()->SetCursor(&Cursor, Button.x, Button.y + (Button.h - FontSize) / 2.f, FontSize, TEXTFLAG_RENDER|TEXTFLAG_STOP_AT_END);
Cursor.m_LineWidth = Button.w;
if(g_Config.m_BrFilterString[0] && (pItem->m_QuickSearchHit&IServerBrowser::QUICK_SERVERNAME))
@ -374,7 +374,8 @@ void CMenus::RenderServerbrowserServerList(CUIRect View)
}
CTextCursor Cursor;
TextRender()->SetCursor(&Cursor, Button.x, Button.y, 12.0f * UI()->Scale(), TEXTFLAG_RENDER|TEXTFLAG_STOP_AT_END);
float FontSize = 12.0f * UI()->Scale();
TextRender()->SetCursor(&Cursor, Button.x, Button.y + (Button.h - FontSize) / 2.f, 12.0f * UI()->Scale(), TEXTFLAG_RENDER|TEXTFLAG_STOP_AT_END);
Cursor.m_LineWidth = Button.w;
if(g_Config.m_BrFilterString[0] && (pItem->m_QuickSearchHit&IServerBrowser::QUICK_MAPNAME))
@ -435,7 +436,8 @@ void CMenus::RenderServerbrowserServerList(CUIRect View)
else if(ID == COL_GAMETYPE)
{
CTextCursor Cursor;
TextRender()->SetCursor(&Cursor, Button.x, Button.y, 12.0f*UI()->Scale(), TEXTFLAG_RENDER|TEXTFLAG_STOP_AT_END);
float FontSize = 12.0f * UI()->Scale();
TextRender()->SetCursor(&Cursor, Button.x, Button.y + (Button.h - FontSize) / 2.f, 12.0f*UI()->Scale(), TEXTFLAG_RENDER|TEXTFLAG_STOP_AT_END);
Cursor.m_LineWidth = Button.w;
if(g_Config.m_UiColorizeGametype)
@ -493,9 +495,13 @@ void CMenus::RenderServerbrowserServerList(CUIRect View)
QuickExclude.VSplitLeft(5.0f, 0, &QuickExclude);
// render quick search
{
const char *pLabel = "";
UI()->DoLabelScaled(&QuickSearch, pLabel, 12.0f, -1);
float w = TextRender()->TextWidth(0, 12.0f, pLabel, -1);
const char *pLabel = "\xEE\xA2\xB6";
TextRender()->SetCurFont(TextRender()->GetFont(TEXT_FONT_ICON_FONT));
TextRender()->SetRenderFlags(ETextRenderFlags::TEXT_RENDER_FLAG_ONLY_ADVANCE_WIDTH | ETextRenderFlags::TEXT_RENDER_FLAG_NO_X_BEARING | ETextRenderFlags::TEXT_RENDER_FLAG_NO_Y_BEARING);
UI()->DoLabelScaled(&QuickSearch, pLabel, 16.0f, -1);
float w = TextRender()->TextWidth(0, 16.0f, pLabel, -1);
TextRender()->SetRenderFlags(0);
TextRender()->SetCurFont(NULL);
QuickSearch.VSplitLeft(w, 0, &QuickSearch);
QuickSearch.VSplitLeft(5.0f, 0, &QuickSearch);
QuickSearch.VSplitLeft(QuickSearch.w-15.0f, &QuickSearch, &Button);
@ -521,9 +527,13 @@ void CMenus::RenderServerbrowserServerList(CUIRect View)
// render quick exclude
{
const char *pLabel = Localize("");
UI()->DoLabelScaled(&QuickExclude, pLabel, 12.0f, -1);
float w = TextRender()->TextWidth(0, 12.0f, pLabel, -1);
const char *pLabel = Localize("\xEE\x85\x8B");
TextRender()->SetCurFont(TextRender()->GetFont(TEXT_FONT_ICON_FONT));
TextRender()->SetRenderFlags(ETextRenderFlags::TEXT_RENDER_FLAG_ONLY_ADVANCE_WIDTH | ETextRenderFlags::TEXT_RENDER_FLAG_NO_X_BEARING | ETextRenderFlags::TEXT_RENDER_FLAG_NO_Y_BEARING);
UI()->DoLabelScaled(&QuickExclude, pLabel, 16.0f, -1);
float w = TextRender()->TextWidth(0, 16.0f, pLabel, -1);
TextRender()->SetRenderFlags(0);
TextRender()->SetCurFont(NULL);
QuickExclude.VSplitLeft(w, 0, &QuickExclude);
QuickExclude.VSplitLeft(5.0f, 0, &QuickExclude);
QuickExclude.VSplitLeft(QuickExclude.w-15.0f, &QuickExclude, &Button);
@ -1004,7 +1014,7 @@ void CMenus::RenderServerbrowserServerDetail(CUIRect View)
Name.VSplitLeft(34.0f, &Score, &Name);
Name.VSplitRight(34.0f, &Name, &Flag);
Flag.HMargin(4.0f, &Flag);
Name.HSplitTop(11.0f, &Name, &Clan);
Name.HSplitTop(12.0f, &Name, &Clan);
// score
char aTemp[16];
@ -1024,12 +1034,12 @@ void CMenus::RenderServerbrowserServerDetail(CUIRect View)
else
str_format(aTemp, sizeof(aTemp), "%d", pSelectedServer->m_aClients[i].m_Score);
TextRender()->SetCursor(&Cursor, Score.x, Score.y+(Score.h-FontSize)/4.0f, FontSize, TEXTFLAG_RENDER|TEXTFLAG_STOP_AT_END);
TextRender()->SetCursor(&Cursor, Score.x, Score.y+(Score.h-FontSize)/2.0f, FontSize, TEXTFLAG_RENDER|TEXTFLAG_STOP_AT_END);
Cursor.m_LineWidth = Score.w;
TextRender()->TextEx(&Cursor, aTemp, -1);
// name
TextRender()->SetCursor(&Cursor, Name.x, Name.y, FontSize-2, TEXTFLAG_RENDER|TEXTFLAG_STOP_AT_END);
TextRender()->SetCursor(&Cursor, Name.x, Name.y + (Name.h - (FontSize - 2)) / 2.f, FontSize - 2, TEXTFLAG_RENDER | TEXTFLAG_STOP_AT_END);
Cursor.m_LineWidth = Name.w;
const char *pName = pSelectedServer->m_aClients[i].m_aName;
if(g_Config.m_BrFilterString[0])
@ -1051,7 +1061,7 @@ void CMenus::RenderServerbrowserServerDetail(CUIRect View)
TextRender()->TextEx(&Cursor, pName, -1);
// clan
TextRender()->SetCursor(&Cursor, Clan.x, Clan.y, FontSize-2, TEXTFLAG_RENDER|TEXTFLAG_STOP_AT_END);
TextRender()->SetCursor(&Cursor, Clan.x, Clan.y + (Clan.h - (FontSize - 2)) / 2.f, FontSize - 2, TEXTFLAG_RENDER | TEXTFLAG_STOP_AT_END);
Cursor.m_LineWidth = Clan.w;
const char *pClan = pSelectedServer->m_aClients[i].m_aClan;
if(g_Config.m_BrFilterString[0])

View file

@ -1109,7 +1109,7 @@ void CMenus::RenderDemoList(CUIRect MainView)
else if(ID == COL_DEMONAME)
{
CTextCursor Cursor;
TextRender()->SetCursor(&Cursor, Button.x, Button.y, 12.0f * UI()->Scale(), TEXTFLAG_RENDER|TEXTFLAG_STOP_AT_END);
TextRender()->SetCursor(&Cursor, Button.x, Button.y + (Button.h - 12.0f * UI()->Scale()) / 2.f, 12.0f * UI()->Scale(), TEXTFLAG_RENDER|TEXTFLAG_STOP_AT_END);
Cursor.m_LineWidth = Button.w;
TextRender()->TextEx(&Cursor, r.front().m_aName, -1);
@ -1118,7 +1118,7 @@ void CMenus::RenderDemoList(CUIRect MainView)
else if(ID == COL_DATE && !r.front().m_IsDir)
{
CTextCursor Cursor;
TextRender()->SetCursor(&Cursor, Button.x, Button.y, 12.0f * UI()->Scale(), TEXTFLAG_RENDER|TEXTFLAG_STOP_AT_END);
TextRender()->SetCursor(&Cursor, Button.x, Button.y + (Button.h - 12.0f * UI()->Scale()) / 2.f, 12.0f * UI()->Scale(), TEXTFLAG_RENDER|TEXTFLAG_STOP_AT_END);
Cursor.m_LineWidth = Button.w;
char aBuf[256];

View file

@ -615,9 +615,13 @@ void CMenus::RenderServerControl(CUIRect MainView)
{
Bottom.VSplitLeft(240.0f, &QuickSearch, &Bottom);
QuickSearch.HSplitTop(5.0f, 0, &QuickSearch);
const char *pSearchLabel = "";
const char *pSearchLabel = "\xEE\xA2\xB6";
TextRender()->SetCurFont(TextRender()->GetFont(TEXT_FONT_ICON_FONT));
TextRender()->SetRenderFlags(ETextRenderFlags::TEXT_RENDER_FLAG_ONLY_ADVANCE_WIDTH | ETextRenderFlags::TEXT_RENDER_FLAG_NO_X_BEARING | ETextRenderFlags::TEXT_RENDER_FLAG_NO_Y_BEARING);
UI()->DoLabelScaled(&QuickSearch, pSearchLabel, 14.0f, -1);
float wSearch = TextRender()->TextWidth(0, 14.0f, pSearchLabel, -1);
TextRender()->SetRenderFlags(0);
TextRender()->SetCurFont(NULL);
QuickSearch.VSplitLeft(wSearch, 0, &QuickSearch);
QuickSearch.VSplitLeft(5.0f, 0, &QuickSearch);
QuickSearch.VSplitLeft(QuickSearch.w-15.0f, &QuickSearch, &Button2);
@ -1101,7 +1105,7 @@ void CMenus::RenderGhost(CUIRect MainView)
else if(Id == COL_NAME)
{
CTextCursor Cursor;
TextRender()->SetCursor(&Cursor, Button.x, Button.y, 12.0f * UI()->Scale(), TEXTFLAG_RENDER|TEXTFLAG_STOP_AT_END);
TextRender()->SetCursor(&Cursor, Button.x, Button.y + (Button.h - 12.0f * UI()->Scale()) / 2.f, 12.0f * UI()->Scale(), TEXTFLAG_RENDER|TEXTFLAG_STOP_AT_END);
Cursor.m_LineWidth = Button.w;
TextRender()->TextEx(&Cursor, pItem->m_aPlayer, -1);
@ -1109,7 +1113,7 @@ void CMenus::RenderGhost(CUIRect MainView)
else if(Id == COL_TIME)
{
CTextCursor Cursor;
TextRender()->SetCursor(&Cursor, Button.x, Button.y, 12.0f * UI()->Scale(), TEXTFLAG_RENDER|TEXTFLAG_STOP_AT_END);
TextRender()->SetCursor(&Cursor, Button.x, Button.y + (Button.h - 12.0f * UI()->Scale()) / 2.f, 12.0f * UI()->Scale(), TEXTFLAG_RENDER|TEXTFLAG_STOP_AT_END);
Cursor.m_LineWidth = Button.w;
char aBuf[64];

View file

@ -453,7 +453,6 @@ void CMenus::RenderSettingsTee(CUIRect MainView)
Label.VSplitLeft(230.0f, &Label, 0);
RenderTools()->DrawUIRect(&Label, vec4(1.0f, 1.0f, 1.0f, 0.25f), CUI::CORNER_ALL, 10.0f);
RenderTools()->RenderTee(CAnimState::GetIdle(), &OwnSkinInfo, 0, vec2(1, 0), vec2(Label.x+30.0f, Label.y+28.0f));
Label.HSplitTop(15.0f, 0, &Label);
Label.VSplitLeft(70.0f, 0, &Label);
UI()->DoLabelScaled(&Label, Skin, 14.0f, -1, 150.0f);
@ -586,7 +585,6 @@ void CMenus::RenderSettingsTee(CUIRect MainView)
Item.m_Rect.VSplitLeft(60.0f, 0, &Item.m_Rect);
Item.m_Rect.HSplitTop(10.0f, 0, &Item.m_Rect);
str_format(aBuf, sizeof(aBuf), "%s", s->m_aName);
RenderTools()->UI()->DoLabelScaled(&Item.m_Rect, aBuf, 12.0f, -1,Item.m_Rect.w);
if(g_Config.m_Debug)
@ -617,9 +615,13 @@ void CMenus::RenderSettingsTee(CUIRect MainView)
MainView.HSplitBottom(ms_ButtonHeight, &MainView, &QuickSearch);
QuickSearch.VSplitLeft(240.0f, &QuickSearch, 0);
QuickSearch.HSplitTop(5.0f, 0, &QuickSearch);
const char *pSearchLabel = "";
const char *pSearchLabel = "\xEE\xA2\xB6";
TextRender()->SetCurFont(TextRender()->GetFont(TEXT_FONT_ICON_FONT));
TextRender()->SetRenderFlags(ETextRenderFlags::TEXT_RENDER_FLAG_ONLY_ADVANCE_WIDTH | ETextRenderFlags::TEXT_RENDER_FLAG_NO_X_BEARING | ETextRenderFlags::TEXT_RENDER_FLAG_NO_Y_BEARING);
UI()->DoLabelScaled(&QuickSearch, pSearchLabel, 14.0f, -1);
float wSearch = TextRender()->TextWidth(0, 14.0f, pSearchLabel, -1);
TextRender()->SetRenderFlags(0);
TextRender()->SetCurFont(NULL);
QuickSearch.VSplitLeft(wSearch, 0, &QuickSearch);
QuickSearch.VSplitLeft(5.0f, 0, &QuickSearch);
QuickSearch.VSplitLeft(QuickSearch.w-15.0f, &QuickSearch, &QuickSearchClearButton);
@ -1353,6 +1355,7 @@ void CMenus::RenderLanguageSelection(CUIRect MainView)
if(File)
{
io_close(File);
if((pDefaultFont = TextRender()->GetFont(aFilename)) == NULL)
pDefaultFont = TextRender()->LoadFont(aFilename);
TextRender()->SetDefaultFont(pDefaultFont);
}

View file

@ -504,19 +504,17 @@ int CUI::DoButton(const void *id, const char *text, int checked, const CUIRect *
void CUI::DoLabel(const CUIRect *r, const char *pText, float Size, int Align, int MaxWidth)
{
// TODO: FIX ME!!!!
//Graphics()->BlendNormal();
if(Align == 0)
{
float tw = TextRender()->TextWidth(0, Size, pText, MaxWidth);
TextRender()->Text(0, r->x + r->w/2-tw/2, r->y - Size/10, Size, pText, MaxWidth);
TextRender()->Text(0, r->x + (r->w - tw) / 2.f, r->y + (r->h - Size) / 2.f, Size, pText, MaxWidth);
}
else if(Align < 0)
TextRender()->Text(0, r->x, r->y - Size/10, Size, pText, MaxWidth);
TextRender()->Text(0, r->x, r->y + (r->h - Size) / 2.f, Size, pText, MaxWidth);
else if(Align > 0)
{
float tw = TextRender()->TextWidth(0, Size, pText, MaxWidth);
TextRender()->Text(0, r->x + r->w-tw, r->y - Size/10, Size, pText, MaxWidth);
TextRender()->Text(0, r->x + r->w-tw, r->y + (r->h - Size) / 2.f, Size, pText, MaxWidth);
}
}

View file

@ -542,12 +542,7 @@ int CEditor::DoButton_Editor(const void *pID, const char *pText, int Checked, co
{
RenderTools()->DrawUIRect(pRect, GetButtonColor(pID, Checked), CUI::CORNER_ALL, 3.0f);
CUIRect NewRect = *pRect;
NewRect.y += NewRect.h/2.0f-7.0f;
float tw = min(TextRender()->TextWidth(0, 10.0f, pText, -1), NewRect.w);
CTextCursor Cursor;
TextRender()->SetCursor(&Cursor, NewRect.x + NewRect.w/2-tw/2, NewRect.y - 1.0f, 10.0f, TEXTFLAG_RENDER|TEXTFLAG_STOP_AT_END);
Cursor.m_LineWidth = NewRect.w;
TextRender()->TextEx(&Cursor, pText, -1);
UI()->DoLabel(&NewRect, pText, 10.f, 0, -1);
Checked %= 2;
return DoButton_Editor_Common(pID, pText, Checked, pRect, Flags, pToolTip);
}
@ -559,13 +554,7 @@ int CEditor::DoButton_Env(const void *pID, const char *pText, int Checked, const
vec4 Color = vec4(BaseColor.r*Bright, BaseColor.g*Bright, BaseColor.b*Bright, Alpha);
RenderTools()->DrawUIRect(pRect, Color, CUI::CORNER_ALL, 3.0f);
CUIRect NewRect = *pRect;
NewRect.y += NewRect.h/2.0f-7.0f;
float tw = min(TextRender()->TextWidth(0, 10.0f, pText, -1), NewRect.w);
CTextCursor Cursor;
TextRender()->SetCursor(&Cursor, NewRect.x + NewRect.w/2-tw/2, NewRect.y - 1.0f, 10.0f, TEXTFLAG_RENDER|TEXTFLAG_STOP_AT_END);
Cursor.m_LineWidth = NewRect.w;
TextRender()->TextEx(&Cursor, pText, -1);
UI()->DoLabel(pRect, pText, 10.f, 0, -1);
Checked %= 2;
return DoButton_Editor_Common(pID, pText, Checked, pRect, 0, pToolTip);
}
@ -599,10 +588,7 @@ int CEditor::DoButton_MenuItem(const void *pID, const char *pText, int Checked,
CUIRect t = *pRect;
t.VMargin(5.0f, &t);
CTextCursor Cursor;
TextRender()->SetCursor(&Cursor, t.x, t.y - 1.0f, 10.0f, TEXTFLAG_RENDER|TEXTFLAG_STOP_AT_END);
Cursor.m_LineWidth = t.w;
TextRender()->TextEx(&Cursor, pText, -1);
UI()->DoLabel(&t, pText, 10, 0, -1);
return DoButton_Editor_Common(pID, pText, Checked, pRect, Flags, pToolTip);
}
@ -610,7 +596,6 @@ int CEditor::DoButton_Tab(const void *pID, const char *pText, int Checked, const
{
RenderTools()->DrawUIRect(pRect, GetButtonColor(pID, Checked), CUI::CORNER_T, 5.0f);
CUIRect NewRect = *pRect;
NewRect.y += NewRect.h/2.0f-7.0f;
UI()->DoLabel(&NewRect, pText, 10, 0, -1);
return DoButton_Editor_Common(pID, pText, Checked, pRect, Flags, pToolTip);
}
@ -619,7 +604,6 @@ int CEditor::DoButton_Ex(const void *pID, const char *pText, int Checked, const
{
RenderTools()->DrawUIRect(pRect, GetButtonColor(pID, Checked), Corners, 3.0f);
CUIRect NewRect = *pRect;
NewRect.HMargin(NewRect.h/2.0f-FontSize/2.0f-1.0f, &NewRect);
UI()->DoLabel(&NewRect, pText, FontSize, 0, -1);
return DoButton_Editor_Common(pID, pText, Checked, pRect, Flags, pToolTip);
}
@ -804,7 +788,6 @@ int CEditor::UiDoValueSelector(void *pID, CUIRect *pRect, const char *pLabel, in
else
str_format(aBuf, sizeof(aBuf),"%d", Current);
RenderTools()->DrawUIRect(pRect, Color ? *Color : GetButtonColor(pID, 0), Corners, 5.0f);
pRect->y += pRect->h/2.0f-7.0f;
UI()->DoLabel(pRect, aBuf, 10, 0, -1);
}
@ -5505,8 +5488,7 @@ void CEditor::Init()
m_pTextRender = Kernel()->RequestInterface<ITextRender>();
m_pStorage = Kernel()->RequestInterface<IStorage>();
m_pSound = Kernel()->RequestInterface<ISound>();
m_RenderTools.m_pGraphics = m_pGraphics;
m_RenderTools.m_pUI = &m_UI;
m_RenderTools.Init(m_pGraphics, &m_UI);
m_UI.SetGraphics(m_pGraphics, m_pTextRender);
m_Map.m_pEditor = this;