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.

106 lines
3.0 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================//
  7. #include "cbase.h"
  8. #include "vgui_int.h"
  9. #include "ienginevgui.h"
  10. #include "vgui_rootpanel_sdk.h"
  11. #include "vgui/IVGui.h"
  12. // memdbgon must be the last include file in a .cpp file!!!
  13. #include "tier0/memdbgon.h"
  14. C_SDKRootPanel *g_pRootPanel = NULL;
  15. //-----------------------------------------------------------------------------
  16. // Global functions.
  17. //-----------------------------------------------------------------------------
  18. void VGUI_CreateClientDLLRootPanel( void )
  19. {
  20. g_pRootPanel = new C_SDKRootPanel( enginevgui->GetPanel( PANEL_CLIENTDLL ) );
  21. }
  22. void VGUI_DestroyClientDLLRootPanel( void )
  23. {
  24. delete g_pRootPanel;
  25. g_pRootPanel = NULL;
  26. }
  27. vgui::VPANEL VGui_GetClientDLLRootPanel( void )
  28. {
  29. return g_pRootPanel->GetVPanel();
  30. }
  31. //-----------------------------------------------------------------------------
  32. // C_SDKRootPanel implementation.
  33. //-----------------------------------------------------------------------------
  34. C_SDKRootPanel::C_SDKRootPanel( vgui::VPANEL parent )
  35. : BaseClass( NULL, "SDK Root Panel" )
  36. {
  37. SetParent( parent );
  38. SetPaintEnabled( false );
  39. SetPaintBorderEnabled( false );
  40. SetPaintBackgroundEnabled( false );
  41. // This panel does post child painting
  42. SetPostChildPaintEnabled( true );
  43. // Make it screen sized
  44. SetBounds( 0, 0, ScreenWidth(), ScreenHeight() );
  45. // Ask for OnTick messages
  46. vgui::ivgui()->AddTickSignal( GetVPanel() );
  47. }
  48. //-----------------------------------------------------------------------------
  49. // Purpose:
  50. //-----------------------------------------------------------------------------
  51. C_SDKRootPanel::~C_SDKRootPanel( void )
  52. {
  53. }
  54. //-----------------------------------------------------------------------------
  55. // Purpose:
  56. //-----------------------------------------------------------------------------
  57. void C_SDKRootPanel::PostChildPaint()
  58. {
  59. BaseClass::PostChildPaint();
  60. // Draw all panel effects
  61. RenderPanelEffects();
  62. }
  63. //-----------------------------------------------------------------------------
  64. // Purpose: For each panel effect, check if it wants to draw and draw it on
  65. // this panel/surface if so
  66. //-----------------------------------------------------------------------------
  67. void C_SDKRootPanel::RenderPanelEffects( void )
  68. {
  69. }
  70. //-----------------------------------------------------------------------------
  71. // Purpose:
  72. //-----------------------------------------------------------------------------
  73. void C_SDKRootPanel::OnTick( void )
  74. {
  75. }
  76. //-----------------------------------------------------------------------------
  77. // Purpose: Reset effects on level load/shutdown
  78. //-----------------------------------------------------------------------------
  79. void C_SDKRootPanel::LevelInit( void )
  80. {
  81. }
  82. //-----------------------------------------------------------------------------
  83. // Purpose:
  84. //-----------------------------------------------------------------------------
  85. void C_SDKRootPanel::LevelShutdown( void )
  86. {
  87. }