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.

187 lines
4.5 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================//
  7. #ifndef CL_DEMOUIPANEL_H
  8. #define CL_DEMOUIPANEL_H
  9. #ifdef _WIN32
  10. #pragma once
  11. #endif
  12. #include <vgui_controls/Frame.h>
  13. namespace vgui
  14. {
  15. class Button;
  16. class CheckButton;
  17. class Label;
  18. class ProgressBar;
  19. class FileOpenDialog;
  20. class Slider;
  21. };
  22. class CDemoEditorPanel;
  23. class CDemoSmootherPanel;
  24. //-----------------------------------------------------------------------------
  25. // Purpose:
  26. //-----------------------------------------------------------------------------
  27. class CDemoUIPanel : public vgui::Frame
  28. {
  29. DECLARE_CLASS_SIMPLE( CDemoUIPanel, vgui::Frame );
  30. public:
  31. CDemoUIPanel( vgui::Panel *parent );
  32. ~CDemoUIPanel();
  33. virtual void OnTick();
  34. // Command issued
  35. virtual void OnCommand(const char *command);
  36. virtual void OnMessage(const KeyValues *params, vgui::VPANEL fromPanel);
  37. virtual void OnVDMChanged( void );
  38. virtual bool OverrideView( democmdinfo_t& info, int frame );
  39. virtual void DrawDebuggingInfo();
  40. static void InstallDemoUI( vgui::Panel *parent );
  41. bool IsInDriveMode();
  42. void SetDriveViewPoint( Vector &origin, QAngle &angle );
  43. void GetDriveViewPoint( Vector &origin, QAngle &angle );
  44. protected:
  45. void HandleInput( bool active );
  46. bool IsHoldingFastForward();
  47. void SetPlaybackScale( float scale );
  48. float GetPlaybackScale();
  49. void GetCurrentView();
  50. MESSAGE_FUNC_CHARPTR( OnFileSelected, "FileSelected", fullpath );
  51. void OnEdit();
  52. void OnSmooth();
  53. void OnLoad();
  54. vgui::Label *m_pCurrentDemo;
  55. vgui::Button *m_pStop;
  56. vgui::Button *m_pLoad;
  57. // special editor buttons
  58. vgui::Button *m_pEdit;
  59. vgui::Button *m_pSmooth;
  60. vgui::Button *m_pDriveCamera;
  61. // player controls
  62. vgui::Button *m_pPlayPauseResume;
  63. vgui::Button *m_pGoStart;
  64. vgui::Button *m_pGoEnd;
  65. vgui::Button *m_pFastForward;
  66. vgui::Button *m_pFastBackward;
  67. vgui::Button *m_pPrevFrame;
  68. vgui::Button *m_pNextFrame;
  69. vgui::ProgressBar *m_pProgress;
  70. vgui::Label *m_pProgressLabelFrame;
  71. vgui::Label *m_pProgressLabelTime;
  72. vgui::Slider *m_pSpeedScale;
  73. vgui::Label *m_pSpeedScaleLabel;
  74. vgui::DHANDLE< CDemoEditorPanel > m_hDemoEditor;
  75. vgui::DHANDLE< CDemoSmootherPanel > m_hDemoSmoother;
  76. vgui::DHANDLE< vgui::FileOpenDialog > m_hFileOpenDialog;
  77. vgui::Button *m_pGo;
  78. vgui::TextEntry *m_pGotoTick;
  79. bool m_bInputActive;
  80. int m_nOldCursor[2];
  81. Vector m_ViewOrigin;
  82. QAngle m_ViewAngles;
  83. };
  84. extern CDemoUIPanel *g_pDemoUI;
  85. //-----------------------------------------------------------------------------
  86. // Purpose: a special demo UI panel that is always visible allowing you
  87. // to interact with the game and adding more features to the old
  88. // demo UI panel.
  89. //-----------------------------------------------------------------------------
  90. class CDemoUIPanel2 : public vgui::Frame
  91. {
  92. DECLARE_CLASS_SIMPLE( CDemoUIPanel2, vgui::Frame );
  93. public:
  94. CDemoUIPanel2( vgui::Panel *pParentBkgnd, vgui::Panel *pParentFgnd, bool bPutToForeground );
  95. ~CDemoUIPanel2();
  96. virtual void OnTick();
  97. // Command issued
  98. virtual void OnCommand(const char *command);
  99. virtual void OnMessage(const KeyValues *params, vgui::VPANEL fromPanel);
  100. virtual void OnVDMChanged( void );
  101. virtual bool OverrideView( democmdinfo_t& info, int frame );
  102. virtual void DrawDebuggingInfo();
  103. static void Install( vgui::Panel *pParentBkgnd, vgui::Panel *pParentFgnd, bool bPutToForeground );
  104. bool IsInDriveMode();
  105. void SetDriveViewPoint( Vector &origin, QAngle &angle );
  106. void GetDriveViewPoint( Vector &origin, QAngle &angle );
  107. void MakePanelForeground( bool bPutToForeground );
  108. protected:
  109. void HandleInput( bool active );
  110. bool IsHoldingFastForward();
  111. void SetPlaybackScale( float scale );
  112. float GetPlaybackScale();
  113. MESSAGE_FUNC_CHARPTR( OnFileSelected, "FileSelected", fullpath );
  114. void OnLoad();
  115. vgui::Button *m_pStop;
  116. vgui::Button *m_pLoad;
  117. // player controls
  118. vgui::Button *m_pPlayPauseResume;
  119. vgui::Button *m_pGoStart;
  120. vgui::Button *m_pGoEnd;
  121. vgui::Button *m_pFastForward;
  122. vgui::Button *m_pFastBackward;
  123. vgui::Button *m_pPrevFrame;
  124. vgui::Button *m_pNextFrame;
  125. vgui::Slider *m_pProgress;
  126. vgui::Label *m_pProgressLabelFrame;
  127. vgui::Label *m_pProgressLabelTime;
  128. vgui::Slider *m_pSpeedScale;
  129. vgui::Label *m_pSpeedScaleLabel;
  130. vgui::DHANDLE< vgui::FileOpenDialog > m_hFileOpenDialog;
  131. bool m_bInputActive;
  132. int m_nOldCursor[2];
  133. // Bkgnd-fgnd switch
  134. vgui::Panel *m_arrParents[2];
  135. bool m_bIsInForeground;
  136. };
  137. extern CDemoUIPanel2 *g_pDemoUI2;
  138. #endif // CL_DEMOUIPANEL_H