Skip to content

Commit

Permalink
demo list top bar
Browse files Browse the repository at this point in the history
  • Loading branch information
BenLubar committed Jul 22, 2023
1 parent 05c5b2e commit 61caeba
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 1 deletion.
10 changes: 10 additions & 0 deletions reactivedrop/resource/ui/basemodui/demos.res
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,21 @@
"ypos" "0"
"wide" "f0"
"tall" "f0"
"navUp" "GplRecordingList"
"navDown" "GplRecordingList"
"autoResize" "0"
"pinCorner" "0"
"visible" "1"
"enabled" "1"
"tabPosition" "0"
}

"TopBar" {
"ControlName" "CRD_VGUI_Main_Menu_Top_Bar"
"fieldName" "TopBar"
"navDown" "GplRecordingList"
}

"Title" {
"fieldName" "Title"
"xpos" "c-266"
Expand All @@ -36,6 +44,8 @@
"wide" "450"
"tall" "270"
"zpos" "1"
"navUp" "TopBar"
"navDown" "DrpAutoRecord"
"tabPosition" "1"
"NoDrawPanel" "1"
}
Expand Down
16 changes: 16 additions & 0 deletions src/game/client/swarm/gameui/swarm/vdemos.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,15 @@
#include "vgui/ISurface.h"
#include "vgui_controls/ImagePanel.h"
#include "filesystem.h"
#include "rd_vgui_main_menu_top_bar.h"

// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"

using namespace BaseModUI;

extern ConVar rd_auto_record_lobbies;
extern ConVar rd_legacy_ui;

class DemoInfoPanel final : public vgui::EditablePanel, public IGenericPanelListItem
{
Expand Down Expand Up @@ -235,6 +237,9 @@ Demos::Demos( vgui::Panel *parent, const char *panelName ) :
m_pHeaderFooter->SetGradientBarEnabled( true );
m_pHeaderFooter->SetGradientBarPos( 75, 350 );

m_pTopBar = new CRD_VGUI_Main_Menu_Top_Bar( this, "TopBar" );
m_pTopBar->m_hActiveButton = m_pTopBar->m_pTopButton[CRD_VGUI_Main_Menu_Top_Bar::BTN_RECORDINGS];

m_LblNoRecordings = new vgui::Label( this, "LblNoRecordings", "#rd_demo_list_empty" );

m_GplRecordingList = new GenericPanelList( this, "GplRecordingList", GenericPanelList::ISM_PERITEM );
Expand Down Expand Up @@ -514,6 +519,17 @@ void Demos::ApplySchemeSettings( vgui::IScheme *pScheme )
{
BaseClass::ApplySchemeSettings( pScheme );
SetupAsDialogStyle();

if ( rd_legacy_ui.GetString()[0] == '\0' )
{
m_pTopBar->SetVisible( true );
m_BtnCancel->SetVisible( false );
}
else
{
m_pTopBar->SetVisible( false );
m_BtnCancel->SetVisible( true );
}
}

void Demos::PerformLayout()
Expand Down
2 changes: 2 additions & 0 deletions src/game/client/swarm/gameui/swarm/vdemos.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

class CNB_Button;
class CNB_Header_Footer;
class CRD_VGUI_Main_Menu_Top_Bar;

namespace BaseModUI
{
Expand All @@ -27,6 +28,7 @@ class Demos : public CBaseModFrame
void PerformLayout() override;

CNB_Header_Footer *m_pHeaderFooter;
CRD_VGUI_Main_Menu_Top_Bar *m_pTopBar;
vgui::Label *m_LblNoRecordings;
GenericPanelList *m_GplRecordingList;
DropDownMenu *m_DrpAutoRecord;
Expand Down
2 changes: 1 addition & 1 deletion src/game/client/swarm/gameui/swarm/vloadouts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ Loadouts::Loadouts( Panel *parent, const char *panelName )
m_pHeaderFooter->SetHeaderEnabled( false );
m_pHeaderFooter->SetFooterEnabled( false );
m_pTopBar = new CRD_VGUI_Main_Menu_Top_Bar( this, "TopBar" );
m_pTopBar->m_hActiveButton = m_pTopBar->m_pTopButton[0];
m_pTopBar->m_hActiveButton = m_pTopBar->m_pTopButton[CRD_VGUI_Main_Menu_Top_Bar::BTN_LOADOUTS];

ReactiveDropLoadout::InitLoadouts();

Expand Down

0 comments on commit 61caeba

Please sign in to comment.