Repository navigation
ZestImageButton
Kevin Cross edited this page Apr 18, 2023
·
3 revisions
Creates an image button and returns a image button ID. See Available Parameters section below for the options.
Deletes an image button.
Disables an image button.
Enables an image button.
Returns image button height.
Returns if image button is held or not.
Returns if image button is pressed or not.
Returns if image button is released or not.
Returns image button width.
Returns image button X position.
Returns image button X offset position.
Returns image button Y position.
Returns image button Y offset position.
Listens for touches on an image button.
Updates an image button. See Available Parameters section below for the options.
| 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. |
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