Nuclide
Software Development Kit for id Technology (BETA)
Vera GUI

Truly versatile user interface, for menus and in-game surfaces. More...

Detailed Description

Truly versatile user interface, for menus and in-game surfaces.

Nuclide ships with this component as the default interface library.

Menu using Vera GUI

Its design goals were to be easily customizable through some common parameters, and a per-object based theme engine for anything more advanced. It also needed to be usable on in-game surfaces.

Interactive surfaces

Customization

You can make trivial changes using external UI styling files, this is not following any specific spec and may be subject to change some day to adopt something more standardized.

Currently however you can modify the file (create them if they don't exist) named scripts/ui_style.txt. Said file will contain a variety of key/value pairs:

Note
Color and alpha values target channels with values between 0 and 255.

If a file named scripts/client_style.txt exists, it will be read instead by the client-game - but not by the main menu. That way you can have different colorschemes for both modules at the same time.

Example Style File

This file will give you a grey menu, with white text that's slightly transparent and has no icons, but rounded corners:

COLOR=200 200 200
FG_COLOR=255 255 255
ALPHA=196
NOICONS=1
ROUNDED=1

Advanced Themes

Theming an object through more advanced means is possible with vguiTheme. vguiTheme is responsible for theming everything, but it is also designed to co-exist with other theme engines.

Use vguiWidget::SetTheme() to override the theme engine any of your widgets are using with an instance of your own. For that, make a child-class of vguiTheme and override the methods you want changed within it. Then use the aforementioned method to override it on a per-object basis.

While you can theme individual elements, all of their child-widgets (e.g. the close button on a window) will inherit the theme of their parent by default.

Note
For most use-cases, you will want to call vguiWidget::SetTheme() on the very first vguiWidget, the one everything else will be added to using vguiWidget::Add()

Classes

class  vguiWidget
 The base VGUI widget class. More...
 
class  vgui3DView
 VGUI Widget: 3D View. More...
 
class  vguiButton
 VGUI Widget: Button. More...
 
class  vguiCheckbox
 VGUI Widget: Checkbox. More...
 
class  vguiColor
 Container class that'll deal with handling colors via a variety of different means. More...
 
class  vguiCommandButton
 VGUI Widget: Command Menu Button. More...
 
class  vguiControl
 VGUI: Abstract Control Class. More...
 
class  vguiFrame
 VGUI Widget: Frame. More...
 
class  vguiLabel
 VGUI Widget: Label. More...
 
class  vguiList
 VGUI Widget: List. More...
 
class  vguiListBox
 VGUI Widget: List Box. More...
 
class  vguiMenuButton
 VGUI Widget: Menu Button. More...
 
class  vguiMenuTitle
 VGUI Widget: Menu Title. More...
 
class  vguiPic
 VGUI Widget: Picture Frame. More...
 
class  vguiProgressBar
 VGUI Widget: Frame. More...
 
class  vguiRadio
 VGUI Widget: Radio Button. More...
 
class  vguiRect
 VGUI Widget: Picture Frame. More...
 
class  vguiSlider
 VGUI Widget: Slider. More...
 
class  vguiTabView
 VGUI Widget: Tab View. More...
 
class  vguiTabViewItem
 VGUI Widget: Button. More...
 
class  vguiTextBox
 VGUI Widget: Text Box. More...
 
class  vguiTextView
 VGUI Widget: Text View. More...
 
class  vguiView
 VGUI Widget: Sub-view. More...
 
class  vguiWindow
 VGUI: Window. More...
 

Functions

bool VGUI_Active (void)
 Return whether a VGUI panel is active on the 2D overlay level. More...
 
bool Util_MouseAbove (vector vecMousePos, vector vecPos, vector vecSize)
 Returns whether our mouse cursor is in a specific region of the screen. More...
 
void UISystem_Init (void)
 
vguiWidget UIClass_Spawn (string cname)
 
void vguiWidget::vguiWidget (void)
 
nonvirtual void vguiWidget::SetTheme (vguiTheme)
 Sets the vguiTheme to use on this widget (and any children it may have) More...
 
nonvirtual vguiTheme vguiWidget::GetTheme (void)
 Returns the VGUI that will be used on this widget. More...
 
nonvirtual bool vguiWidget::Visible (void)
 Returns true/false depending on if the widget is visible. More...
 
nonvirtual void vguiWidget::Hide (void)
 Hide the widget. More...
 
virtual void vguiWidget::NowHidden (void)
 
virtual void vguiWidget::NowVisible (void)
 
nonvirtual void vguiWidget::Show (void)
 Show the widget. More...
 
virtual void vguiWidget::PositionChanged (vector, vector)
 Called when the position of the widget was changed in any capacity. More...
 
virtual void vguiWidget::SizeChanged (vector, vector)
 Called when the size of the widget has changed in any capacity. More...
 
nonvirtual void vguiWidget::SetPos (vector)
 Set the position within its context. More...
 
nonvirtual vector vguiWidget::GetPos (void)
 Return the position of the widget within its context. More...
 
nonvirtual int vguiWidget::GetPosWidth (void)
 Returns the X coordinate of the widget position within its context. More...
 
nonvirtual int vguiWidget::GetPosHeight (void)
 Returns the Y coordinate of the widget position within its context. More...
 
nonvirtual void vguiWidget::SetSize (vector)
 Set the size of the widget to a new one. More...
 
nonvirtual vector vguiWidget::GetSize (void)
 Returns the size of the widget, in pixels. More...
 
nonvirtual int vguiWidget::GetWidth (void)
 Returns the width of the widget, in pixels. More...
 
nonvirtual int vguiWidget::GetHeight (void)
 Returns the height of the widget, in pixels. More...
 
nonvirtual void vguiWidget::SetMinSize (vector)
 Sets the minimum size of the widget. More...
 
nonvirtual vector vguiWidget::GetMinSize (void)
 Returns the minimum size of the widget. More...
 
nonvirtual void vguiWidget::SetMaxSize (vector)
 Sets the maximum size of the widget. More...
 
nonvirtual vector vguiWidget::GetMaxSize (void)
 Returns the maximum size of the widget. More...
 
nonvirtual void vguiWidget::FlagAdd (int)
 Add a flag to the widget. More...
 
nonvirtual void vguiWidget::FlagRemove (int)
 Remove a flag from the widget. More...
 
nonvirtual bool vguiWidget::HasFlag (int)
 Check if the vguiWidget has a flag attached. More...
 
virtual void vguiWidget::Reposition (void)
 Called whenever the physical properties of the display change. More...
 
virtual void vguiWidget::Add (vguiWidget)
 Adds a widget into this one. More...
 
virtual void vguiWidget::Draw (void)
 Called in order to draw the widget. More...
 
virtual bool vguiWidget::Input (float, float, float, float)
 Called whenever an input event gets directed to the widget. More...
 
virtual void vguiWidget::Spawned (void)
 Called when the widget has fully initialized. More...
 

Function Documentation

◆ Add()

void vguiWidget::Add ( vguiWidget  wNew)
virtual

Adds a widget into this one.

Reimplemented in vguiView.

◆ Draw()

◆ FlagAdd()

void vguiWidget::FlagAdd ( int  iFlag)

Add a flag to the widget.

◆ FlagRemove()

void vguiWidget::FlagRemove ( int  iFlag)

Remove a flag from the widget.

◆ GetHeight()

int vguiWidget::GetHeight ( void  )

Returns the height of the widget, in pixels.

◆ GetMaxSize()

vector vguiWidget::GetMaxSize ( void  )

Returns the maximum size of the widget.

◆ GetMinSize()

vector vguiWidget::GetMinSize ( void  )

Returns the minimum size of the widget.

◆ GetPos()

vector vguiWidget::GetPos ( void  )

Return the position of the widget within its context.

◆ GetPosHeight()

int vguiWidget::GetPosHeight ( void  )

Returns the Y coordinate of the widget position within its context.

◆ GetPosWidth()

int vguiWidget::GetPosWidth ( void  )

Returns the X coordinate of the widget position within its context.

◆ GetSize()

vector vguiWidget::GetSize ( void  )

Returns the size of the widget, in pixels.

◆ GetTheme()

vguiTheme vguiWidget::GetTheme ( void  )

Returns the VGUI that will be used on this widget.

◆ GetWidth()

int vguiWidget::GetWidth ( void  )

Returns the width of the widget, in pixels.

◆ HasFlag()

bool vguiWidget::HasFlag ( int  flag)

Check if the vguiWidget has a flag attached.

◆ Hide()

void vguiWidget::Hide ( void  )

Hide the widget.

◆ Input()

bool vguiWidget::Input ( float  flEVType,
float  flKey,
float  flChar,
float  flDevID 
)
virtual

◆ NowHidden()

void vguiWidget::NowHidden ( void  )
virtual

◆ NowVisible()

void vguiWidget::NowVisible ( void  )
virtual

Reimplemented in vguiWindow.

◆ PositionChanged()

void vguiWidget::PositionChanged ( vector  vecOld,
vector  vecNew 
)
virtual

Called when the position of the widget was changed in any capacity.

Reimplemented in vguiTabView.

◆ Reposition()

void vguiWidget::Reposition ( void  )
virtual

Called whenever the physical properties of the display change.

Reimplemented in vguiMenuButton, and vguiMenuTitle.

◆ SetMaxSize()

void vguiWidget::SetMaxSize ( vector  vecNewSize)

Sets the maximum size of the widget.

◆ SetMinSize()

void vguiWidget::SetMinSize ( vector  vecNewSize)

Sets the minimum size of the widget.

◆ SetPos()

void vguiWidget::SetPos ( vector  vecNewPos)

Set the position within its context.

◆ SetSize()

void vguiWidget::SetSize ( vector  vecNewSize)

Set the size of the widget to a new one.

◆ SetTheme()

void vguiWidget::SetTheme ( vguiTheme  theme)

Sets the vguiTheme to use on this widget (and any children it may have)

◆ Show()

void vguiWidget::Show ( void  )

Show the widget.

◆ SizeChanged()

void vguiWidget::SizeChanged ( vector  vecOld,
vector  vecNew 
)
virtual

Called when the size of the widget has changed in any capacity.

Reimplemented in vguiTabView, and vguiWindow.

◆ Spawned()

void vguiWidget::Spawned ( void  )
virtual

Called when the widget has fully initialized.

When you override this, you may call super::Spawned(); to ensure the parent classes get to finish initializing also.

Reimplemented in TestUI, vgui3DView, vguiButton, vguiCheckbox, vguiLabel, vguiList, vguiListBox, vguiMenuButton, vguiPic, vguiRadio, vguiRect, vguiSlider, vguiTabView, vguiTabViewItem, vguiTextBox, vguiTextView, and vguiWindow.

◆ UIClass_Spawn()

vguiWidget UIClass_Spawn ( string  cname)

◆ UISystem_Init()

void UISystem_Init ( void  )

◆ Util_MouseAbove()

bool Util_MouseAbove ( vector  vecMousePos,
vector  vecPos,
vector  vecSize 
)

Returns whether our mouse cursor is in a specific region of the screen.

◆ VGUI_Active()

bool VGUI_Active ( void  )

Return whether a VGUI panel is active on the 2D overlay level.

◆ vguiWidget()

void vguiWidget::vguiWidget ( void  )

◆ Visible()

bool vguiWidget::Visible ( void  )

Returns true/false depending on if the widget is visible.