VSLib
Simple, powerful VScript Library for L4D2
 All Classes Namespaces Files Functions Pages
VSLib.HUD.Menu Class Reference

Navigatable menu HUD item. A very limited menu system. Panel displays for all users (due to HUD limitations) but is navigated by a single person. Right-click to fly through menu options, and left click to select a menu item. Options are key-function pairs. When the user selects an option, the menu is closed and the function associated with the option is called. See the API for example usage. More...

Inheritance diagram for VSLib.HUD.Menu:
VSLib.HUD.Item

Private Member Functions

 Menu (string formatStr="[ {name} ]\n\n{title}\n\n{options}", string title="Menu", string optionFormatStr="{num}. {option}", string highlightStrPre="[ ", string highlightStrPost=" ]")
 
void SetTitle (string title)
 
void SetOptionFormat (string optionFormatStr)
 
void SetHighlightStrings (string highlightStrPre, string highlightStrPost)
 
void AddOption (string option, function func)
 
string GetString ()
 
void CloseMenu ()
 
void Detach ()
 
void DisplayMenu (Player player, int attachTo, bool autoDetach=false)
 
void ResizeHeightByLines ()
 
void OverrideButtons (int selectBtn, int switchBtn)
 
void Tick ()
 

Detailed Description

Navigatable menu HUD item. A very limited menu system. Panel displays for all users (due to HUD limitations) but is navigated by a single person. Right-click to fly through menu options, and left click to select a menu item. Options are key-function pairs. When the user selects an option, the menu is closed and the function associated with the option is called. See the API for example usage.

Constructor & Destructor Documentation

VSLib.HUD.Menu.Menu ( string  formatStr = "[ {name} ]\n\n{title}\n\n{options}",
string  title = "Menu",
string  optionFormatStr = "{num}. {option}",
string  highlightStrPre = "[ ",
string  highlightStrPost = "  ]" 
)
private

Member Function Documentation

void VSLib.HUD.Menu.AddOption ( string  option,
function  func 
)
private

Associates a menu item with a function

void VSLib.HUD.Menu.CloseMenu ( )
private

Closes the menu

void VSLib.HUD.Menu.Detach ( )
private

Stops and detaches the HUD object.

void VSLib.HUD.Menu.DisplayMenu ( Player  player,
int  attachTo,
bool  autoDetach = false 
)
private

Displays the menu and hands over control to a particular player entity.

string VSLib.HUD.Menu.GetString ( )
private

Returns the full formatted menu text

void VSLib.HUD.Menu.OverrideButtons ( int  selectBtn,
int  switchBtn 
)
private

Overrides the buttons used to detect HUD changes. You can pass in BUTTON_ATTACK and BUTTON_SHOVE for example.

void VSLib.HUD.Menu.ResizeHeightByLines ( )
private

Resizes this HUD item's height depending on the line height.

void VSLib.HUD.Menu.SetHighlightStrings ( string  highlightStrPre,
string  highlightStrPost 
)
private

Sets new highlight strings

void VSLib.HUD.Menu.SetOptionFormat ( string  optionFormatStr)
private

Sets a new option format

void VSLib.HUD.Menu.SetTitle ( string  title)
private

Sets a new title

void VSLib.HUD.Menu.Tick ( )
private

Gathers input data and acts on it.


The documentation for this class was generated from the following file: