RootPanel: Difference between revisions
Jump to navigation
Jump to search
Tip:If you do need to access the RootPanel it is probably to draw an effect over the entire screen, VGUI elements included. Remember to
TomEdwards (talk | contribs) No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
{{confirm-box}} | {{confirm-box}} | ||
The '''RootPanel''' (strictly speaking the '''ClientDLLRootPanel''') is the | The '''RootPanel''' (strictly speaking the '''ClientDLLRootPanel''') is the where the client starts creating [[panel]]s for its in-game HUD. It in entirely separate from the [[GameUI]] panel used to draw the main menu. The first child is normally the active [[ClientMode]]. | ||
Most games will never need to access the RootPanel. If this is true for your project then you should return the engine-controlled <code>PANEL_CLIENTDLL</code> (the behaviour of the example below) instead of creating a new object. | Most games will never need to access the RootPanel. If this is true for your project then you should return the engine-controlled <code>PANEL_CLIENTDLL</code> (the behaviour of the example below) instead of creating a new object. | ||
{{tip|If you do need to access the RootPanel | {{tip|If you do need to access the RootPanel it is probably to draw an effect over the entire screen, VGUI elements included. Remember to <code>SetPostChildPaintEnabled(true)</code> if this is your intention.}} | ||
== Minimum implementation == | == Minimum implementation == | ||
Line 11: | Line 11: | ||
Conventionally in <code>vgui_rootpanel_<game>.cpp</code>: | Conventionally in <code>vgui_rootpanel_<game>.cpp</code>: | ||
<source lang=cpp>#include "cbase.h" | <source lang=cpp> | ||
#include "cbase.h" | |||
#include "ienginevgui.h" | #include "ienginevgui.h" | ||
Line 25: | Line 26: | ||
{ | { | ||
return enginevgui->GetPanel(PANEL_CLIENTDLL); | return enginevgui->GetPanel(PANEL_CLIENTDLL); | ||
}</source> | } | ||
</source> | |||
== See also == | == See also == | ||
Line 31: | Line 33: | ||
* <code>game\client\sdk\vgui\vgui_rootpanel_sdk.cpp</code> (for a game creating its own RootPanel) | * <code>game\client\sdk\vgui\vgui_rootpanel_sdk.cpp</code> (for a game creating its own RootPanel) | ||
* [[ClientMode]] | * [[ClientMode]] | ||
* [[GameUI]] | |||
* <code>[[VPANEL]]</code> | * <code>[[VPANEL]]</code> | ||
[[Category:VGUI]] | [[Category:VGUI]] |
Latest revision as of 12:48, 2 August 2011
The RootPanel (strictly speaking the ClientDLLRootPanel) is the where the client starts creating panels for its in-game HUD. It in entirely separate from the GameUI panel used to draw the main menu. The first child is normally the active ClientMode.
Most games will never need to access the RootPanel. If this is true for your project then you should return the engine-controlled PANEL_CLIENTDLL
(the behaviour of the example below) instead of creating a new object.

SetPostChildPaintEnabled(true)
if this is your intention.Minimum implementation
Conventionally in vgui_rootpanel_<game>.cpp
:
#include "cbase.h"
#include "ienginevgui.h"
void VGUI_CreateClientDLLRootPanel()
{
}
void VGUI_DestroyClientDLLRootPanel()
{
}
vgui::VPANEL VGui_GetClientDLLRootPanel()
{
return enginevgui->GetPanel(PANEL_CLIENTDLL);
}
See also
game\client\sdk\vgui\vgui_rootpanel_sdk.cpp
(for a game creating its own RootPanel)- ClientMode
- GameUI
VPANEL