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.
Make a button on the screen with given screen space position in the current frame. When user clicks the button, the
onClickfunction 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
Updatefunction (or a function that is called by theUpdatefunction) to keep the button stays in every frame.If this function is called by a lifecycle event function, then the
onClickfunction 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
onClickfunction, even though the functions are not under theOutside Lifecyclecategory.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);