gui
The gui library is similar to the input but features functions that are more focused on the mouse's interaction with GUI panels.
Methods
gui.ActivateGameUI()
Opens the game menu overlay.
Pushes text to the closed caption box.
The function will not work, if the console command variable "closecaption" is set to 0.
gui.EnableScreenClicker( boolean enabled )
Enables the mouse cursor without restricting player movement, like using Sandbox's context menu. See vgui. CursorVisible for a function to see if the cursor is visible or not.
Some CUserCmd functions will return incorrect values when this function is active because the user input is getting overtaken by the vgui system.
gui.HideGameUI()
Hides the game menu overlay.
We advise against using this. It may be changed or removed in a future update.
Will be disabled in a future patch. Use GM:OnPauseMenuShow instead.
Simulates a mouse move with the given deltas.
gui.InternalKeyCodePressed( number key )
Simulates a key press for the given key.
gui.InternalKeyCodeReleased( number key )
Simulates a key release for the given key.
gui.InternalKeyCodeTyped( number key )
Simulates a key type typing to the specified key.
gui.InternalKeyTyped( number code )
Simulates an ASCII symbol writing.
Use to write text in the chat or in VGUI.
Doesn't work while the main menu is open!
gui.InternalMouseDoublePressed( number key )
Simulates a double mouse key press for the given mouse key.
gui.InternalMousePressed( number key )
Simulates a mouse key press for the given mouse key.
gui.InternalMouseReleased( number key )
Simulates a mouse key release for the given mouse key.
gui.InternalMouseWheeled( number delta )
Simulates a mouse wheel scroll with the given delta.
boolean gui.IsConsoleVisible()
Returns whether the console is visible or not.
boolean gui.IsGameUIVisible()
Returns whether the game menu overlay ( main menu ) is open or not.
We advise against using this. It may be changed or removed in a future update.
Use input. GetCursorPos instead.
Returns the cursor's position on the screen, or 0, 0 if cursor is not visible.
Opens specified URL in the steam overlay browser.
When called clientside, user will be asked for confirmation before the website will open.
Converts the specified screen position to a direction vector local to the player's view. A related function is Vector:ToScreen, which translates a 3D position to a screen coordinate.
util. AimVector is a more generic version of this, using a custom view instead of the player's current view.
We advise against using this. It may be changed or removed in a future update.
Use input. SetCursorPos instead.
Sets the cursor's position on the screen, relative to the topleft corner of the window
gui.ShowConsole()
Shows console in the game UI.