The text you want to display on the button.
The x coordinate of the button (in screen position).
The y coordinate of the button (in screen position).
The width for the button.
The height for the button.
The function that will be called when user clicks the button on screen.
Generated using TypeDoc
Make a button on the screen with given screen space position in the current frame. When user clicks the button, the
onClick
function will be called.The origin of screen space is upper-left corner and the positive Y direction is downward.
The drawn button will only last for one frame. You should put this under the
Update
function (or a function that is called by theUpdate
function) to keep the button stays in every frame.If this function is called by a lifecycle event function, then the
onClick
function in the fourth parameter could also be considered as a lifecycle event function.This means that you can use other functions from this module inside the
onClick
function, even though the functions are not under theOutside Lifecycle
category.For example, the code piece below
is correct.
You can use rich text for the parameter
text
. For example:gui_button("<color=#AA00FF>Hello World</color>", 100, 100, 200, 50, my_onclick_function);