· last year · Feb 08, 2024, 05:40 AM
1//=================================================================================================
2// Tools UI
3//=================================================================================================
4
5#pragma once
6
7//-------------------------------------------------------------------------------------------------
8// An engine tool
9// Inherit from this and register your tool to become available in the tools menu of the DevUI
10//-------------------------------------------------------------------------------------------------
11abstract_class IEngineTool
12{
13public:
14 // Initialise this tool, called once when the tool is first shown, and then never again for the engine's lifetime
15 virtual void Init() { m_bInitialised = true; }
16 // Shut down this tool, called at exit if the tool was ever initialised
17 virtual void Shutdown() { m_bInitialised = false; }
18
19 // Get the string that should appear in the tools menu for this tool
20 virtual const char *GetDisplayName() = 0;
21
22 // Show the UI for this tool
23 virtual void Show() = 0;
24
25 // Tools are stored in a singly linked list, this is the next tool in the list
26 IEngineTool *m_pNext;
27 // Whether the UI for this tool is active
28 bool m_bOpen;
29 // Whether this tool was initialised
30 bool m_bInitialised;
31
32};
33
34//-------------------------------------------------------------------------------------------------
35// Tools API
36//
37// Main interface to the tools, these functions should generally be pretty light, as the actual
38// init and ticking of tools is handled by the screen subsystem, this may seem a little odd,
39// and it is, and it may change if we need to tick tools when the screen api rejects them
40//-------------------------------------------------------------------------------------------------
41
42void Tools_Init();
43void Tools_Shutdown();
44
45// Singly linked list of all tools (sorted by display name by Tools_Init)
46extern IEngineTool *g_pEngineTools;
47
48//-------------------------------------------------------------------------------------------------
49// Tools mode
50//
51// This is a special state where the tools API absorbs all input.
52// Whilst in this mode, the user can hold right click on the DevUI background
53// to regain control of the game and issue mouse movements and keyboard input.
54// It's broken right now because I changed something in the input code related to vgui2
55// which prevents the cool right click thing from working.
56//-------------------------------------------------------------------------------------------------
57
58bool ToolsMode_IsActive();
59bool ToolsMode_WantsMouseVisible();
60bool ToolsMode_KeyEvent( int key, bool down, const char *pBindName );
61void ToolsMode_Activate();
62void ToolsMode_Deactivate();
63
64//-------------------------------------------------------------------------------------------------
65
66namespace AssetBrowser
67{
68 void Show( bool *pOpen );
69}
70
71namespace Probes::Editor
72{
73 void Show( bool *pOpen );
74}
75
76namespace Hulls::Editor
77{
78 void Show( bool *pOpen );
79}
80
81//-----------------------------------------------
82// Console
83//-----------------------------------------------
84void DevUI_AddNotify( const char *msg );
85void DevUI_ShowNotifyPanel( float offsetY );
86void DevUI_ClearNotify();
87
88//-----------------------------------------------
89// Net graph
90//-----------------------------------------------
91void SCR_NetGraph();
92void NET_InitColors();
93
94//-----------------------------------------------
95// Prop editor
96//-----------------------------------------------
97void DevUI_ShowPropEditor( bool *pOpen );
98
99//-----------------------------------------------
100// Stats
101//-----------------------------------------------
102void DevUI_ShowStatsPanel( float offsetY );
103