Skip to content

Commit

Permalink
Refactor server browser, cleanup layout
Browse files Browse the repository at this point in the history
  • Loading branch information
Robyt3 committed Sep 16, 2023
1 parent b4b9984 commit de4ae60
Show file tree
Hide file tree
Showing 3 changed files with 733 additions and 786 deletions.
2 changes: 2 additions & 0 deletions src/engine/textrender.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ MAYBE_UNUSED static const char *FONT_ICON_GEAR = "\xEF\x80\x93";
MAYBE_UNUSED static const char *FONT_ICON_PEN_TO_SQUARE = "\xEF\x81\x84";
MAYBE_UNUSED static const char *FONT_ICON_CLAPPERBOARD = "\xEE\x84\xB1";
MAYBE_UNUSED static const char *FONT_ICON_EARTH_AMERICAS = "\xEF\x95\xBD";
MAYBE_UNUSED static const char *FONT_ICON_LIST_UL = "\xEF\x83\x8A";
MAYBE_UNUSED static const char *FONT_ICON_INFO = "\xEF\x84\xA9";

MAYBE_UNUSED static const char *FONT_ICON_SLASH = "\xEF\x9C\x95";
MAYBE_UNUSED static const char *FONT_ICON_PLAY = "\xEF\x81\x8B";
Expand Down
23 changes: 19 additions & 4 deletions src/game/client/components/menus.h
Original file line number Diff line number Diff line change
Expand Up @@ -409,8 +409,6 @@ class CMenus : public CComponent
std::vector<CFriendItem> m_avFriends[NUM_FRIEND_TYPES];
const CFriendItem *m_pRemoveFriend = nullptr;

void FriendlistOnUpdate();

// found in menus.cpp
int Render();
#if defined(CONF_VIDEORECORDER)
Expand Down Expand Up @@ -454,23 +452,37 @@ class CMenus : public CComponent
// found in menus_browser.cpp
int m_SelectedIndex;
bool m_ServerBrowserShouldRevealSelection;
void RenderServerbrowserServerList(CUIRect View);
void RenderServerbrowserServerList(CUIRect View, bool &WasListboxItemActivated);
void RenderServerbrowserStatusBox(CUIRect StatusBox, bool WasListboxItemActivated);
void Connect(const char *pAddress);
void PopupConfirmSwitchServer();
void RenderServerbrowserServerDetail(CUIRect View);
void RenderServerbrowserFilters(CUIRect View);
void RenderServerbrowserDDNetFilter(CUIRect View,
char *pFilterExclude, int FilterExcludeSize,
float ItemHeight, int MaxItems, int ItemsPerRow,
CScrollRegion &ScrollRegion, std::vector<unsigned char> &vItemIds,
const std::function<const char *(int ItemIndex)> &GetItemName,
const std::function<void(int ItemIndex, CUIRect Item, const void *pItemId, bool Active)> &RenderItem);
void RenderServerbrowserCountriesFilter(CUIRect View, int Network);
void RenderServerbrowserTypesFilter(CUIRect View, int Network);
struct SPopupCountrySelectionContext
{
CMenus *m_pMenus;
int m_Selection;
bool m_New;
};
static CUI::EPopupMenuFunctionResult PopupCountrySelection(void *pContext, CUIRect View, bool Active);
void RenderServerbrowserInfo(CUIRect View);
void RenderServerbrowserInfoScoreboard(CUIRect View, const CServerInfo *pSelectedServer);
void RenderServerbrowserFriends(CUIRect View);
void FriendlistOnUpdate();
void PopupConfirmRemoveFriend();
void RenderServerbrowserTabBar(CUIRect TabBar);
void RenderServerbrowserToolBox(CUIRect ToolBox);
void RenderServerbrowser(CUIRect MainView);
template<typename F>
bool PrintHighlighted(const char *pName, F &&PrintFn);
CTeeRenderInfo GetTeeRenderInfo(vec2 Size, const char *pSkinName, bool CustomSkinColors, int CustomSkinColorBody, int CustomSkinColorFeet) const;
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);

Expand Down Expand Up @@ -583,6 +595,9 @@ class CMenus : public CComponent
SMALL_TAB_EDITOR,
SMALL_TAB_DEMOBUTTON,
SMALL_TAB_SERVER,
SMALL_TAB_BROWSER_FILTER,
SMALL_TAB_BROWSER_INFO,
SMALL_TAB_BROWSER_FRIENDS,

SMALL_TAB_LENGTH,
};
Expand Down
Loading

0 comments on commit de4ae60

Please sign in to comment.