Skip to content

Commit

Permalink
Merge pull request ddnet#9078 from ChillerDragon/pr_browser_arrow_lef…
Browse files Browse the repository at this point in the history
…t_right

Arrow left and right in browser (internet/lan/favorites)
  • Loading branch information
Robyt3 authored Sep 30, 2024
2 parents 74160b0 + 2b0fb83 commit 7abeaf5
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/game/client/components/menus.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -660,6 +660,27 @@ void CMenus::RenderMenubar(CUIRect Box, IClient::EClientState ClientState)
}
GameClient()->m_Tooltips.DoToolTip(&s_FavoritesButton, &Button, Localize("Favorites"));

int MaxPage = PAGE_FAVORITES + ServerBrowser()->FavoriteCommunities().size();
if(
!Ui()->IsPopupOpen() &&
CLineInput::GetActiveInput() == nullptr &&
(g_Config.m_UiPage >= PAGE_INTERNET && g_Config.m_UiPage <= MaxPage) &&
(m_MenuPage >= PAGE_INTERNET && m_MenuPage <= PAGE_FAVORITE_COMMUNITY_5))
{
if(Input()->KeyPress(KEY_RIGHT))
{
NewPage = g_Config.m_UiPage + 1;
if(NewPage > MaxPage)
NewPage = PAGE_INTERNET;
}
if(Input()->KeyPress(KEY_LEFT))
{
NewPage = g_Config.m_UiPage - 1;
if(NewPage < PAGE_INTERNET)
NewPage = MaxPage;
}
}

size_t FavoriteCommunityIndex = 0;
static CButtonContainer s_aFavoriteCommunityButtons[5];
static_assert(std::size(s_aFavoriteCommunityButtons) == (size_t)PAGE_FAVORITE_COMMUNITY_5 - PAGE_FAVORITE_COMMUNITY_1 + 1);
Expand Down

0 comments on commit 7abeaf5

Please sign in to comment.