mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-19 14:38:18 +00:00
began to rewrite server browser and ingame menu
This commit is contained in:
parent
8d427bea39
commit
c74637ae6d
Binary file not shown.
Before Width: | Height: | Size: 3.1 KiB |
BIN
data/icons/browse.png
Normal file
BIN
data/icons/browse.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.1 KiB |
BIN
data/icons/menu.png
Normal file
BIN
data/icons/menu.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 584 B |
BIN
data/icons/tools.png
Normal file
BIN
data/icons/tools.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.6 KiB |
Binary file not shown.
Before Width: | Height: | Size: 919 B |
Binary file not shown.
Before Width: | Height: | Size: 1.3 KiB |
|
@ -226,14 +226,14 @@ container.sounds.Add(SoundSet("menu", ["audio/music_menu.wv"]))
|
|||
image_null = Image("null", "")
|
||||
image_particles = Image("particles", "particles.png")
|
||||
image_game = Image("game", "game.png")
|
||||
image_browseicons = Image("browseicons", "browse_icons.png")
|
||||
image_browseicons = Image("browseicons", "icons/browse.png")
|
||||
image_emoticons = Image("emoticons", "emoticons.png")
|
||||
image_demobuttons = Image("demobuttons", "demo_buttons.png")
|
||||
image_fileicons = Image("fileicons", "file_icons.png")
|
||||
image_guibuttons = Image("guibuttons", "gui_buttons.png")
|
||||
image_guiicons = Image("guiicons", "gui_icons.png")
|
||||
image_checkboxicons = Image("checkboxicons", "menu_buttons.png")
|
||||
image_foldicons = Image("foldicons", "menu_fold.png")
|
||||
image_menuicons = Image("menuicons", "icons/menu.png")
|
||||
image_toolicons = Image("toolicons", "icons/tools.png")
|
||||
|
||||
container.images.Add(image_null)
|
||||
container.images.Add(image_game)
|
||||
|
@ -251,8 +251,8 @@ container.images.Add(image_guibuttons)
|
|||
container.images.Add(image_guiicons)
|
||||
container.images.Add(Image("no_skinpart", "no_skinpart.png"))
|
||||
container.images.Add(Image("hlpicker", "hlpicker.png"))
|
||||
container.images.Add(image_checkboxicons)
|
||||
container.images.Add(image_foldicons)
|
||||
container.images.Add(image_menuicons)
|
||||
container.images.Add(image_toolicons)
|
||||
|
||||
container.pickups.Add(Pickup("health"))
|
||||
container.pickups.Add(Pickup("armor"))
|
||||
|
@ -269,14 +269,14 @@ set_tee_decoration = SpriteSet("tee_decoration", image_null, 2, 1)
|
|||
set_tee_hands = SpriteSet("tee_hands", image_null, 2, 1)
|
||||
set_tee_feet = SpriteSet("tee_feet", image_null, 2, 1)
|
||||
set_tee_eyes = SpriteSet("tee_eyes", image_null, 2, 4)
|
||||
set_browseicons = SpriteSet("browseicons", image_browseicons, 2, 4)
|
||||
set_browseicons = SpriteSet("browseicons", image_browseicons, 4, 2)
|
||||
set_emoticons = SpriteSet("emoticons", image_emoticons, 4, 4)
|
||||
set_demobuttons = SpriteSet("demobuttons", image_demobuttons, 5, 1)
|
||||
set_fileicons = SpriteSet("fileicons", image_fileicons, 8, 1)
|
||||
set_guibuttons = SpriteSet("guibuttons", image_guibuttons, 12, 4)
|
||||
set_guiicons = SpriteSet("guiicons", image_guiicons, 8, 2)
|
||||
set_checkboxicons = SpriteSet("checkboxicons", image_checkboxicons, 2, 1)
|
||||
set_foldicons = SpriteSet("foldicons", image_foldicons, 2, 1)
|
||||
set_menuicons = SpriteSet("menuicons", image_menuicons, 2, 2)
|
||||
set_toolicons = SpriteSet("toolicons", image_toolicons, 4, 2)
|
||||
|
||||
container.spritesets.Add(set_particles)
|
||||
container.spritesets.Add(set_game)
|
||||
|
@ -292,8 +292,8 @@ container.spritesets.Add(set_demobuttons)
|
|||
container.spritesets.Add(set_fileicons)
|
||||
container.spritesets.Add(set_guibuttons)
|
||||
container.spritesets.Add(set_guiicons)
|
||||
container.spritesets.Add(set_checkboxicons)
|
||||
container.spritesets.Add(set_foldicons)
|
||||
container.spritesets.Add(set_menuicons)
|
||||
container.spritesets.Add(set_toolicons)
|
||||
|
||||
container.sprites.Add(Sprite("part_slice", set_particles, 0,0,1,1))
|
||||
container.sprites.Add(Sprite("part_ball", set_particles, 1,0,1,1))
|
||||
|
@ -413,13 +413,17 @@ container.sprites.Add(Sprite("eyes", set_emoticons, 2, 3, 1, 1))
|
|||
container.sprites.Add(Sprite("question", set_emoticons, 3, 3, 1, 1))
|
||||
|
||||
container.sprites.Add(Sprite("browse_lock_a", set_browseicons, 0,0,1,1))
|
||||
container.sprites.Add(Sprite("browse_lock_b", set_browseicons, 1,0,1,1))
|
||||
container.sprites.Add(Sprite("browse_unpure_a", set_browseicons, 0,1,1,1))
|
||||
container.sprites.Add(Sprite("browse_lock_b", set_browseicons, 0,1,1,1))
|
||||
#container.sprites.Add(Sprite("browse_lock_c", set_browseicons, 2,0,1,1))
|
||||
container.sprites.Add(Sprite("browse_unpure_a", set_browseicons, 1,0,1,1))
|
||||
container.sprites.Add(Sprite("browse_unpure_b", set_browseicons, 1,1,1,1))
|
||||
container.sprites.Add(Sprite("browse_star_a", set_browseicons, 0,2,1,1))
|
||||
container.sprites.Add(Sprite("browse_star_b", set_browseicons, 1,2,1,1))
|
||||
container.sprites.Add(Sprite("browse_info_a", set_browseicons, 0,3,1,1))
|
||||
container.sprites.Add(Sprite("browse_info_b", set_browseicons, 1,3,1,1))
|
||||
#container.sprites.Add(Sprite("browse_unpure_c", set_browseicons, 2,1,1,1))
|
||||
container.sprites.Add(Sprite("browse_star_a", set_browseicons, 2,0,1,1))
|
||||
container.sprites.Add(Sprite("browse_star_b", set_browseicons, 2,1,1,1))
|
||||
#container.sprites.Add(Sprite("browse_star_c", set_browseicons, 2,2,1,1))
|
||||
container.sprites.Add(Sprite("browse_heart_a", set_browseicons, 3,0,1,1))
|
||||
container.sprites.Add(Sprite("browse_heart_b", set_browseicons, 3,1,1,1))
|
||||
#container.sprites.Add(Sprite("browse_heart_c", set_browseicons, 2,3,1,1))
|
||||
|
||||
container.sprites.Add(Sprite("demobutton_play", set_demobuttons, 0,0,1,1))
|
||||
container.sprites.Add(Sprite("demobutton_pause", set_demobuttons, 1,0,1,1))
|
||||
|
@ -440,11 +444,20 @@ container.sprites.Add(Sprite("guibutton_hover", set_guibuttons, 8,0,4,4))
|
|||
container.sprites.Add(Sprite("guiicon_mute", set_guiicons, 0,0,4,2))
|
||||
container.sprites.Add(Sprite("guiicon_friend", set_guiicons, 4,0,4,2))
|
||||
|
||||
container.sprites.Add(Sprite("checkbox_active", set_checkboxicons, 0,0,1,1))
|
||||
container.sprites.Add(Sprite("checkbox_inactive", set_checkboxicons, 1,0,1,1))
|
||||
container.sprites.Add(Sprite("menu_checkbox_active", set_menuicons, 0,0,1,1))
|
||||
container.sprites.Add(Sprite("menu_checkbox_inactive", set_menuicons, 0,1,1,1))
|
||||
container.sprites.Add(Sprite("menu_collapsed", set_menuicons, 1,0,1,1))
|
||||
container.sprites.Add(Sprite("menu_expanded", set_menuicons, 1,1,1,1))
|
||||
|
||||
container.sprites.Add(Sprite("tool_up_a", set_toolicons, 0,0,1,1))
|
||||
container.sprites.Add(Sprite("tool_up_b", set_toolicons, 0,1,1,1))
|
||||
container.sprites.Add(Sprite("tool_down_a", set_toolicons, 1,0,1,1))
|
||||
container.sprites.Add(Sprite("tool_down_b", set_toolicons, 1,1,1,1))
|
||||
container.sprites.Add(Sprite("tool_edit_a", set_toolicons, 2,0,1,1))
|
||||
container.sprites.Add(Sprite("tool_edit_b", set_toolicons, 2,1,1,1))
|
||||
container.sprites.Add(Sprite("tool_x_a", set_toolicons, 3,0,1,1))
|
||||
container.sprites.Add(Sprite("tool_x_b", set_toolicons, 3,1,1,1))
|
||||
|
||||
container.sprites.Add(Sprite("fold_expanded", set_foldicons, 0,0,1,1))
|
||||
container.sprites.Add(Sprite("fold_collapsed", set_foldicons, 1,0,1,1))
|
||||
|
||||
anim = Animation("base")
|
||||
anim.body.frames.Add(AnimKeyframe(0, 0, -4, 0))
|
||||
|
|
|
@ -143,7 +143,7 @@ bool CServerBrowser::CServerFilter::SortCompareMap(int Index1, int Index2) const
|
|||
CServerEntry *a = m_pServerBrowser->m_ppServerlist[Index1];
|
||||
CServerEntry *b = m_pServerBrowser->m_ppServerlist[Index2];
|
||||
int Result = str_comp_nocase(a->m_Info.m_aMap, b->m_Info.m_aMap);
|
||||
return Result < 0 || (Result == 0 && (a->m_Info.m_Flags&FLAG_PURE));
|
||||
return Result < 0 || (Result == 0 && (a->m_Info.m_Flags&FLAG_PURE) && !(b->m_Info.m_Flags&FLAG_PURE));
|
||||
}
|
||||
|
||||
bool CServerBrowser::CServerFilter::SortComparePing(int Index1, int Index2) const
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
#include <game/client/components/sounds.h>
|
||||
#include <game/localization.h>
|
||||
|
||||
#include "menus.h"
|
||||
#include "chat.h"
|
||||
|
||||
|
||||
|
@ -388,6 +389,10 @@ void CChat::OnRender()
|
|||
--m_PendingChatCounter;
|
||||
}
|
||||
|
||||
// dont render chat if the menu is active
|
||||
if(m_pClient->m_pMenus->IsActive())
|
||||
return;
|
||||
|
||||
float Width = 300.0f*Graphics()->ScreenAspect();
|
||||
Graphics()->MapScreen(0.0f, 0.0f, Width, 300.0f);
|
||||
float x = 5.0f;
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
#include <game/client/animstate.h>
|
||||
#include <game/client/render.h>
|
||||
|
||||
#include "menus.h"
|
||||
#include "controls.h"
|
||||
#include "camera.h"
|
||||
#include "hud.h"
|
||||
|
@ -545,6 +546,10 @@ void CHud::OnRender()
|
|||
if(!m_pClient->m_Snap.m_pGameData)
|
||||
return;
|
||||
|
||||
// dont render hud if the menu is active
|
||||
if(m_pClient->m_pMenus->IsActive())
|
||||
return;
|
||||
|
||||
m_Width = 300.0f*Graphics()->ScreenAspect();
|
||||
m_Height = 300.0f;
|
||||
Graphics()->MapScreen(0.0f, 0.0f, m_Width, m_Height);
|
||||
|
|
|
@ -87,7 +87,7 @@ float *CMenus::ButtonFade(const void *pID, float Seconds, int Checked)
|
|||
return pFade;
|
||||
}
|
||||
|
||||
int CMenus::DoButton_Icon(int ImageId, int SpriteId, const CUIRect *pRect)
|
||||
int CMenus::DoIcon(int ImageId, int SpriteId, const CUIRect *pRect)
|
||||
{
|
||||
Graphics()->TextureSet(g_pData->m_aImages[ImageId].m_Id);
|
||||
|
||||
|
@ -120,21 +120,29 @@ int CMenus::DoButton_Toggle(const void *pID, int Checked, const CUIRect *pRect,
|
|||
return Active ? UI()->DoButtonLogic(pID, "", Checked, pRect) : 0;
|
||||
}
|
||||
|
||||
int CMenus::DoButton_Menu(const void *pID, const char *pText, int Checked, const CUIRect *pRect, int Corners, float r, float FontFactor)
|
||||
int CMenus::DoButton_Menu(const void *pID, const char *pText, int Checked, const CUIRect *pRect, int Corners, float r, float FontFactor, vec4 ColorHot, bool TextFade)
|
||||
{
|
||||
float Seconds = 0.6f; // 0.6 seconds for fade
|
||||
float *pFade = ButtonFade(pID, Seconds, Checked);
|
||||
float FadeVal = *pFade/Seconds;
|
||||
|
||||
RenderTools()->DrawUIRect(pRect, vec4(0.0f+FadeVal, 0.0f+FadeVal, 0.0f+FadeVal, 0.25f+FadeVal*0.5f), Corners, r);
|
||||
vec4 Color = mix(vec4(0.0f, 0.0f, 0.0f, 0.25f), ColorHot, FadeVal);
|
||||
|
||||
RenderTools()->DrawUIRect(pRect, Color, Corners, r);
|
||||
CUIRect Temp;
|
||||
pRect->HMargin(pRect->h>=20.0f?2.0f:1.0f, &Temp);
|
||||
Temp.HMargin((Temp.h*FontFactor)/2.0f, &Temp);
|
||||
TextRender()->TextColor(1.0f-FadeVal, 1.0f-FadeVal, 1.0f-FadeVal, 1.0f);
|
||||
TextRender()->TextOutlineColor(0.0f+FadeVal, 0.0f+FadeVal, 0.0f+FadeVal, 0.25f);
|
||||
if(TextFade)
|
||||
{
|
||||
TextRender()->TextColor(1.0f-FadeVal, 1.0f-FadeVal, 1.0f-FadeVal, 1.0f);
|
||||
TextRender()->TextOutlineColor(0.0f+FadeVal, 0.0f+FadeVal, 0.0f+FadeVal, 0.25f);
|
||||
}
|
||||
UI()->DoLabel(&Temp, pText, Temp.h*ms_FontmodHeight, 0);
|
||||
TextRender()->TextColor(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
TextRender()->TextOutlineColor(0.0f, 0.0f, 0.0f, 0.3f);
|
||||
if(TextFade)
|
||||
{
|
||||
TextRender()->TextColor(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
TextRender()->TextOutlineColor(0.0f, 0.0f, 0.0f, 0.3f);
|
||||
}
|
||||
return UI()->DoButtonLogic(pID, pText, Checked, pRect);
|
||||
}
|
||||
|
||||
|
@ -238,11 +246,23 @@ int CMenus::DoButton_GridHeader(const void *pID, const char *pText, int Checked,
|
|||
//void CMenus::ui_draw_grid_header(const void *id, const char *text, int checked, const CUIRect *r, const void *extra)
|
||||
{
|
||||
if(Checked)
|
||||
RenderTools()->DrawUIRect(pRect, vec4(1,1,1,0.5f), 0, 0.0f);
|
||||
{
|
||||
RenderTools()->DrawUIRect(pRect, vec4(1,1,1,0.5f), CUI::CORNER_ALL, 5.0f);
|
||||
TextRender()->TextColor(0.0f, 0.0f, 0.0f, 1.0f);
|
||||
TextRender()->TextOutlineColor(1.0f, 1.0f, 1.0f, 0.25f);
|
||||
}
|
||||
|
||||
CUIRect Label;
|
||||
pRect->VSplitLeft(5.0f, 0, &Label);
|
||||
Label.y+=2.0f;
|
||||
UI()->DoLabel(&Label, pText, pRect->h*ms_FontmodHeight*0.8f, -1);
|
||||
UI()->DoLabel(&Label, pText, pRect->h*ms_FontmodHeight*0.8f, 0);
|
||||
|
||||
if(Checked)
|
||||
{
|
||||
TextRender()->TextColor(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
TextRender()->TextOutlineColor(0.0f, 0.0f, 0.0f, 0.3f);
|
||||
}
|
||||
|
||||
return UI()->DoButtonLogic(pID, pText, Checked, pRect);
|
||||
}
|
||||
|
||||
|
@ -281,13 +301,13 @@ int CMenus::DoButton_CheckBox_Common(const void *pID, const char *pText, const c
|
|||
t.VSplitLeft(5.0f, 0, &t);
|
||||
|
||||
c.Margin(2.0f, &c);
|
||||
Graphics()->TextureSet(g_pData->m_aImages[IMAGE_CHECKBOXICONS].m_Id);
|
||||
Graphics()->TextureSet(g_pData->m_aImages[IMAGE_MENUICONS].m_Id);
|
||||
Graphics()->QuadsBegin();
|
||||
Graphics()->SetColor(1.0f, 1.0f, 1.0f, UI()->HotItem() == pID ? 1.0f : 0.6f);
|
||||
if(Checked)
|
||||
RenderTools()->SelectSprite(SPRITE_CHECKBOX_ACTIVE);
|
||||
RenderTools()->SelectSprite(SPRITE_MENU_CHECKBOX_ACTIVE);
|
||||
else
|
||||
RenderTools()->SelectSprite(SPRITE_CHECKBOX_INACTIVE);
|
||||
RenderTools()->SelectSprite(SPRITE_MENU_CHECKBOX_INACTIVE);
|
||||
IGraphics::CQuadItem QuadItem(c.x, c.y, c.w, c.h);
|
||||
Graphics()->QuadsDrawTL(&QuadItem, 1);
|
||||
Graphics()->QuadsEnd();
|
||||
|
@ -310,6 +330,30 @@ int CMenus::DoButton_CheckBox_Number(const void *pID, const char *pText, int Che
|
|||
return DoButton_CheckBox_Common(pID, pText, aBuf, pRect);
|
||||
}
|
||||
|
||||
int CMenus::DoButton_SpriteID(const void *pID, int ImageID, int SpriteID, const CUIRect *pRect, int Corners, float r, bool Fade)
|
||||
{
|
||||
float Seconds = 0.6f; // 0.6 seconds for fade
|
||||
float *pFade = ButtonFade(pID, Seconds);
|
||||
float FadeVal = *pFade/Seconds;
|
||||
|
||||
CUIRect Icon = *pRect;
|
||||
Icon.Margin(2.0f, &Icon);
|
||||
|
||||
if(Fade)
|
||||
RenderTools()->DrawUIRect(pRect, vec4(0.0f+FadeVal, 0.0f+FadeVal, 0.0f+FadeVal, 0.25f+FadeVal*0.5f), Corners, r);
|
||||
else
|
||||
RenderTools()->DrawUIRect(pRect, vec4(0.0f, 0.0f, 0.0f, 0.25f), Corners, r);
|
||||
Graphics()->TextureSet(g_pData->m_aImages[ImageID].m_Id);
|
||||
Graphics()->QuadsBegin();
|
||||
Graphics()->SetColor(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
RenderTools()->SelectSprite(SpriteID);
|
||||
IGraphics::CQuadItem QuadItem(Icon.x, Icon.y, Icon.w, Icon.h);
|
||||
Graphics()->QuadsDrawTL(&QuadItem, 1);
|
||||
Graphics()->QuadsEnd();
|
||||
|
||||
return UI()->DoButtonLogic(pID, "", false, pRect);
|
||||
}
|
||||
|
||||
int CMenus::DoButton_SpriteClean(int ImageID, int SpriteID, const CUIRect *pRect)
|
||||
{
|
||||
int Inside = UI()->MouseInside(pRect);
|
||||
|
@ -562,13 +606,13 @@ float CMenus::DoDropdownMenu(void *pID, const CUIRect *pRect, const char *pStr,
|
|||
CUIRect Button;
|
||||
Header.VSplitLeft(Header.h, &Button, 0);
|
||||
Button.Margin(2.0f, &Button);
|
||||
Graphics()->TextureSet(g_pData->m_aImages[IMAGE_FOLDICONS].m_Id);
|
||||
Graphics()->TextureSet(g_pData->m_aImages[IMAGE_MENUICONS].m_Id);
|
||||
Graphics()->QuadsBegin();
|
||||
Graphics()->SetColor(1.0f, 1.0f, 1.0f, UI()->HotItem() == pID ? 1.0f : 0.6f);
|
||||
if(Active)
|
||||
RenderTools()->SelectSprite(SPRITE_FOLD_EXPANDED);
|
||||
RenderTools()->SelectSprite(SPRITE_MENU_EXPANDED);
|
||||
else
|
||||
RenderTools()->SelectSprite(SPRITE_FOLD_COLLAPSED);
|
||||
RenderTools()->SelectSprite(SPRITE_MENU_COLLAPSED);
|
||||
IGraphics::CQuadItem QuadItem(Button.x, Button.y, Button.w, Button.h);
|
||||
Graphics()->QuadsDrawTL(&QuadItem, 1);
|
||||
Graphics()->SetColor(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
|
@ -765,12 +809,15 @@ void CMenus::UiDoListboxStart(const void *pID, float RowHeight, const char *pBot
|
|||
UI()->DoLabel(&Footer, pBottomText, Footer.h*ms_FontmodHeight*0.8f, 0);
|
||||
}
|
||||
|
||||
// list background
|
||||
RenderTools()->DrawUIRect(&View, vec4(0.0f, 0.0f, 0.0f, 0.25f), CUI::CORNER_ALL, 5.0f);
|
||||
|
||||
// prepare the scroll
|
||||
View.VSplitRight(20.0f, &View, &Scroll);
|
||||
|
||||
// scroll background
|
||||
RenderTools()->DrawUIRect(&Scroll, vec4(0.0f, 0.0f, 0.0f, 0.25f), CUI::CORNER_ALL, 5.0f);
|
||||
|
||||
// list background
|
||||
RenderTools()->DrawUIRect(&View, vec4(0.0f, 0.0f, 0.0f, 0.25f), CUI::CORNER_ALL, 5.0f);
|
||||
|
||||
// setup the variables
|
||||
gs_ListBoxOriginalView = View;
|
||||
gs_ListBoxSelectedIndex = SelectedIndex;
|
||||
|
@ -806,7 +853,6 @@ void CMenus::UiDoListboxStart(const void *pID, float RowHeight, const char *pBot
|
|||
|
||||
// the list
|
||||
gs_ListBoxView = gs_ListBoxOriginalView;
|
||||
gs_ListBoxView.VMargin(5.0f, &gs_ListBoxView);
|
||||
UI()->ClipEnable(&gs_ListBoxView);
|
||||
gs_ListBoxView.y -= gs_ListBoxScrollValue*Num*Row.h;
|
||||
}
|
||||
|
@ -922,7 +968,6 @@ CMenus::CListboxItem CMenus::UiDoListboxNextItem(const void *pId, bool Selected)
|
|||
|
||||
//selected_index = i;
|
||||
CUIRect r = Item.m_Rect;
|
||||
r.Margin(1.5f, &r);
|
||||
RenderTools()->DrawUIRect(&r, vec4(1,1,1,0.5f), CUI::CORNER_ALL, 5.0f);
|
||||
}
|
||||
|
||||
|
@ -1096,7 +1141,7 @@ void CMenus::RenderMenubar(CUIRect r)
|
|||
|
||||
Left.VSplitLeft(ButtonWidth, &Button, &Left);
|
||||
static int s_InternetButton=0;
|
||||
if(DoButton_MenuTabTop(&s_InternetButton, Localize("Internet"), m_ActivePage==PAGE_INTERNET, &Button))
|
||||
if(DoButton_MenuTabTop(&s_InternetButton, Localize("Global"), m_ActivePage==PAGE_INTERNET, &Button))
|
||||
{
|
||||
m_pClient->m_pCamera->ChangePosition(CCamera::POS_INTERNET);
|
||||
ServerBrowser()->Refresh(IServerBrowser::TYPE_INTERNET);
|
||||
|
@ -1107,7 +1152,7 @@ void CMenus::RenderMenubar(CUIRect r)
|
|||
Left.VSplitLeft(Spacing, 0, &Left); // little space
|
||||
Left.VSplitLeft(ButtonWidth, &Button, &Left);
|
||||
static int s_LanButton=0;
|
||||
if(DoButton_MenuTabTop(&s_LanButton, Localize("LAN"), m_ActivePage==PAGE_LAN, &Button))
|
||||
if(DoButton_MenuTabTop(&s_LanButton, Localize("Local"), m_ActivePage==PAGE_LAN, &Button))
|
||||
{
|
||||
m_pClient->m_pCamera->ChangePosition(CCamera::POS_LAN);
|
||||
ServerBrowser()->Refresh(IServerBrowser::TYPE_LAN);
|
||||
|
@ -1756,9 +1801,7 @@ int CMenus::Render()
|
|||
Box.HSplitTop(12.0f, 0, &Part);
|
||||
UI()->DoLabel(&Part, pExtraText, ButtonHeight*ms_FontmodHeight*0.8f, ExtraAlign);
|
||||
Part.HSplitTop(12.0f, 0, &Part);
|
||||
UI()->DoLabel(&Part, Localize("There's an unsaved map in the editor,"), ButtonHeight*ms_FontmodHeight*0.8f, ExtraAlign);
|
||||
Part.HSplitTop(12.0f, 0, &Part);
|
||||
UI()->DoLabel(&Part, Localize("you might want to save it before you quit the game."), ButtonHeight*ms_FontmodHeight*0.8f, ExtraAlign);
|
||||
UI()->DoLabel(&Part, Localize("There's an unsaved map in the editor, you might want to save it before you quit the game."), ButtonHeight*ms_FontmodHeight*0.8f, ExtraAlign);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -35,11 +35,11 @@ class CMenus : public CComponent
|
|||
|
||||
|
||||
int DoButton_DemoPlayer(const void *pID, const char *pText, const CUIRect *pRect);
|
||||
int DoButton_Sprite(const void *pID, int ImageID, int SpriteID, const CUIRect *pRect, int Corners);
|
||||
int DoButton_SpriteID(const void *pID, int ImageID, int SpriteID, const CUIRect *pRect, int Corners=CUI::CORNER_ALL, float r=5.0f, bool Fade=true);
|
||||
int DoButton_SpriteClean(int ImageID, int SpriteID, const CUIRect *pRect);
|
||||
int DoButton_SpriteCleanID(const void *pID, int ImageID, int SpriteID, const CUIRect *pRect);
|
||||
int DoButton_Toggle(const void *pID, int Checked, const CUIRect *pRect, bool Active);
|
||||
int DoButton_Menu(const void *pID, const char *pText, int Checked, const CUIRect *pRect, int Corners=CUI::CORNER_ALL, float r=5.0f, float FontFactor=0.0f);
|
||||
int DoButton_Menu(const void *pID, const char *pText, int Checked, const CUIRect *pRect, int Corners=CUI::CORNER_ALL, float r=5.0f, float FontFactor=0.0f, vec4 ColorHot=vec4(1.0f, 1.0f, 1.0f, 0.75f), bool TextFade=true);
|
||||
int DoButton_MenuImage(const void *pID, const char *pText, int Checked, const CUIRect *pRect, const char *pImageName, float r=5.0f, float FontFactor=0.0f);
|
||||
int DoButton_MenuTab(const void *pID, const char *pText, int Checked, const CUIRect *pRect, int Corners);
|
||||
int DoButton_MenuTabTop(const void *pID, const char *pText, int Checked, const CUIRect *pRect, int Corners=CUI::CORNER_ALL, float r=5.0f, float FontFactor=0.0f);
|
||||
|
@ -57,7 +57,7 @@ class CMenus : public CComponent
|
|||
static void ui_draw_settings_tab_button(const void *id, const char *text, int checked, const CUIRect *r, const void *extra);
|
||||
*/
|
||||
|
||||
int DoButton_Icon(int ImageId, int SpriteId, const CUIRect *pRect);
|
||||
int DoIcon(int ImageId, int SpriteId, const CUIRect *pRect);
|
||||
int DoButton_GridHeader(const void *pID, const char *pText, int Checked, const CUIRect *pRect);
|
||||
int DoButton_GridHeaderIcon(const void *pID, int ImageID, int SpriteID, const CUIRect *pRect, int Corners);
|
||||
|
||||
|
@ -355,8 +355,8 @@ class CMenus : public CComponent
|
|||
COL_MAP,
|
||||
COL_PLAYERS,
|
||||
COL_PING,
|
||||
COL_FAVORITE,
|
||||
COL_INFO,
|
||||
//COL_FAVORITE,
|
||||
//COL_INFO,
|
||||
|
||||
NUM_COLS,
|
||||
};
|
||||
|
@ -429,7 +429,7 @@ class CMenus : public CComponent
|
|||
void RenderServerbrowserBottomBox(CUIRect View);
|
||||
void RenderServerbrowserOverlay();
|
||||
bool RenderFilterHeader(CUIRect View, int FilterIndex);
|
||||
int DoBrowserEntry(const void *pID, CUIRect *pRect, const CServerInfo *pEntry);
|
||||
int DoBrowserEntry(const void *pID, CUIRect *pRect, const CServerInfo *pEntry, bool Selected);
|
||||
void RenderServerbrowser(CUIRect MainView);
|
||||
static void ConchainFriendlistUpdate(IConsole::IResult *pResult, void *pUserData, IConsole::FCommandCallback pfnCallback, void *pCallbackUserData);
|
||||
static void ConchainServerbrowserUpdate(IConsole::IResult *pResult, void *pUserData, IConsole::FCommandCallback pfnCallback, void *pCallbackUserData);
|
||||
|
|
|
@ -19,14 +19,14 @@
|
|||
#include "menus.h"
|
||||
|
||||
CMenus::CColumn CMenus::ms_aCols[] = {
|
||||
{COL_FLAG, -1, " ", -1, 80.0f, 0, {0}, {0}}, // Localize - these strings are localized within CLocConstString
|
||||
{COL_FLAG, -1, " ", -1, 87.0f, 0, {0}, {0}}, // Localize - these strings are localized within CLocConstString
|
||||
{COL_NAME, IServerBrowser::SORT_NAME, "Name", 0, 300.0f, 0, {0}, {0}},
|
||||
{COL_GAMETYPE, IServerBrowser::SORT_GAMETYPE, "Type", 1, 50.0f, 0, {0}, {0}},
|
||||
{COL_GAMETYPE, IServerBrowser::SORT_GAMETYPE, "Type", 1, 70.0f, 0, {0}, {0}},
|
||||
{COL_MAP, IServerBrowser::SORT_MAP, "Map", 1, 100.0f, 0, {0}, {0}},
|
||||
{COL_PLAYERS, IServerBrowser::SORT_NUMPLAYERS, "Players", 1, 60.0f, 0, {0}, {0}},
|
||||
{COL_PING, IServerBrowser::SORT_PING, "Ping", 1, 40.0f, 0, {0}, {0}},
|
||||
{COL_FAVORITE, -1, " ", 1, 14.0f, 0, {0}, {0}},
|
||||
{COL_INFO, -1, " ", 1, 14.0f, 0, {0}, {0}},
|
||||
//{COL_FAVORITE, -1, " ", 1, 14.0f, 0, {0}, {0}},
|
||||
//{COL_INFO, -1, " ", 1, 14.0f, 0, {0}, {0}},
|
||||
};
|
||||
|
||||
|
||||
|
@ -149,7 +149,7 @@ void CMenus::SetOverlay(int Type, float x, float y, const void *pData)
|
|||
m_InfoOverlay.m_pData = pData;
|
||||
}
|
||||
|
||||
int CMenus::DoBrowserEntry(const void *pID, CUIRect *pRect, const CServerInfo *pEntry)
|
||||
int CMenus::DoBrowserEntry(const void *pID, CUIRect *pRect, const CServerInfo *pEntry, bool Selected)
|
||||
{
|
||||
// logic
|
||||
int ReturnValue = 0;
|
||||
|
@ -170,8 +170,7 @@ int CMenus::DoBrowserEntry(const void *pID, CUIRect *pRect, const CServerInfo *p
|
|||
UI()->SetActiveItem(pID);
|
||||
|
||||
CUIRect r = *pRect;
|
||||
r.Margin(1.5f, &r);
|
||||
RenderTools()->DrawUIRect(&r, vec4(1.0f, 1.0f, 1.0f, 0.25f), CUI::CORNER_ALL, 4.0f);
|
||||
RenderTools()->DrawUIRect(&r, vec4(1.0f, 1.0f, 1.0f, 0.5f), CUI::CORNER_ALL, 4.0f);
|
||||
}
|
||||
|
||||
if(Inside)
|
||||
|
@ -200,6 +199,13 @@ int CMenus::DoBrowserEntry(const void *pID, CUIRect *pRect, const CServerInfo *p
|
|||
}
|
||||
}
|
||||
|
||||
vec3 TextBaseColor = vec3(1.0f, 1.0f, 1.0f);
|
||||
if(Selected || Inside)
|
||||
{
|
||||
TextBaseColor = vec3(0.0f, 0.0f, 0.0f);
|
||||
TextRender()->TextOutlineColor(1.0f, 1.0f, 1.0f, 0.25f);
|
||||
}
|
||||
|
||||
float TextAplpha = (pEntry->m_NumPlayers == pEntry->m_MaxPlayers || pEntry->m_NumClients == pEntry->m_MaxClients) ? 0.5f : 1.0f;
|
||||
for(int c = 0; c < NUM_COLS; c++)
|
||||
{
|
||||
|
@ -217,29 +223,51 @@ int CMenus::DoBrowserEntry(const void *pID, CUIRect *pRect, const CServerInfo *p
|
|||
CUIRect Rect = Button;
|
||||
CUIRect Icon;
|
||||
|
||||
Rect.HMargin(1.0f, &Rect);
|
||||
Rect.VSplitLeft(2.0f, 0, &Rect);
|
||||
Rect.VSplitLeft(Rect.h, &Icon, &Rect);
|
||||
if(pEntry->m_Flags&IServerBrowser::FLAG_PASSWORD)
|
||||
DoButton_Icon(IMAGE_BROWSEICONS, SPRITE_BROWSE_LOCK_A, &Icon);
|
||||
{
|
||||
Icon.Margin(2.0f, &Icon);
|
||||
DoIcon(IMAGE_BROWSEICONS, Selected ? SPRITE_BROWSE_LOCK_B : SPRITE_BROWSE_LOCK_A, &Icon);
|
||||
}
|
||||
|
||||
Rect.VSplitLeft(2.0f, 0, &Rect);
|
||||
Rect.VSplitLeft(Rect.h, &Icon, &Rect);
|
||||
if(!(pEntry->m_Flags&IServerBrowser::FLAG_PURE))
|
||||
DoButton_Icon(IMAGE_BROWSEICONS, SPRITE_BROWSE_UNPURE_A, &Icon);
|
||||
{
|
||||
Icon.Margin(2.0f, &Icon);
|
||||
DoIcon(IMAGE_BROWSEICONS, Selected ? SPRITE_BROWSE_UNPURE_B : SPRITE_BROWSE_UNPURE_A, &Icon);
|
||||
}
|
||||
|
||||
Rect.VSplitLeft(2.0f, 0, &Rect);
|
||||
Rect.VSplitLeft(Rect.h, &Icon, &Rect);
|
||||
if(pEntry->m_Favorite)
|
||||
DoButton_Icon(IMAGE_BROWSEICONS, SPRITE_BROWSE_STAR_A, &Icon);
|
||||
{
|
||||
Icon.Margin(2.0f, &Icon);
|
||||
DoIcon(IMAGE_BROWSEICONS, Selected ? SPRITE_BROWSE_STAR_B : SPRITE_BROWSE_STAR_A, &Icon);
|
||||
}
|
||||
|
||||
Rect.VSplitLeft(2.0f, 0, &Rect);
|
||||
Rect.VSplitLeft(Rect.h, &Icon, &Rect);
|
||||
if(pEntry->m_FriendState != IFriends::FRIEND_NO)
|
||||
{
|
||||
Icon.Margin(2.0f, &Icon);
|
||||
DoIcon(IMAGE_BROWSEICONS, Selected ? SPRITE_BROWSE_HEART_B : SPRITE_BROWSE_HEART_A, &Icon);
|
||||
}
|
||||
}
|
||||
else if(ID == COL_NAME)
|
||||
{
|
||||
CTextCursor Cursor;
|
||||
TextRender()->SetCursor(&Cursor, Button.x, Button.y, 12.0f, TEXTFLAG_RENDER|TEXTFLAG_STOP_AT_END);
|
||||
Cursor.m_LineWidth = Button.w;
|
||||
|
||||
TextRender()->TextColor(1.0f, 1.0f, 1.0f, TextAplpha);
|
||||
float tw = TextRender()->TextWidth(0, 12.0f, pEntry->m_aName, -1);
|
||||
if(tw < Button.w)
|
||||
TextRender()->SetCursor(&Cursor, Button.x+Button.w/2.0f-tw/2.0f, Button.y, 12.0f, TEXTFLAG_RENDER);
|
||||
else
|
||||
{
|
||||
TextRender()->SetCursor(&Cursor, Button.x, Button.y, 12.0f, TEXTFLAG_RENDER|TEXTFLAG_STOP_AT_END);
|
||||
Cursor.m_LineWidth = Button.w;
|
||||
}
|
||||
|
||||
TextRender()->TextColor(TextBaseColor.r, TextBaseColor.g, TextBaseColor.b, TextAplpha);
|
||||
|
||||
if(g_Config.m_BrFilterString[0] && (pEntry->m_QuickSearchHit&IServerBrowser::QUICK_SERVERNAME))
|
||||
{
|
||||
|
@ -250,7 +278,7 @@ int CMenus::DoBrowserEntry(const void *pID, CUIRect *pRect, const CServerInfo *p
|
|||
TextRender()->TextEx(&Cursor, pEntry->m_aName, (int)(pStr-pEntry->m_aName));
|
||||
TextRender()->TextColor(0.4f, 0.4f, 1.0f, TextAplpha);
|
||||
TextRender()->TextEx(&Cursor, pStr, str_length(g_Config.m_BrFilterString));
|
||||
TextRender()->TextColor(1.0f, 1.0f, 1.0f, TextAplpha);
|
||||
TextRender()->TextColor(TextBaseColor.r, TextBaseColor.g, TextBaseColor.b, TextAplpha);
|
||||
TextRender()->TextEx(&Cursor, pStr+str_length(g_Config.m_BrFilterString), -1);
|
||||
}
|
||||
else
|
||||
|
@ -262,10 +290,16 @@ int CMenus::DoBrowserEntry(const void *pID, CUIRect *pRect, const CServerInfo *p
|
|||
else if(ID == COL_MAP)
|
||||
{
|
||||
CTextCursor Cursor;
|
||||
TextRender()->SetCursor(&Cursor, Button.x, Button.y, 12.0f * UI()->Scale(), TEXTFLAG_RENDER|TEXTFLAG_STOP_AT_END);
|
||||
Cursor.m_LineWidth = Button.w;
|
||||
float tw = TextRender()->TextWidth(0, 12.0f, pEntry->m_aMap, -1);
|
||||
if(tw < Button.w)
|
||||
TextRender()->SetCursor(&Cursor, Button.x+Button.w/2.0f-tw/2.0f, Button.y, 12.0f, TEXTFLAG_RENDER);
|
||||
else
|
||||
{
|
||||
TextRender()->SetCursor(&Cursor, Button.x, Button.y, 12.0f, TEXTFLAG_RENDER|TEXTFLAG_STOP_AT_END);
|
||||
Cursor.m_LineWidth = Button.w;
|
||||
}
|
||||
|
||||
TextRender()->TextColor(1.0f, 1.0f, 1.0f, TextAplpha);
|
||||
TextRender()->TextColor(TextBaseColor.r, TextBaseColor.g, TextBaseColor.b, TextAplpha);
|
||||
|
||||
if(g_Config.m_BrFilterString[0] && (pEntry->m_QuickSearchHit&IServerBrowser::QUICK_MAPNAME))
|
||||
{
|
||||
|
@ -276,7 +310,7 @@ int CMenus::DoBrowserEntry(const void *pID, CUIRect *pRect, const CServerInfo *p
|
|||
TextRender()->TextEx(&Cursor, pEntry->m_aMap, (int)(pStr-pEntry->m_aMap));
|
||||
TextRender()->TextColor(0.4f, 0.4f, 1.0f, TextAplpha);
|
||||
TextRender()->TextEx(&Cursor, pStr, str_length(g_Config.m_BrFilterString));
|
||||
TextRender()->TextColor(1.0f, 1.0f, 1.0f, TextAplpha);
|
||||
TextRender()->TextColor(TextBaseColor.r, TextBaseColor.g, TextBaseColor.b, TextAplpha);
|
||||
TextRender()->TextEx(&Cursor, pStr+str_length(g_Config.m_BrFilterString), -1);
|
||||
}
|
||||
else
|
||||
|
@ -287,7 +321,7 @@ int CMenus::DoBrowserEntry(const void *pID, CUIRect *pRect, const CServerInfo *p
|
|||
}
|
||||
else if(ID == COL_PLAYERS)
|
||||
{
|
||||
TextRender()->TextColor(1.0f, 1.0f, 1.0f, TextAplpha);
|
||||
TextRender()->TextColor(TextBaseColor.r, TextBaseColor.g, TextBaseColor.b, TextAplpha);
|
||||
|
||||
if(g_Config.m_BrFilterSpectators)
|
||||
str_format(aTemp, sizeof(aTemp), "%d/%d", pEntry->m_NumPlayers, pEntry->m_MaxPlayers);
|
||||
|
@ -295,7 +329,8 @@ int CMenus::DoBrowserEntry(const void *pID, CUIRect *pRect, const CServerInfo *p
|
|||
str_format(aTemp, sizeof(aTemp), "%d/%d", pEntry->m_NumClients, pEntry->m_MaxClients);
|
||||
if(g_Config.m_BrFilterString[0] && (pEntry->m_QuickSearchHit&IServerBrowser::QUICK_PLAYER))
|
||||
TextRender()->TextColor(0.4f, 0.4f, 1.0f, TextAplpha);
|
||||
UI()->DoLabelScaled(&Button, aTemp, 12.0f, 1);
|
||||
Button.y += 2.0f;
|
||||
UI()->DoLabel(&Button, aTemp, 12.0f, 0);
|
||||
}
|
||||
else if(ID == COL_PING)
|
||||
{
|
||||
|
@ -321,17 +356,25 @@ int CMenus::DoBrowserEntry(const void *pID, CUIRect *pRect, const CServerInfo *p
|
|||
vec4 Color = mix(StartColor, EndColor, MixVal);
|
||||
str_format(aTemp, sizeof(aTemp), "%d", pEntry->m_Latency);
|
||||
TextRender()->TextColor(Color.r, Color.g, Color.b, Color.a);
|
||||
UI()->DoLabelScaled(&Button, aTemp, 12.0f, 1);
|
||||
Button.y += 2.0f;
|
||||
UI()->DoLabel(&Button, aTemp, 12.0f, 0);
|
||||
}
|
||||
else if(ID == COL_GAMETYPE)
|
||||
{
|
||||
CTextCursor Cursor;
|
||||
TextRender()->SetCursor(&Cursor, Button.x, Button.y, 12.0f*UI()->Scale(), TEXTFLAG_RENDER|TEXTFLAG_STOP_AT_END);
|
||||
Cursor.m_LineWidth = Button.w;
|
||||
TextRender()->TextColor(1.0f, 1.0f, 1.0f, TextAplpha);
|
||||
float tw = TextRender()->TextWidth(0, 12.0f, pEntry->m_aGameType, -1);
|
||||
if(tw < Button.w)
|
||||
TextRender()->SetCursor(&Cursor, Button.x+Button.w/2.0f-tw/2.0f, Button.y, 12.0f, TEXTFLAG_RENDER);
|
||||
else
|
||||
{
|
||||
TextRender()->SetCursor(&Cursor, Button.x, Button.y, 12.0f, TEXTFLAG_RENDER|TEXTFLAG_STOP_AT_END);
|
||||
Cursor.m_LineWidth = Button.w;
|
||||
}
|
||||
|
||||
TextRender()->TextColor(TextBaseColor.r, TextBaseColor.g, TextBaseColor.b, TextAplpha);
|
||||
TextRender()->TextEx(&Cursor, pEntry->m_aGameType, -1);
|
||||
}
|
||||
else if(ID == COL_FAVORITE)
|
||||
/*else if(ID == COL_FAVORITE)
|
||||
{
|
||||
Button.HMargin(1.5f, &Button);
|
||||
if(DoButton_SpriteClean(IMAGE_BROWSEICONS, pEntry->m_Favorite ? SPRITE_BROWSE_STAR_A : SPRITE_BROWSE_STAR_B, &Button))
|
||||
|
@ -345,11 +388,12 @@ int CMenus::DoBrowserEntry(const void *pID, CUIRect *pRect, const CServerInfo *p
|
|||
else if(ID == COL_INFO)
|
||||
{
|
||||
Button.HMargin(1.5f, &Button);
|
||||
if(DoButton_MouseOver(IMAGE_BROWSEICONS, SPRITE_BROWSE_INFO_A, &Button))
|
||||
if(DoButton_MouseOver(IMAGE_BROWSEICONS, SPRITE_BROWSE_HEART_A, &Button))
|
||||
SetOverlay(CInfoOverlay::OVERLAY_SERVERINFO, Button.x, Button.y, pEntry);
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
TextRender()->TextOutlineColor(0.0f, 0.0f, 0.0f, 0.3f);
|
||||
TextRender()->TextColor(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
|
||||
return ReturnValue;
|
||||
|
@ -359,20 +403,26 @@ bool CMenus::RenderFilterHeader(CUIRect View, int FilterIndex)
|
|||
{
|
||||
CBrowserFilter *pFilter = &m_lFilters[FilterIndex];
|
||||
|
||||
float ButtonHeight = 20.0f;
|
||||
float Spacing = 3.0f;
|
||||
|
||||
RenderTools()->DrawUIRect(&View, vec4(0.0f, 0.0f, 0.0f, 0.25f), CUI::CORNER_ALL, 5.0f);
|
||||
|
||||
CUIRect Button, Label;
|
||||
View.HMargin(1.0f, &View);
|
||||
|
||||
View.VSplitLeft(20.0f, 0, &Button);
|
||||
Button.VSplitLeft(18.0f, &Button, 0);
|
||||
if(DoButton_SpriteClean(IMAGE_FOLDICONS, pFilter->Extended() ? SPRITE_FOLD_EXPANDED : SPRITE_FOLD_COLLAPSED, &Button))
|
||||
CUIRect Button, EditButtons;
|
||||
View.VSplitLeft(20.0f, &Button, &View);
|
||||
Button.Margin(2.0f, &Button);
|
||||
if(DoButton_SpriteClean(IMAGE_MENUICONS, pFilter->Extended() ? SPRITE_MENU_EXPANDED : SPRITE_MENU_COLLAPSED, &Button))
|
||||
pFilter->Switch();
|
||||
|
||||
View.VSplitLeft(50.0f, 0, &Label);
|
||||
Label.HMargin(2.0f, &Label);
|
||||
if(pFilter->Custom() <= CBrowserFilter::FILTER_ALL)
|
||||
UI()->DoLabel(&Label, pFilter->Name(), 12.0f, -1);
|
||||
// split buttons from label
|
||||
View.VSplitLeft(Spacing, 0, &View);
|
||||
View.VSplitRight((ButtonHeight+Spacing)*4.0f, &View, &EditButtons);
|
||||
|
||||
View.y += 2.0f;
|
||||
UI()->DoLabel(&View, pFilter->Name(), ButtonHeight*ms_FontmodHeight*0.8f, 0);
|
||||
|
||||
/*if(pFilter->Custom() <= CBrowserFilter::FILTER_ALL)
|
||||
UI()->DoLabel(&View, pFilter->Name(), 12.0f, -1);
|
||||
else
|
||||
{
|
||||
Graphics()->TextureSet(g_pData->m_aImages[IMAGE_BROWSEICONS].m_Id);
|
||||
|
@ -387,42 +437,66 @@ bool CMenus::RenderFilterHeader(CUIRect View, int FilterIndex)
|
|||
|
||||
Label.VSplitLeft(25.0f, 0, &Label);
|
||||
UI()->DoLabel(&Label, pFilter->Name(), 12.0f, -1);
|
||||
}
|
||||
}*/
|
||||
|
||||
View.VSplitRight(20.0f, &Button, 0);
|
||||
Button.VSplitRight(18.0f, &View, &Button);
|
||||
EditButtons.VSplitRight(ButtonHeight, &EditButtons, &Button);
|
||||
Button.Margin(2.0f, &Button);
|
||||
if(pFilter->Custom() == CBrowserFilter::FILTER_CUSTOM)
|
||||
{
|
||||
if(DoButton_SpriteClean(IMAGE_BROWSEICONS, SPRITE_BROWSE_STAR_A, &Button))
|
||||
if(DoButton_SpriteClean(IMAGE_TOOLICONS, SPRITE_TOOL_X_A, &Button))
|
||||
{
|
||||
RemoveFilter(FilterIndex);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else
|
||||
DoIcon(IMAGE_TOOLICONS, SPRITE_TOOL_X_B, &Button);
|
||||
|
||||
View.VSplitRight(2.0f, &Button, 0);
|
||||
Button.VSplitRight(18.0f, &View, &Button);
|
||||
if(DoButton_MouseOver(IMAGE_BROWSEICONS, SPRITE_BROWSE_INFO_A, &Button))
|
||||
SetOverlay(CInfoOverlay::OVERLAY_HEADERINFO, Button.x, Button.y, pFilter);
|
||||
EditButtons.VSplitRight(Spacing, &EditButtons, 0);
|
||||
EditButtons.VSplitRight(ButtonHeight, &EditButtons, &Button);
|
||||
Button.Margin(2.0f, &Button);
|
||||
if(pFilter->Custom() == CBrowserFilter::FILTER_CUSTOM)
|
||||
{
|
||||
if(DoButton_SpriteClean(IMAGE_TOOLICONS, SPRITE_TOOL_EDIT_A, &Button))
|
||||
{
|
||||
RemoveFilter(FilterIndex);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else
|
||||
DoIcon(IMAGE_TOOLICONS, SPRITE_TOOL_EDIT_B, &Button);
|
||||
|
||||
View.VSplitRight(2.0f, &Button, 0);
|
||||
/*EditButtons.VSplitRight(Spacing, &EditButtons, 0):
|
||||
EditButtons.VSplitRight(ButtonHeight, &EditButtons, &Button);
|
||||
Button.VSplitRight(18.0f, &View, &Button);
|
||||
if(DoButton_SpriteCleanID(pFilter, IMAGE_BROWSEICONS, SPRITE_BROWSE_STAR_A, &Button)) // TODO: using the address of filter as ID is prolly a bad idea
|
||||
{
|
||||
static int s_EditPopupID = 0;
|
||||
m_SelectedFilter = FilterIndex;
|
||||
InvokePopupMenu(&s_EditPopupID, 0, UI()->MouseX(), UI()->MouseY(), 200.0f, 310.0f, PopupFilter);
|
||||
}*/
|
||||
|
||||
EditButtons.VSplitRight(Spacing, &EditButtons, 0);
|
||||
EditButtons.VSplitRight(ButtonHeight, &EditButtons, &Button);
|
||||
Button.Margin(2.0f, &Button);
|
||||
if(FilterIndex < m_lFilters.size()-1)
|
||||
{
|
||||
if(DoButton_SpriteClean(IMAGE_TOOLICONS, SPRITE_TOOL_UP_A, &Button))
|
||||
Move(false, FilterIndex);
|
||||
}
|
||||
else
|
||||
DoIcon(IMAGE_TOOLICONS, SPRITE_TOOL_UP_B, &Button);
|
||||
|
||||
View.VSplitRight(2.0f, &Button, 0);
|
||||
Button.VSplitRight(18.0f, &View, &Button);
|
||||
if(DoButton_SpriteClean(IMAGE_BROWSEICONS, SPRITE_BROWSE_STAR_A, &Button))
|
||||
Move(true, FilterIndex);
|
||||
|
||||
View.VSplitRight(2.0f, &Button, 0);
|
||||
Button.VSplitRight(18.0f, &View, &Button);
|
||||
if(DoButton_SpriteClean(IMAGE_BROWSEICONS, SPRITE_BROWSE_STAR_B, &Button))
|
||||
Move(false, FilterIndex);
|
||||
EditButtons.VSplitRight(Spacing, &EditButtons, 0);
|
||||
EditButtons.VSplitRight(ButtonHeight, &EditButtons, &Button);
|
||||
Button.Margin(2.0f, &Button);
|
||||
if(FilterIndex > 0)
|
||||
{
|
||||
if(DoButton_SpriteClean(IMAGE_TOOLICONS, SPRITE_TOOL_DOWN_A, &Button))
|
||||
Move(true, FilterIndex);
|
||||
}
|
||||
else
|
||||
DoIcon(IMAGE_TOOLICONS, SPRITE_TOOL_DOWN_B, &Button);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
@ -478,11 +552,14 @@ void CMenus::RenderServerbrowserServerList(CUIRect View)
|
|||
CUIRect Headers;
|
||||
CUIRect Status;
|
||||
|
||||
float SpacingH = 2.0f;
|
||||
float ButtonHeight = 20.0f;
|
||||
|
||||
// background
|
||||
RenderTools()->DrawUIRect(&View, vec4(0.0f, 0.0f, 0.0f, 0.25f), CUI::CORNER_ALL, 5.0f);
|
||||
|
||||
View.HSplitTop(ms_ListheaderHeight, &Headers, &View);
|
||||
View.HSplitBottom(28.0f, &View, &Status);
|
||||
View.HSplitBottom(ButtonHeight*3.0f+SpacingH*2.0f, &View, &Status);
|
||||
|
||||
Headers.VSplitRight(20.0f, &Headers, 0);
|
||||
|
||||
|
@ -524,18 +601,25 @@ void CMenus::RenderServerbrowserServerList(CUIRect View)
|
|||
CUIRect Rect = ms_aCols[i].m_Rect;
|
||||
CUIRect Icon;
|
||||
|
||||
Rect.HMargin(1.0f, &Rect);
|
||||
Rect.VSplitLeft(2.0f, 0, &Rect);
|
||||
Rect.VSplitLeft(Rect.h, &Icon, &Rect);
|
||||
DoButton_Icon(IMAGE_BROWSEICONS, SPRITE_BROWSE_LOCK_A, &Icon);
|
||||
Icon.Margin(2.0f, &Icon);
|
||||
DoIcon(IMAGE_BROWSEICONS, SPRITE_BROWSE_LOCK_A, &Icon);
|
||||
|
||||
Rect.VSplitLeft(2.0f, 0, &Rect);
|
||||
Rect.VSplitLeft(Rect.h, &Icon, &Rect);
|
||||
DoButton_Icon(IMAGE_BROWSEICONS, SPRITE_BROWSE_UNPURE_A, &Icon);
|
||||
Icon.Margin(2.0f, &Icon);
|
||||
DoIcon(IMAGE_BROWSEICONS, SPRITE_BROWSE_UNPURE_A, &Icon);
|
||||
|
||||
Rect.VSplitLeft(2.0f, 0, &Rect);
|
||||
Rect.VSplitLeft(Rect.h, &Icon, &Rect);
|
||||
DoButton_Icon(IMAGE_BROWSEICONS, SPRITE_BROWSE_STAR_A, &Icon);
|
||||
Icon.Margin(2.0f, &Icon);
|
||||
DoIcon(IMAGE_BROWSEICONS, SPRITE_BROWSE_STAR_A, &Icon);
|
||||
|
||||
Rect.VSplitLeft(2.0f, 0, &Rect);
|
||||
Rect.VSplitLeft(Rect.h, &Icon, &Rect);
|
||||
Icon.Margin(2.0f, &Icon);
|
||||
DoIcon(IMAGE_BROWSEICONS, SPRITE_BROWSE_HEART_A, &Icon);
|
||||
}
|
||||
else if(DoButton_GridHeader(ms_aCols[i].m_Caption, ms_aCols[i].m_Caption, g_Config.m_BrSort == ms_aCols[i].m_Sort, &ms_aCols[i].m_Rect))
|
||||
{
|
||||
|
@ -550,11 +634,39 @@ void CMenus::RenderServerbrowserServerList(CUIRect View)
|
|||
}
|
||||
}
|
||||
|
||||
RenderTools()->DrawUIRect(&View, vec4(0.0f, 0.0f, 0.0f, 0.25f), CUI::CORNER_ALL, 5.0f);
|
||||
|
||||
// split scrollbar from view
|
||||
CUIRect Scroll;
|
||||
View.VSplitRight(20.0f, &View, &Scroll);
|
||||
|
||||
// scrollbar background
|
||||
RenderTools()->DrawUIRect(&Scroll, vec4(0.0f, 0.0f, 0.0f, 0.25f), CUI::CORNER_ALL, 5.0f);
|
||||
|
||||
// list background
|
||||
RenderTools()->DrawUIRect(&View, vec4(0.0f, 0.0f, 0.0f, 0.25f), CUI::CORNER_ALL, 5.0f);
|
||||
{
|
||||
int Column = COL_PING;
|
||||
switch(g_Config.m_BrSort)
|
||||
{
|
||||
case IServerBrowser::SORT_NAME:
|
||||
Column = COL_NAME;
|
||||
break;
|
||||
case IServerBrowser::SORT_GAMETYPE:
|
||||
Column = COL_GAMETYPE;
|
||||
break;
|
||||
case IServerBrowser::SORT_MAP:
|
||||
Column = COL_MAP;
|
||||
break;
|
||||
case IServerBrowser::SORT_NUMPLAYERS:
|
||||
Column = COL_PLAYERS;
|
||||
break;
|
||||
}
|
||||
|
||||
CUIRect Rect = View;
|
||||
Rect.x = CMenus::ms_aCols[Column].m_Rect.x;
|
||||
Rect.w = CMenus::ms_aCols[Column].m_Rect.w;
|
||||
RenderTools()->DrawUIRect(&Rect, vec4(0.0f, 0.0f, 0.0f, 0.05f), CUI::CORNER_ALL, 5.0f);
|
||||
}
|
||||
|
||||
// display important messages in the middle of the screen so no
|
||||
// users misses it
|
||||
{
|
||||
|
@ -748,8 +860,7 @@ void CMenus::RenderServerbrowserServerList(CUIRect View)
|
|||
if(m_SelectedServer.m_Filter == s && m_SelectedServer.m_Index == i)
|
||||
{
|
||||
CUIRect r = Row;
|
||||
r.Margin(1.5f, &r);
|
||||
RenderTools()->DrawUIRect(&r, vec4(1,1,1,0.5f), CUI::CORNER_ALL, 4.0f);
|
||||
RenderTools()->DrawUIRect(&r, vec4(1.0f, 1.0f, 1.0f, 0.5f), CUI::CORNER_ALL, 4.0f);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -762,7 +873,7 @@ void CMenus::RenderServerbrowserServerList(CUIRect View)
|
|||
continue;
|
||||
}
|
||||
|
||||
if(DoBrowserEntry(pFilter->ID(ItemIndex), &Row, pItem))
|
||||
if(DoBrowserEntry(pFilter->ID(ItemIndex), &Row, pItem, m_SelectedServer.m_Filter == s && m_SelectedServer.m_Index == i))
|
||||
{
|
||||
m_SelectedServer.m_Filter = s;
|
||||
m_SelectedServer.m_Index = i;
|
||||
|
@ -780,28 +891,29 @@ void CMenus::RenderServerbrowserServerList(CUIRect View)
|
|||
|
||||
UI()->ClipDisable();
|
||||
|
||||
Status.Margin(5.0f, &Status);
|
||||
// bottom
|
||||
float SpacingW = 3.0f;
|
||||
float ButtonWidth = (Status.w/6.0f)-(SpacingW*5.0)/6.0f;
|
||||
|
||||
// render quick search
|
||||
CUIRect QuickSearch, Button;
|
||||
Status.VSplitLeft(240.0f, &QuickSearch, &Status);
|
||||
const char *pLabel = Localize("Quick search:");
|
||||
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);
|
||||
QuickSearch.VSplitLeft(240.0f-w-22.0f, &QuickSearch, &Button);
|
||||
static float Offset = 0.0f;
|
||||
if(DoEditBox(&g_Config.m_BrFilterString, &QuickSearch, g_Config.m_BrFilterString, sizeof(g_Config.m_BrFilterString), 12.0f, &Offset, false, CUI::CORNER_L))
|
||||
// cut view
|
||||
CUIRect Left, Label, EditBox, Button;
|
||||
Status.VSplitLeft(ButtonWidth*3.0f+SpacingH*2.0f, &Left, &Status);
|
||||
|
||||
// render quick search and host address
|
||||
Left.HSplitTop(((ButtonHeight*3.0f+SpacingH*2.0f)-(ButtonHeight*2.0f+SpacingH))/2.0f, 0, &Left);
|
||||
Left.HSplitTop(ButtonHeight, &Label, &Left);
|
||||
Label.VSplitRight(ButtonWidth*2.0f+SpacingH, &Label, &EditBox);
|
||||
Label.y += 2.0f;
|
||||
UI()->DoLabel(&Label, Localize("Search:"), ButtonHeight*ms_FontmodHeight*0.8f, 0);
|
||||
EditBox.VSplitRight(EditBox.h, &EditBox, &Button);
|
||||
static float s_ClearOffset = 0.0f;
|
||||
if(DoEditBox(&g_Config.m_BrFilterString, &EditBox, g_Config.m_BrFilterString, sizeof(g_Config.m_BrFilterString), ButtonHeight*ms_FontmodHeight*0.8f, &s_ClearOffset, false, CUI::CORNER_ALL))
|
||||
Client()->ServerBrowserUpdate();
|
||||
|
||||
// clear button
|
||||
{
|
||||
static int s_ClearButton = 0;
|
||||
float *pClearButtonFade = ButtonFade(&s_ClearButton, 0.6f);
|
||||
RenderTools()->DrawUIRect(&Button, vec4(1.0f, 1.0f, 1.0f, 0.33f+(*pClearButtonFade/0.6f)*0.165f), CUI::CORNER_R, 3.0f);
|
||||
UI()->DoLabel(&Button, "x", Button.h*ms_FontmodHeight, 0);
|
||||
if(UI()->DoButtonLogic(&s_ClearButton, "x", 0, &Button))
|
||||
if(DoButton_SpriteID(&s_ClearButton, IMAGE_TOOLICONS, SPRITE_TOOL_X_A, &Button, CUI::CORNER_ALL, 5.0f, false))
|
||||
{
|
||||
g_Config.m_BrFilterString[0] = 0;
|
||||
UI()->SetActiveItem(&g_Config.m_BrFilterString);
|
||||
|
@ -809,14 +921,24 @@ void CMenus::RenderServerbrowserServerList(CUIRect View)
|
|||
}
|
||||
}
|
||||
|
||||
Left.HSplitTop(SpacingH, 0, &Left);
|
||||
Left.HSplitTop(ButtonHeight, &Label, 0);
|
||||
Label.VSplitRight(ButtonWidth*2.0f+SpacingH, &Label, &EditBox);
|
||||
Label.y += 2.0f;
|
||||
UI()->DoLabel(&Label, Localize("Host address:"), ButtonHeight*ms_FontmodHeight*0.8f, 0);
|
||||
static float s_AddressOffset = 0.0f;
|
||||
DoEditBox(&g_Config.m_UiServerAddress, &EditBox, g_Config.m_UiServerAddress, sizeof(g_Config.m_UiServerAddress), ButtonHeight*ms_FontmodHeight*0.8f, &s_AddressOffset, false, CUI::CORNER_ALL);
|
||||
|
||||
// render status
|
||||
Status.HSplitTop(ButtonHeight+SpacingH, 0, &Status);
|
||||
Status.HSplitTop(ButtonHeight, &Status, 0);
|
||||
char aBuf[128];
|
||||
if(ServerBrowser()->IsRefreshing())
|
||||
str_format(aBuf, sizeof(aBuf), Localize("%d%% loaded"), ServerBrowser()->LoadingProgression());
|
||||
else
|
||||
str_format(aBuf, sizeof(aBuf), Localize("%d servers, %d players"), ServerBrowser()->NumServers(), NumPlayers);
|
||||
Status.VSplitRight(TextRender()->TextWidth(0, 14.0f, aBuf, -1), 0, &Status);
|
||||
UI()->DoLabelScaled(&Status, aBuf, 14.0f, -1);
|
||||
Status.y += 2.0f;
|
||||
UI()->DoLabel(&Status, aBuf, 14.0f, 0);
|
||||
}
|
||||
|
||||
void CMenus::RenderServerbrowserFilters(CUIRect View)
|
||||
|
@ -1286,19 +1408,11 @@ void CMenus::RenderServerbrowserBottomBox(CUIRect MainView)
|
|||
MainView.VSplitLeft(Spacing, 0, &MainView); // little space
|
||||
MainView.VSplitLeft(ButtonWidth, &Button, &MainView);
|
||||
static int s_JoinButton = 0;
|
||||
if(DoButton_Menu(&s_JoinButton, Localize("Join"), 0, &Button) || m_EnterPressed)
|
||||
if(DoButton_Menu(&s_JoinButton, Localize("Connect"), 0, &Button) || m_EnterPressed)
|
||||
{
|
||||
Client()->Connect(g_Config.m_UiServerAddress);
|
||||
m_EnterPressed = false;
|
||||
}
|
||||
|
||||
// address info
|
||||
/*MainView.HSplitTop(20.0f, &Button, &MainView);
|
||||
Button.VSplitLeft(10.0f, 0, &Button);
|
||||
UI()->DoLabelScaled(&Button, Localize("Host address"), 14.0f, -1);
|
||||
MainView.HSplitTop(20.0f, &Button, &MainView);
|
||||
static float Offset = 0.0f;
|
||||
DoEditBox(&g_Config.m_UiServerAddress, &Button, g_Config.m_UiServerAddress, sizeof(g_Config.m_UiServerAddress), 14.0f, &Offset);*/
|
||||
}
|
||||
|
||||
void CMenus::RenderServerbrowser(CUIRect MainView)
|
||||
|
@ -1317,7 +1431,7 @@ void CMenus::RenderServerbrowser(CUIRect MainView)
|
|||
CUIRect ServerList, ToolBox, BottomBox;
|
||||
|
||||
MainView.HSplitTop(20.0f, 0, &MainView);
|
||||
MainView.HSplitTop(MainView.h/2.0f, &ServerList, &MainView);
|
||||
MainView.HSplitBottom(80.0f, &ServerList, &MainView);
|
||||
|
||||
|
||||
// server list
|
||||
|
|
|
@ -29,23 +29,6 @@ int CMenus::DoButton_DemoPlayer(const void *pID, const char *pText, const CUIRec
|
|||
return UI()->DoButtonLogic(pID, pText, false, pRect);
|
||||
}
|
||||
|
||||
int CMenus::DoButton_Sprite(const void *pID, int ImageID, int SpriteID, const CUIRect *pRect, int Corners)
|
||||
{
|
||||
float Seconds = 0.6f; // 0.6 seconds for fade
|
||||
float *pFade = ButtonFade(pID, Seconds);
|
||||
|
||||
RenderTools()->DrawUIRect(pRect, vec4(1.0f, 1.0f, 1.0f, 0.5f+(*pFade/Seconds)*0.25f), Corners, 5.0f);
|
||||
Graphics()->TextureSet(g_pData->m_aImages[ImageID].m_Id);
|
||||
Graphics()->QuadsBegin();
|
||||
Graphics()->SetColor(1.0f, 1.0f, 1.0f, 0.5f);
|
||||
RenderTools()->SelectSprite(SpriteID);
|
||||
IGraphics::CQuadItem QuadItem(pRect->x, pRect->y, pRect->w, pRect->h);
|
||||
Graphics()->QuadsDrawTL(&QuadItem, 1);
|
||||
Graphics()->QuadsEnd();
|
||||
|
||||
return UI()->DoButtonLogic(pID, "", false, pRect);
|
||||
}
|
||||
|
||||
void CMenus::RenderDemoPlayer(CUIRect MainView)
|
||||
{
|
||||
const IDemoPlayer::CInfo *pInfo = DemoPlayer()->BaseInfo();
|
||||
|
@ -169,12 +152,12 @@ void CMenus::RenderDemoPlayer(CUIRect MainView)
|
|||
static int s_PlayPauseButton = 0;
|
||||
if(!pInfo->m_Paused)
|
||||
{
|
||||
if(DoButton_Sprite(&s_PlayPauseButton, IMAGE_DEMOBUTTONS, SPRITE_DEMOBUTTON_PAUSE, &Button, CUI::CORNER_ALL))
|
||||
if(DoButton_SpriteID(&s_PlayPauseButton, IMAGE_DEMOBUTTONS, SPRITE_DEMOBUTTON_PAUSE, &Button, CUI::CORNER_ALL))
|
||||
DemoPlayer()->Pause();
|
||||
}
|
||||
else
|
||||
{
|
||||
if(DoButton_Sprite(&s_PlayPauseButton, IMAGE_DEMOBUTTONS, SPRITE_DEMOBUTTON_PLAY, &Button, CUI::CORNER_ALL))
|
||||
if(DoButton_SpriteID(&s_PlayPauseButton, IMAGE_DEMOBUTTONS, SPRITE_DEMOBUTTON_PLAY, &Button, CUI::CORNER_ALL))
|
||||
DemoPlayer()->Unpause();
|
||||
}
|
||||
|
||||
|
@ -183,7 +166,7 @@ void CMenus::RenderDemoPlayer(CUIRect MainView)
|
|||
ButtonBar.VSplitLeft(Margins, 0, &ButtonBar);
|
||||
ButtonBar.VSplitLeft(ButtonbarHeight, &Button, &ButtonBar);
|
||||
static int s_ResetButton = 0;
|
||||
if(DoButton_Sprite(&s_ResetButton, IMAGE_DEMOBUTTONS, SPRITE_DEMOBUTTON_STOP, &Button, CUI::CORNER_ALL))
|
||||
if(DoButton_SpriteID(&s_ResetButton, IMAGE_DEMOBUTTONS, SPRITE_DEMOBUTTON_STOP, &Button, CUI::CORNER_ALL))
|
||||
{
|
||||
m_pClient->OnReset();
|
||||
DemoPlayer()->Pause();
|
||||
|
@ -194,14 +177,14 @@ void CMenus::RenderDemoPlayer(CUIRect MainView)
|
|||
ButtonBar.VSplitLeft(Margins, 0, &ButtonBar);
|
||||
ButtonBar.VSplitLeft(ButtonbarHeight, &Button, &ButtonBar);
|
||||
static int s_SlowDownButton = 0;
|
||||
if(DoButton_Sprite(&s_SlowDownButton, IMAGE_DEMOBUTTONS, SPRITE_DEMOBUTTON_SLOWER, &Button, CUI::CORNER_ALL) || Input()->KeyPresses(KEY_MOUSE_WHEEL_DOWN))
|
||||
if(DoButton_SpriteID(&s_SlowDownButton, IMAGE_DEMOBUTTONS, SPRITE_DEMOBUTTON_SLOWER, &Button, CUI::CORNER_ALL) || Input()->KeyPresses(KEY_MOUSE_WHEEL_DOWN))
|
||||
DecreaseDemoSpeed = true;
|
||||
|
||||
// fastforward
|
||||
ButtonBar.VSplitLeft(Margins, 0, &ButtonBar);
|
||||
ButtonBar.VSplitLeft(ButtonbarHeight, &Button, &ButtonBar);
|
||||
static int s_FastForwardButton = 0;
|
||||
if(DoButton_Sprite(&s_FastForwardButton, IMAGE_DEMOBUTTONS, SPRITE_DEMOBUTTON_FASTER, &Button, CUI::CORNER_ALL))
|
||||
if(DoButton_SpriteID(&s_FastForwardButton, IMAGE_DEMOBUTTONS, SPRITE_DEMOBUTTON_FASTER, &Button, CUI::CORNER_ALL))
|
||||
IncreaseDemoSpeed = true;
|
||||
|
||||
// speed meter
|
||||
|
@ -358,7 +341,7 @@ void CMenus::RenderDemoList(CUIRect MainView)
|
|||
Item.m_Rect.VSplitLeft(5.0f, 0, &Item.m_Rect);
|
||||
FileIcon.Margin(3.0f, &FileIcon);
|
||||
FileIcon.x += 3.0f;
|
||||
DoButton_Icon(IMAGE_FILEICONS, r.front().m_IsDir?SPRITE_FILE_FOLDER:SPRITE_FILE_DEMO1, &FileIcon);
|
||||
DoIcon(IMAGE_FILEICONS, r.front().m_IsDir?SPRITE_FILE_FOLDER:SPRITE_FILE_DEMO1, &FileIcon);
|
||||
if(!str_comp(m_lDemos[m_DemolistSelectedIndex].m_aName, r.front().m_aName))
|
||||
{
|
||||
TextRender()->TextColor(0.0f, 0.0f, 0.0f, 1.0f);
|
||||
|
|
|
@ -24,85 +24,88 @@
|
|||
|
||||
void CMenus::RenderGame(CUIRect MainView)
|
||||
{
|
||||
CUIRect Button, ButtonBar;
|
||||
MainView.HSplitTop(45.0f, &ButtonBar, &MainView);
|
||||
RenderTools()->DrawUIRect(&ButtonBar, vec4(0.0f, 0.0f, 0.0f, 0.25f), CUI::CORNER_ALL, 10.0f);
|
||||
CUIRect Button, BottomView, Left, Middle, Right;
|
||||
|
||||
// button bar
|
||||
ButtonBar.HSplitTop(10.0f, 0, &ButtonBar);
|
||||
ButtonBar.HSplitTop(25.0f, &ButtonBar, 0);
|
||||
ButtonBar.VMargin(10.0f, &ButtonBar);
|
||||
// cut view
|
||||
MainView.HSplitBottom(80.0f, &MainView, &BottomView); // MainView not used for now
|
||||
BottomView.HSplitTop(20.f, 0, &BottomView);
|
||||
|
||||
ButtonBar.VSplitRight(120.0f, &ButtonBar, &Button);
|
||||
static int s_DisconnectButton = 0;
|
||||
if(DoButton_Menu(&s_DisconnectButton, Localize("Disconnect"), 0, &Button))
|
||||
Client()->Disconnect();
|
||||
float Spacing = 3.0f;
|
||||
float ButtonWidth = (BottomView.w/6.0f)-(Spacing*5.0)/6.0f;
|
||||
|
||||
if(m_pClient->m_aClients[m_pClient->m_LocalClientID].m_Team != TEAM_SPECTATORS)
|
||||
BottomView.VSplitLeft(ButtonWidth*3.0f+Spacing*2.0f, &Left, &Middle);
|
||||
Middle.VSplitLeft(Spacing, 0, &Middle);
|
||||
Middle.VSplitLeft(ButtonWidth, &Middle, &Right);
|
||||
Right.VSplitRight(ButtonWidth, 0, &Right);
|
||||
if(!(m_pClient->m_GameInfo.m_GameFlags&GAMEFLAG_TEAMS))
|
||||
Left.VSplitLeft(ButtonWidth, &Left, 0);
|
||||
|
||||
// do backgrounds
|
||||
RenderTools()->DrawUIRect4(&Left, vec4(0.0f, 0.0f, 0.0f, 0.25f), vec4(0.0f, 0.0f, 0.0f, 0.25f), vec4(0.0f, 0.0f, 0.0f, 0.0f), vec4(0.0f, 0.0f, 0.0f, 0.0f), CUI::CORNER_T, 5.0f);
|
||||
RenderTools()->DrawUIRect4(&Middle, vec4(0.0f, 0.0f, 0.0f, 0.25f), vec4(0.0f, 0.0f, 0.0f, 0.25f), vec4(0.0f, 0.0f, 0.0f, 0.0f), vec4(0.0f, 0.0f, 0.0f, 0.0f), CUI::CORNER_T, 5.0f);
|
||||
RenderTools()->DrawUIRect4(&Right, vec4(0.0f, 0.0f, 0.0f, 0.25f), vec4(0.0f, 0.0f, 0.0f, 0.25f), vec4(0.0f, 0.0f, 0.0f, 0.0f), vec4(0.0f, 0.0f, 0.0f, 0.0f), CUI::CORNER_T, 5.0f);
|
||||
|
||||
// do buttons
|
||||
Left.HSplitTop(25.0f, &Left, 0);
|
||||
Middle.HSplitTop(25.0f, &Middle, 0);
|
||||
Right.HSplitTop(25.0f, &Right, 0);
|
||||
|
||||
// join buttons
|
||||
int Team = m_pClient->m_aClients[m_pClient->m_LocalClientID].m_Team;
|
||||
Left.VSplitLeft(ButtonWidth, &Button, &Left);
|
||||
Left.VSplitLeft(Spacing, 0, &Left);
|
||||
static int s_SpectateButton = 0;
|
||||
if(DoButton_Menu(&s_SpectateButton, Localize(Team != TEAM_SPECTATORS ? "Spectate" : "Spactating"), Team == TEAM_SPECTATORS, &Button) && Team != TEAM_SPECTATORS)
|
||||
{
|
||||
ButtonBar.VSplitLeft(10.0f, 0, &ButtonBar);
|
||||
ButtonBar.VSplitLeft(120.0f, &Button, &ButtonBar);
|
||||
static int s_SpectateButton = 0;
|
||||
if(DoButton_Menu(&s_SpectateButton, Localize("Spectate"), 0, &Button))
|
||||
{
|
||||
m_pClient->SendSwitchTeam(TEAM_SPECTATORS);
|
||||
SetActive(false);
|
||||
}
|
||||
m_pClient->SendSwitchTeam(TEAM_SPECTATORS);
|
||||
SetActive(false);
|
||||
}
|
||||
|
||||
if(m_pClient->m_GameInfo.m_GameFlags&GAMEFLAG_TEAMS)
|
||||
{
|
||||
if(m_pClient->m_aClients[m_pClient->m_LocalClientID].m_Team != TEAM_RED)
|
||||
Left.VSplitLeft(ButtonWidth, &Button, &Left);
|
||||
Left.VSplitLeft(Spacing, 0, &Left);
|
||||
static int s_RedButton = 0;
|
||||
if(DoButton_Menu(&s_RedButton, Localize(Team != TEAM_RED ? "Join red" : "Joined red"), Team == TEAM_RED, &Button, CUI::CORNER_ALL, 5.0f, 0.0f, vec4(0.975f, 0.17f, 0.17f, 0.75f), false) && Team != TEAM_RED)
|
||||
{
|
||||
ButtonBar.VSplitLeft(10.0f, 0, &ButtonBar);
|
||||
ButtonBar.VSplitLeft(120.0f, &Button, &ButtonBar);
|
||||
static int s_SpectateButton = 0;
|
||||
if(DoButton_Menu(&s_SpectateButton, Localize("Join red"), 0, &Button))
|
||||
{
|
||||
m_pClient->SendSwitchTeam(TEAM_RED);
|
||||
SetActive(false);
|
||||
}
|
||||
m_pClient->SendSwitchTeam(TEAM_RED);
|
||||
SetActive(false);
|
||||
}
|
||||
|
||||
if(m_pClient->m_aClients[m_pClient->m_LocalClientID].m_Team != TEAM_BLUE)
|
||||
Left.VSplitLeft(ButtonWidth, &Button, &Left);
|
||||
static int s_BlueButton = 0;
|
||||
if(DoButton_Menu(&s_BlueButton, Localize(Team != TEAM_BLUE ? "Join blue" : "Joined blue"), Team == TEAM_BLUE, &Button, CUI::CORNER_ALL, 5.0f, 0.0f, vec4(0.17f, 0.46f, 0.975f, 0.75f), false) && Team != TEAM_BLUE)
|
||||
{
|
||||
ButtonBar.VSplitLeft(10.0f, 0, &ButtonBar);
|
||||
ButtonBar.VSplitLeft(120.0f, &Button, &ButtonBar);
|
||||
static int s_SpectateButton = 0;
|
||||
if(DoButton_Menu(&s_SpectateButton, Localize("Join blue"), 0, &Button))
|
||||
{
|
||||
m_pClient->SendSwitchTeam(TEAM_BLUE);
|
||||
SetActive(false);
|
||||
}
|
||||
m_pClient->SendSwitchTeam(TEAM_BLUE);
|
||||
SetActive(false);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(m_pClient->m_aClients[m_pClient->m_LocalClientID].m_Team != 0)
|
||||
Left.VSplitLeft(ButtonWidth, &Button, &Left);
|
||||
static int s_JoinButton = 0;
|
||||
if(DoButton_Menu(&s_JoinButton, Localize(Team != TEAM_RED ? "Join" : "Joined"), Team == TEAM_RED, &Button) && Team != TEAM_RED)
|
||||
{
|
||||
ButtonBar.VSplitLeft(10.0f, 0, &ButtonBar);
|
||||
ButtonBar.VSplitLeft(120.0f, &Button, &ButtonBar);
|
||||
static int s_SpectateButton = 0;
|
||||
if(DoButton_Menu(&s_SpectateButton, Localize("Join game"), 0, &Button))
|
||||
{
|
||||
m_pClient->SendSwitchTeam(0);
|
||||
SetActive(false);
|
||||
}
|
||||
m_pClient->SendSwitchTeam(0);
|
||||
SetActive(false);
|
||||
}
|
||||
}
|
||||
|
||||
ButtonBar.VSplitLeft(100.0f, 0, &ButtonBar);
|
||||
ButtonBar.VSplitLeft(150.0f, &Button, &ButtonBar);
|
||||
|
||||
// Record button
|
||||
static int s_DemoButton = 0;
|
||||
bool Recording = DemoRecorder()->IsRecording();
|
||||
if(DoButton_Menu(&s_DemoButton, Localize(Recording ? "Stop record" : "Record demo"), 0, &Button)) // Localize("Stop record");Localize("Record demo");
|
||||
if(DoButton_Menu(&s_DemoButton, Localize(Recording ? "Stop record" : "Record"), Recording, &Middle))
|
||||
{
|
||||
if(!Recording)
|
||||
Client()->DemoRecorder_Start("demo", true);
|
||||
else
|
||||
Client()->DemoRecorder_Stop();
|
||||
}
|
||||
|
||||
// disconnect button
|
||||
static int s_DisconnectButton = 0;
|
||||
if(DoButton_Menu(&s_DisconnectButton, Localize("Disconnect"), 0, &Right))
|
||||
Client()->Disconnect();
|
||||
}
|
||||
|
||||
void CMenus::RenderPlayers(CUIRect MainView)
|
||||
|
|
|
@ -60,7 +60,7 @@ MACRO_CONFIG_STR(PlayerSkinFeet, player_skin_feet, 24, "standard", CFGFLAG_CLIEN
|
|||
MACRO_CONFIG_STR(PlayerSkinEyes, player_skin_eyes, 24, "standard", CFGFLAG_CLIENT|CFGFLAG_SAVE, "Player skin eyes")
|
||||
|
||||
//MACRO_CONFIG_INT(UiPage, ui_page, 6, 0, 10, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Interface page")
|
||||
MACRO_CONFIG_INT(UiBrowserPage, ui_browser_page, 6, 6, 8, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Interface serverbrowser page")
|
||||
MACRO_CONFIG_INT(UiBrowserPage, ui_browser_page, 5, 5, 8, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Interface serverbrowser page")
|
||||
MACRO_CONFIG_INT(UiSettingsPage, ui_settings_page, 0, 0, 5, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Interface settings page")
|
||||
//MACRO_CONFIG_INT(UiToolboxPage, ui_toolbox_page, 0, 0, 2, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Toolbox page")
|
||||
MACRO_CONFIG_STR(UiServerAddress, ui_server_address, 64, "localhost:8303", CFGFLAG_CLIENT|CFGFLAG_SAVE, "Interface server address")
|
||||
|
|
Loading…
Reference in a new issue