The "vngen_button_create_transformed" Function

Syntax

vngen_button_create_transformed(id, text, sprite, spr_hover, spr_select, x, y, z, font, color, hov_x, hov_y, hov_scale, hov_color, sel_x, sel_y, sel_scale, sel_color, sel_duration, transition, duration, [ease]);
ArgumentTypeDescription
idreal/stringThe unique identifier to use for the new button
textstringThe button text to display over the background (or "" for none)
spritespriteThe sprite to display as a button background
spr_hoversprite/macroThe sprite to display as a background when hovered (or keyword none for default)
spr_activesprite/macroThe sprite to display as a background when selected (or keyword none for default)
xrealThe horizontal position to display the button
yrealThe vertical position to display the button
zrealThe drawing depth and list order of the button, relative to other buttons only
fontfontThe font to draw text in, where fnt_default is default
colorcolorThe color to draw text in, where c_white is default
hov_xrealThe horizontal offset to shift the button when hovered
hov_yrealThe vertical offset to shift the button when hovered
hov_scalerealThe scale multiplier to shift the button when hovered
hov_colorcolorThe color to draw text in when hovered
sel_xrealThe horizontal offset to shift the button when selected
sel_yrealThe vertical offset to shift the button when selected
sel_scalerealThe scale multiplier to shift the button when selected
sel_colorcolorThe color to draw text in when selected
sel_durationrealSets the duration of hover/select animations, in seconds
transitionscriptSets the transition animation to perform
durationrealSets the duration of the transition animations, in seconds
[ease]integer/macroOptional: Sets the ease override for all button animations

Description

Creates a new button with hover and select transformations 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.

Example

vngen_button_create_transformed("btn", "Click me!", spr_btn, spr_btn_hover, spr_btn_active, 256, 512, -1, fnt_Arial, c_white, 32, 0, 1.25, c_black, 0, 0, 1, c_yellow, 0.1, trans_fade, 1);