-
Notifications
You must be signed in to change notification settings - Fork 2
VGUI Module
George Petrou edited this page Aug 3, 2018
·
9 revisions
This module handles the drawing of every VGUI element except the scoreboard.
Adding a VGUI Element:
- Create a file in
addons/[AddonName]/lua/ttt/vgui/
. - Name the file something simple and unique, no spaces or special characters, since files with the same name will override each other. (This is done intentionally)
- Call
TTT.VGUI.AddElement
. The first argument is the unique HUD name, second is the drawing code, the third argument is the condition for which the hud should draw.
Overriding a VGUI Element:
- You can either use the same file name as the HUD or the same unique HUD name as the HUD you want to override.
- Follow the instructions for adding a VGUI element.
TTT.VGUI.AddElement - Client
- Desc: Adds or overrides an existing HUD element.
- Arg One: String, unique ID for the element.
-
Arg Two: Function, 2D drawing code.
- Arg One: Player, the local player.
- Arg Two: Number, screen width.
- Arg Three: Number, screen height.
- Arg Four: Boolean, is the player alive at the moment.
-
Arg Three: Function, determines when the HUD element should be drawn.
- Arg One: Player, the local player.
- Arg Two: Boolean, is the player alive at the moment.
- Returns: Boolean, should the HUD draw.