aboutsummaryrefslogtreecommitdiff
path: root/mp/src/game/client/game_controls/spectatorgui.h
diff options
context:
space:
mode:
authorJoe Ludwig <[email protected]>2013-06-26 15:22:04 -0700
committerJoe Ludwig <[email protected]>2013-06-26 15:22:04 -0700
commit39ed87570bdb2f86969d4be821c94b722dc71179 (patch)
treeabc53757f75f40c80278e87650ea92808274aa59 /mp/src/game/client/game_controls/spectatorgui.h
downloadsource-sdk-2013-39ed87570bdb2f86969d4be821c94b722dc71179.tar.xz
source-sdk-2013-39ed87570bdb2f86969d4be821c94b722dc71179.zip
First version of the SOurce SDK 2013
Diffstat (limited to 'mp/src/game/client/game_controls/spectatorgui.h')
-rw-r--r--mp/src/game/client/game_controls/spectatorgui.h154
1 files changed, 154 insertions, 0 deletions
diff --git a/mp/src/game/client/game_controls/spectatorgui.h b/mp/src/game/client/game_controls/spectatorgui.h
new file mode 100644
index 00000000..e8981973
--- /dev/null
+++ b/mp/src/game/client/game_controls/spectatorgui.h
@@ -0,0 +1,154 @@
+//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+// Purpose:
+//
+// $NoKeywords: $
+//=============================================================================//
+
+#ifndef SPECTATORGUI_H
+#define SPECTATORGUI_H
+#ifdef _WIN32
+#pragma once
+#endif
+
+#include <vgui/IScheme.h>
+#include <vgui/KeyCode.h>
+#include <vgui_controls/Frame.h>
+#include <vgui_controls/EditablePanel.h>
+#include <vgui_controls/Button.h>
+#include <vgui_controls/ComboBox.h>
+#include <igameevents.h>
+#include "GameEventListener.h"
+
+#include <game/client/iviewport.h>
+
+class KeyValues;
+
+namespace vgui
+{
+ class TextEntry;
+ class Button;
+ class Panel;
+ class ImagePanel;
+ class ComboBox;
+}
+
+#define BLACK_BAR_COLOR Color(0, 0, 0, 196)
+
+class IBaseFileSystem;
+
+//-----------------------------------------------------------------------------
+// Purpose: Spectator UI
+//-----------------------------------------------------------------------------
+class CSpectatorGUI : public vgui::EditablePanel, public IViewPortPanel
+{
+ DECLARE_CLASS_SIMPLE( CSpectatorGUI, vgui::EditablePanel );
+
+public:
+ CSpectatorGUI( IViewPort *pViewPort );
+ virtual ~CSpectatorGUI();
+
+ virtual const char *GetName( void ) { return PANEL_SPECGUI; }
+ virtual void SetData(KeyValues *data) {};
+ virtual void Reset() {};
+ virtual void Update();
+ virtual bool NeedsUpdate( void ) { return false; }
+ virtual bool HasInputElements( void ) { return false; }
+ virtual void ShowPanel( bool bShow );
+
+ // both vgui::Frame and IViewPortPanel define these, so explicitly define them here as passthroughs to vgui
+ vgui::VPANEL GetVPanel( void ) { return BaseClass::GetVPanel(); }
+ virtual bool IsVisible() { return BaseClass::IsVisible(); }
+ virtual void SetParent(vgui::VPANEL parent) { BaseClass::SetParent(parent); }
+ virtual void OnThink();
+
+ virtual int GetTopBarHeight() { return m_pTopBar->GetTall(); }
+ virtual int GetBottomBarHeight() { return m_pBottomBarBlank->GetTall(); }
+
+ virtual bool ShouldShowPlayerLabel( int specmode );
+
+ virtual Color GetBlackBarColor( void ) { return BLACK_BAR_COLOR; }
+
+ virtual const char *GetResFile( void ) { return "Resource/UI/Spectator.res"; }
+
+protected:
+
+ void SetLabelText(const char *textEntryName, const char *text);
+ void SetLabelText(const char *textEntryName, wchar_t *text);
+ void MoveLabelToFront(const char *textEntryName);
+ void UpdateTimer();
+ void SetLogoImage(const char *image);
+
+protected:
+ enum { INSET_OFFSET = 2 } ;
+
+ // vgui overrides
+ virtual void PerformLayout();
+ virtual void ApplySchemeSettings(vgui::IScheme *pScheme);
+// virtual void OnCommand( const char *command );
+
+ vgui::Panel *m_pTopBar;
+ vgui::Panel *m_pBottomBarBlank;
+
+ vgui::ImagePanel *m_pBannerImage;
+ vgui::Label *m_pPlayerLabel;
+
+ IViewPort *m_pViewPort;
+
+ // bool m_bHelpShown;
+ // bool m_bInsetVisible;
+ bool m_bSpecScoreboard;
+};
+
+
+//-----------------------------------------------------------------------------
+// Purpose: the bottom bar panel, this is a separate panel because it
+// wants mouse input and the main window doesn't
+//----------------------------------------------------------------------------
+class CSpectatorMenu : public vgui::Frame, public IViewPortPanel, public CGameEventListener
+{
+ DECLARE_CLASS_SIMPLE( CSpectatorMenu, vgui::Frame );
+
+public:
+ CSpectatorMenu( IViewPort *pViewPort );
+ ~CSpectatorMenu() {}
+
+ virtual const char *GetName( void ) { return PANEL_SPECMENU; }
+ virtual void SetData(KeyValues *data) {};
+ virtual void Reset( void ) { m_pPlayerList->DeleteAllItems(); }
+ virtual void Update( void );
+ virtual bool NeedsUpdate( void ) { return false; }
+ virtual bool HasInputElements( void ) { return true; }
+ virtual void ShowPanel( bool bShow );
+ virtual void FireGameEvent( IGameEvent *event );
+
+ // both vgui::Frame and IViewPortPanel define these, so explicitly define them here as passthroughs to vgui
+ virtual bool IsVisible() { return BaseClass::IsVisible(); }
+ vgui::VPANEL GetVPanel( void ) { return BaseClass::GetVPanel(); }
+ virtual void SetParent(vgui::VPANEL parent) { BaseClass::SetParent(parent); }
+
+private:
+ // VGUI2 overrides
+ MESSAGE_FUNC_PARAMS( OnTextChanged, "TextChanged", data );
+ virtual void OnCommand( const char *command );
+ virtual void OnKeyCodePressed(vgui::KeyCode code);
+ virtual void ApplySchemeSettings(vgui::IScheme *pScheme);
+ virtual void PerformLayout();
+
+ void SetViewModeText( const char *text ) { m_pViewOptions->SetText( text ); }
+ void SetPlayerFgColor( Color c1 ) { m_pPlayerList->SetFgColor(c1); }
+
+ vgui::ComboBox *m_pPlayerList;
+ vgui::ComboBox *m_pViewOptions;
+ vgui::ComboBox *m_pConfigSettings;
+
+ vgui::Button *m_pLeftButton;
+ vgui::Button *m_pRightButton;
+
+ IViewPort *m_pViewPort;
+ ButtonCode_t m_iDuckKey;
+};
+
+extern CSpectatorGUI * g_pSpectatorGUI;
+
+#endif // SPECTATORGUI_H