The "vngen_button_create" Function
#
SyntaxArgument | Type | Description |
---|---|---|
id | real/string | The unique identifier to use for the new button |
text | string | The button text to display over the background (or "" for none) |
sprite | sprite | The sprite to display as a button background |
spr_hover | sprite/macro | The sprite to display as a background when hovered (or keyword none for default) |
spr_active | sprite/macro | The sprite to display as a background when selected (or keyword none for default) |
x | real | The horizontal position to display the button, relative to the GUI layer |
y | real | The vertical position to display the button, relative to the GUI layer |
z | real | The drawing depth and list order of the button, relative to other log buttons only |
font | font | The font to draw text in, where fnt_default is default |
color | color | The color to draw text in, where c_white is default |
transition | script | Sets the transition animation to perform |
duration | real | Sets the duration of the transition animations, in seconds |
[ease] | integer/macro | Optional: Sets the ease override for the button animations |
#
DescriptionCreates a new button which will be displayed until vngen_button_destroy
is run. The chosen button ID will be recorded as the selected choice until cleared with vngen_get_button
or vngen_button_clear
. Buttons can selected by mouse/touch, or by other input devices with vngen_button_nav
and vngen_button_select
.
Unlike other entities, button z-index determines not just drawing depth, but also navigation order. Buttons with lower z-index will be considered lower in the list of buttons. If z-index is equal between two or more buttons, navigation order will automatically be set by reverse creation order, but this may or may not be visually correct. Therefore, it is recommended to always set z-index explicitly. The actual values used are inconsequential so long as they are ordered from highest to lowest.
See Included Animations and Macros & Keywords for a list of available transition animations and ease modes.