Skip to main content

The "vngen_log_button_create_ext" Function

Syntax#

vngen_log_button_create_ext(id, text, sprite, spr_hover, spr_select, xorig, yorig, x, y, z, tx, ty, scaling, font, color, snd_hover, snd_select, 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)
xorigreal/macroThe horizontal sprite offset, or origin point, relative to the top-left corner
yorigreal/macroThe vertical sprite offset, or origin point, relative to the top-left corner
xrealThe horizontal position to display the button, relative to the GUI layer
yrealThe vertical position to display the button, relative to the GUI layer
zrealThe drawing depth and list order of the button, relative to other log buttons only
txreal/macroThe horizontal position to display text, relative to the button sprite top-left corner (or keyword 'auto' for center)
tyreal/macroThe vertical position to display text, relative to the button sprite top-left corner (or keyword 'auto' for center)
scalinginteger/macroSets the automatic scaling mode for the button
fontfontThe font to draw text in, where fnt_default is default
colorcolorThe color to draw text in, where c_white is default
snd_hoversoundThe sound to play when the button is hovered (Optional, use keyword 'none' for none)
snd_selectsoundThe sound to play when the button is selected (Optional, use keyword 'none' for none)
easeinteger/macroSets the ease override for the button animations

Description#

Creates a new button with extra options which will be displayed while the backlog is open. The chosen button ID will be recorded as the selected choice until cleared with vngen_get_log_button or vngen_log_button_clear. Buttons can selected by mouse/touch, or by other input devices with vngen_log_button_nav and vngen_log_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.

Note that although this script resembles an action, it is not and should not be executed within VNgen events. Instead, log buttons should ideally be created in the Create Event of a dedicated backlog object.

See Macros & Keywords for a list of available ease modes.

Example#

vngen_log_button_create_ext("up", "", spr_up, spr_uhover, spr_uactive, orig_right, orig_bottom, display_get_gui_width(), display_get_gui_height()*0.5, -1, 0, 0, scale_none, fnt_default, c_white, snd_hover, snd_select, ease_sin_in_out);
vngen_log_button_create_ext("dn", "", spr_dn, spr_dhover, spr_dactive, orig_right, orig_top, display_get_gui_width(), display_get_gui_height()*0.5, -2, 0, 0, scale_none, fnt_default, c_white, snd_hover, snd_select, ease_sin_in_out);