Skip to content

ZestText

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

Available Functions

ZestCreateText(zestWidgetParameters as string)

Creates a text item and returns a text ID. See Available Parameters section below for the options.

ZestDeleteText(zestTextID as integer)

Deletes a text item.

ZestGetTextHeight(zestTextID as integer)

Returns the height of a text item.

ZestGetTextWidth(zestTextID as integer)

Returns the width of a text item.

ZestGetTextX(zestTextID as integer)

Returns the X position of a text item.

ZestGetTextY(zestTextID as integer)

Returns the Y position of a text item.

ZestPinTextToBottomCentreOfSprite(zestTextA as integer, zestSpriteB as integer, zestOffsetX as float, zestOffsetY as float)

Pins text item to the bottom centre of a sprite. Allows an offset.

ZestPinTextToBottomLeftOfSprite(zestTextA as integer, zestSpriteB as integer, zestOffsetX as float, zestOffsetY as float)

Pins text item to the bottom left of a sprite. Allows an offset.

ZestPinTextToBottomRightOfSprite(zestTextA as integer, zestSpriteB as integer, zestOffsetX as float, zestOffsetY as float)

Pins text item to the bottom right of a sprite. Allows an offset.

ZestPinTextToCentreOfSprite(zestTextA as integer, zestSpriteB as integer, zestOffsetX as float, zestOffsetY as float)

Pins text item to the centre of a sprite. Allows an offset.

ZestPinTextToCentreLeftOfSprite(zestTextA as integer, zestSpriteB as integer, zestOffsetX as float, zestOffsetY as float)

Pins text item to the centre left of a sprite. Allows an offset.

ZestPinTextToCentreRightOfSprite(zestTextA as integer, zestSpriteB as integer, zestOffsetX as float, zestOffsetY as float)

Pins text item to the centre right of a sprite. Allows an offset.

ZestPinTextToTopCentreOfSprite(zestTextA as integer, zestSpriteB as integer, zestOffsetX as float, zestOffsetY as float)

Pins text item to the top centre of a sprite. Allows an offset.

ZestPinTextToTopLeftOfSprite(zestTextA as integer, zestSpriteB as integer, zestOffsetX as float, zestOffsetY as float)

Pins text item to the top left of a sprite. Allows an offset.

ZestPinTextToTopRightOfSprite(zestTextA as integer, zestSpriteB as integer, zestOffsetX as float, zestOffsetY as float)

Pins text item to the top right of a sprite. Allows an offset.

ZestUpdateText(zestTextID as integer, zestWidgetParameters as string)

Updates a text item. See Available Parameters section below for the options.

ZestWrapText(zestText as string, zestSize as float, zestMaxWidth as float)

Will wrap text to the desired width.

Available Parameters (all optional)

Parameter Description
alignment The alignment of the content text. Accepts left, center, and right. Also accepts the numeric values 0, 1, and 2.
angle The angle of the text.
bold If the text is bold. Accepts the values true, false, 0, and 1.
color The colour of the text. Accepts RGB values, and RGBA values (comma delimited) Also accepts MakeColor() value/id, and hex color codes.
depth The depth of the text.
fixToScreen Fixes the text to the screen.
font The font to apply to the text. Requires a LoadFont() value/id.
position The x and y position where the sprite should be placed, comma delimited.
shadow If the text has a drop shadow. Accepts the values true, false, 0, and 1.
shadowColor The colour of the drop shadow. Accepts RGB values, and RGBA values (comma delimited) Also accepts MakeColor() value/id, and hex color codes.
shadowOffset The x and y position where the shadow 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.
size The size of the text. Accepts decimals.
text The text shown.
x The x position where the text should be placed.
y The y position where the text should be placed.

Example Code

Example

sprBox as integer : sprBox = ZestsCreateSprite("size:50,20;color:44,62,80;offset:center;position:50,50")
txtSeconds as integer : txtSeconds = ZestCreateText("string:Seconds Running[colon];size:8;color:241,196,15;alignment:center")
ZestPinTextToCentreOfSprite(txtName, sprBox, 0, 0)

do
    ZestUpdateText(txtSeconds, "string:Seconds Running[colon] " + str(GetSeconds()))

    ZestSync()
loop

Example of ZestWrapText()

txtLoremIpsum as integer : txtLoremIpsum = ZestCreateText("string:" + ZestWrapText("Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin tortor arcu, interdum ac interdum eget, feugiat sed odio. Proin eu risus bibendum, varius turpis nec, euismod odio. Aliquam vel tortor erat. In hac habitasse platea dictumst. Ut in eros ut erat scelerisque sodales a eu diam. Ut sit amet libero dui. Morbi faucibus magna vel tortor porttitor, quis porta augue venenatis.", 3, 50) + ";size:3")

do

    ZestSync()
loop

Clone this wiki locally