Skip to content

ZestImageButton

Kevin Cross edited this page Apr 18, 2023 · 3 revisions

Available Functions

ZestCreateImageButton(zestWidgetParameters as string)

Creates an image button and returns a image button ID. See Available Parameters section below for the options.

ZestDeleteImageButton(zestImageButtonID as integer)

Deletes an image button.

ZestDisableImageButton(zestImageButtonID as integer)

Disables an image button.

ZestEnableImageButton(zestImageButtonID as integer)

Enables an image button.

ZestGetImageButtonHeight(zestImageButtonID as integer)

Returns image button height.

ZestGetImageButtonHeld(zestImageButtonID as integer)

Returns if image button is held or not.

ZestGetImageButtonPressed(zestImageButtonID as integer)

Returns if image button is pressed or not.

ZestGetImageButtonReleased(zestImageButtonID as integer)

Returns if image button is released or not.

ZestGetImageButtonWidth(zestImageButtonID as integer)

Returns image button width.

ZestGetImageButtonX(zestImageButtonID as integer)

Returns image button X position.

ZestGetImageButtonXByOffset(zestImageButtonID as integer)

Returns image button X offset position.

ZestGetImageButtonY(zestImageButtonID as integer)

Returns image button Y position.

ZestGetImageButtonYByOffset(zestImageButtonID as integer)

Returns image button Y offset position.

ZestImageButtonListener(zestImageButtonID as integer)

Listens for touches on an image button.

ZestUpdateImageButton(zestImageButtonID as integer, zestWidgetParameters as string)

Updates an image button. See Available Parameters section below for the options.

Available Parameters (all optional)

Parameter Description
angle The angle of the button.
depth The depth of the button.
disabledImageID Apply an image to the whole button background when disabled. Requires a LoadImage() value/id.
enabled If the button is enabled. Accepts the values true, false, 0, and 1.
enabledImageID Apply an image to the whole button background when enabled. Requires a LoadImage() value/id.
fixToScreen Fixes the button to screen.
height The height of the button. Accepts decimals.
hoverImageID Apply an hover image to the whole button background. Requires a LoadImage() value/id.
imageID Apply an image to the whole button background. Requires a LoadImage() value/id.
offset The x and y position where the offset should be placed, comma delimited. Also accepts any of these case in-sensitive single values: 'bottomCenter', 'bottomLeft', 'bottomRight', 'center', 'centerLeft', 'centerRight', 'topCenter', 'topLeft', 'topRight'. Accepts decimals.
position The x and y position where the button should be placed, comma delimited.
size The width and height of the button, comma delimited. Also accepts -1 in either one to create a square button. Accepts decimals.
width The width of the button. Accepts decimals.
x The x position where the button should be placed.
y The y position where the button should be placed.

Example Code

To create an image button

imgButton as integer : imgButton = LoadImage("Button.png")
imgButtonHovered as integer : imgButtonHovered = LoadImage("Button-Hovered.png")

button as integer : button = ZestCreateImageButton("hoveredImage:" + imgButtonHovered + ";image:" + imgButton + ";position:150,150;size:250,-1")

To update an existing button

ZestUpdateImageButton(button, "position:50,50;size:100,-1")

To check if the image button was released

if (ZestGetImageButtonReleased(button))
    Message("Button Released")
endif

Example

imgButton as integer : imgButton = LoadImage("Button.png")
imgButtonHovered as integer : imgButtonHovered = LoadImage("Button-Hovered.png")

button as integer : button = ZestCreateImageButton("hoveredImage:" + imgButtonHovered + ";image:" + imgButton + ";position:150,150;size:250,-1")

do
    if (ZestGetImageButtonReleased(button))
        Message("Button Released")
    endif

    ZestSync()
loop