This repository has been archived by the owner on Aug 20, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 12
benank edited this page Aug 19, 2020
·
4 revisions
The UI
singleton class is a client-side class used to create new UI element for your gamemode using HTML, CSS, and JS. If you want to display information on the screen without using natives, you'll be using this.
- Creates a new
UIInstance
and creates a new HTML window. - args (in table):
-
name
(string): name of the UI instance you want to create. Must be unique. -
path
(string): path to the HTML page to load. Must be relative to resource, eglobby/client/html/index.html
(where your resource name isgamemode
, or anything else.lobby
is a module within your resource.) -
css
(optional, string): extra CSS you would like to apply to this UI instance. Great for restricting the size of a UI instance to only a certain portion of the screen.
-
- returns:
UIInstance
of the instance you just created
- Gets the screen size in pixels.
- returns: table containing
x
andy
values of the screen size.
- Shows/hides the cursor for all UI. Also sets UI focus so keypresses will no longer register in the game.
- Ref counted, so every time you call it with
true
, you must call it withfalse
to hide the cursor. -
enabled
(bool): whether or not the mouse should be enabled
- Returns the ref count for the cursor.
- returns: number containing ref count
- Calls an event on a single or all UI instances.
- args (in table)
-
data
(table): the table of data you want to send -
event_name
(string): event name to call -
name
(optional, string): name of the UI instance you want to send to, nil to call event on all instances
-
- Removes a UI instance by name.
-
name
(string): name of the UI instance to remove