Team Fortress 2 Source Code as on 22/4/2020
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

85 lines
1.8 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose: Client DLL VGUI2 Viewport
  4. //
  5. // $Workfile: $
  6. // $Date: $
  7. //
  8. //-----------------------------------------------------------------------------
  9. // $Log: $
  10. //
  11. // $NoKeywords: $
  12. //=============================================================================//
  13. #include "cbase.h"
  14. #pragma warning( disable : 4800 ) // disable forcing int to bool performance warning
  15. // VGUI panel includes
  16. #include <vgui_controls/Panel.h>
  17. #include <vgui/ISurface.h>
  18. #include <KeyValues.h>
  19. #include <vgui/Cursor.h>
  20. #include <vgui/IScheme.h>
  21. #include <vgui/IVGui.h>
  22. #include <vgui/ILocalize.h>
  23. #include <vgui/VGUI.h>
  24. // client dll/engine defines
  25. #include "hud.h"
  26. #include <voice_status.h>
  27. // viewport definitions
  28. #include <baseviewport.h>
  29. #include "SDKViewport.h"
  30. #include "vguicenterprint.h"
  31. #include "text_message.h"
  32. void SDKViewport::ApplySchemeSettings( vgui::IScheme *pScheme )
  33. {
  34. BaseClass::ApplySchemeSettings( pScheme );
  35. gHUD.InitColors( pScheme );
  36. SetPaintBackgroundEnabled( false );
  37. }
  38. IViewPortPanel* SDKViewport::CreatePanelByName(const char *szPanelName)
  39. {
  40. IViewPortPanel* newpanel = NULL;
  41. // Up here, strcmp against each type of panel we know how to create.
  42. // else if ( Q_strcmp(PANEL_OVERVIEW, szPanelName) == 0 )
  43. // {
  44. // newpanel = new CCSMapOverview( this );
  45. // }
  46. // create a generic base panel, don't add twice
  47. newpanel = BaseClass::CreatePanelByName( szPanelName );
  48. return newpanel;
  49. }
  50. void SDKViewport::CreateDefaultPanels( void )
  51. {
  52. BaseClass::CreateDefaultPanels();
  53. }
  54. int SDKViewport::GetDeathMessageStartHeight( void )
  55. {
  56. int x = YRES(2);
  57. IViewPortPanel *spectator = gViewPortInterface->FindPanelByName( PANEL_SPECGUI );
  58. //TODO: Link to actual height of spectator bar
  59. if ( spectator && spectator->IsVisible() )
  60. {
  61. x += YRES(52);
  62. }
  63. return x;
  64. }