mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-19 14:38:18 +00:00
just extend one filter in the server browser
This commit is contained in:
parent
4b60022268
commit
e268371fae
|
@ -2256,6 +2256,8 @@ void CMenus::OnConsoleInit()
|
||||||
m_lFilters.add(CBrowserFilter(CBrowserFilter::FILTER_STANDARD, Localize("Teeworlds"), ServerBrowser(), IServerBrowser::FILTER_COMPAT_VERSION|IServerBrowser::FILTER_PURE|IServerBrowser::FILTER_PURE_MAP|IServerBrowser::FILTER_PING, 999, -1, "", ""));
|
m_lFilters.add(CBrowserFilter(CBrowserFilter::FILTER_STANDARD, Localize("Teeworlds"), ServerBrowser(), IServerBrowser::FILTER_COMPAT_VERSION|IServerBrowser::FILTER_PURE|IServerBrowser::FILTER_PURE_MAP|IServerBrowser::FILTER_PING, 999, -1, "", ""));
|
||||||
m_lFilters.add(CBrowserFilter(CBrowserFilter::FILTER_FAVORITES, Localize("Favorites"), ServerBrowser(), IServerBrowser::FILTER_FAVORITE|IServerBrowser::FILTER_PING, 999, -1, "", ""));
|
m_lFilters.add(CBrowserFilter(CBrowserFilter::FILTER_FAVORITES, Localize("Favorites"), ServerBrowser(), IServerBrowser::FILTER_FAVORITE|IServerBrowser::FILTER_PING, 999, -1, "", ""));
|
||||||
m_lFilters.add(CBrowserFilter(CBrowserFilter::FILTER_ALL, Localize("All"), ServerBrowser(), IServerBrowser::FILTER_PING, 999, -1, "", ""));
|
m_lFilters.add(CBrowserFilter(CBrowserFilter::FILTER_ALL, Localize("All"), ServerBrowser(), IServerBrowser::FILTER_PING, 999, -1, "", ""));
|
||||||
|
|
||||||
|
m_lFilters[0].Switch();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMenus::OnStateChange(int NewState, int OldState)
|
void CMenus::OnStateChange(int NewState, int OldState)
|
||||||
|
|
|
@ -34,7 +34,7 @@ CMenus::CColumn CMenus::ms_aCols[] = {
|
||||||
CMenus::CBrowserFilter::CBrowserFilter(int Custom, const char* pName, IServerBrowser *pServerBrowser, int Filter, int Ping, int Country, const char* pGametype, const char* pServerAddress)
|
CMenus::CBrowserFilter::CBrowserFilter(int Custom, const char* pName, IServerBrowser *pServerBrowser, int Filter, int Ping, int Country, const char* pGametype, const char* pServerAddress)
|
||||||
: m_pServerBrowser(pServerBrowser)
|
: m_pServerBrowser(pServerBrowser)
|
||||||
{
|
{
|
||||||
m_Extended = true;
|
m_Extended = false;
|
||||||
m_Custom = Custom;
|
m_Custom = Custom;
|
||||||
str_copy(m_aName, pName, sizeof(m_aName));
|
str_copy(m_aName, pName, sizeof(m_aName));
|
||||||
//Todo: fix Filter
|
//Todo: fix Filter
|
||||||
|
@ -442,7 +442,19 @@ bool CMenus::RenderFilterHeader(CUIRect View, int FilterIndex)
|
||||||
View.VSplitLeft(20.0f, &Button, &View);
|
View.VSplitLeft(20.0f, &Button, &View);
|
||||||
Button.Margin(2.0f, &Button);
|
Button.Margin(2.0f, &Button);
|
||||||
if(DoButton_SpriteClean(IMAGE_MENUICONS, pFilter->Extended() ? SPRITE_MENU_EXPANDED : SPRITE_MENU_COLLAPSED, &Button))
|
if(DoButton_SpriteClean(IMAGE_MENUICONS, pFilter->Extended() ? SPRITE_MENU_EXPANDED : SPRITE_MENU_COLLAPSED, &Button))
|
||||||
|
{
|
||||||
pFilter->Switch();
|
pFilter->Switch();
|
||||||
|
|
||||||
|
// retract the other filters
|
||||||
|
if(pFilter->Extended())
|
||||||
|
{
|
||||||
|
for(int i = 0; i < m_lFilters.size(); ++i)
|
||||||
|
{
|
||||||
|
if(i != FilterIndex && m_lFilters[i].Extended())
|
||||||
|
m_lFilters[i].Switch();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// split buttons from label
|
// split buttons from label
|
||||||
View.VSplitLeft(Spacing, 0, &View);
|
View.VSplitLeft(Spacing, 0, &View);
|
||||||
|
|
Loading…
Reference in a new issue