Skip to content

OryUIButton

Kevin Cross edited this page Jun 28, 2020 · 18 revisions

Available Functions

OryUICreateButton(parameters$)

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

OryUIDeleteButton(buttonID)

Deletes a button.

OryUIDisableButton(buttonID)

Disables a button.

OryUIEnableButton(buttonID)

Enables a button.

OryUIGetButtonHeight(buttonID)

Returns the height of the button.

OryUIGetButtonHeld(buttonID)

Returns whether or not the button is being held.

OryUIGetButtonPressed(buttonID)

Returns whether or not the button is being pressed.

OryUIGetButtonReleased(buttonID)

Returns whether or not the button was released.

OryUIGetButtonWidth(buttonID)

Returns the width of the button.

OryUIGetButtonX(buttonID)

Returns the x position of the button.

OryUIGetButtonY(buttonID)

Returns the y position of the button.

OryUIUpdateButton(buttonID, parameters$)

Updates a button. See Available Parameters section below for the options.

Available Parameters (all optional)

Parameter Description
angle The angle of the button.
color The colour of the button. Will apply to enabled and disabled states. Accepts RGB values, and RGBA values (comma delimited) Also accepts MakeColor() value/id, and hex color codes.
depth The depth of the button.
disabledColor The colour of the button when disabled. Accepts RGB values, and RGBA values (comma delimited) Also accepts MakeColor() value/id, and hex color codes.
disabledIcon The icon to show on the button when disabled. See the list of Available Icons
disabledIconColor The colour of the button icon when disabled. Accepts RGB values, and RGBA values (comma delimited) Also accepts MakeColor() value/id, and hex color codes.
disabledIconID Apply a custom icon to the button when disabled. Requires a LoadImage() value/id.
disabledIconPlacement The position to place the icon when text is also on the button and button is disabled. Accepts the values left, right, top and bottom.
disabledIconSize The width and height of the icon when disabled, comma delimited. Also accepts -1 in either one to create a square icon. Accepts decimals.
disabledImageID Apply an image to the whole button background when disabled. Requires a LoadImage() value/id.
disabledText The text shown on the button when disabled.
disabledTextAlignment The alignment of the text when disabled. Accepts left, center, and right. Also accepts the numeric values 0, 1, and 2.
disabledTextBold If the text is bold when disabled. Accepts the values true, false, 0, and 1.
disabledTextColor The colour of the button text when disabled. Accepts RGB values, and RGBA values (comma delimited) Also accepts MakeColor() value/id, and hex color codes.
disabledTextSize The size of the button text when disabled. Accepts decimals.
enabled If the button is enabled. Accepts the values true, false, 0, and 1.
enabledColor The colour of the button when enabled. Accepts RGB values, and RGBA values (comma delimited) Also accepts MakeColor() value/id, and hex color codes.
enabledIcon The icon to show on the button when enabled. See the list of Available Icons
enabledIconColor The colour of the button icon when enabled. Accepts RGB values, and RGBA values (comma delimited) Also accepts MakeColor() value/id, and hex color codes.
enabledIconID Apply a custom icon to the button when enabled. Requires a LoadImage() value/id.
enabledIconPlacement The position to place the icon when text is also on the button and button is enabled. Accepts the values left, right, top and bottom.
enabledIconSize The width and height of the icon when enabled, comma delimited. Also accepts -1 in either one to create a square icon. Accepts decimals.
enabledImageID Apply an image to the whole button background when enabled. Requires a LoadImage() value/id.
enabledText The text shown on the button when enabled.
enabledTextAlignment The alignment of the text when enabled. Accepts left, center, and right. Also accepts the numeric values 0, 1, and 2.
enabledTextBold If the text is bold when enabled. Accepts the values true, false, 0, and 1.
enabledTextColor The colour of the button text when enabled. Accepts RGB values, and RGBA values (comma delimited) Also accepts MakeColor() value/id, and hex color codes.
enabledTextSize The size of the button text when enabled. Accepts decimals.
fixToScreen Fixes the button to screen.
height The height of the button. Accepts decimals.
icon The icon to show on the button. Will apply to enabled and disabled states. See the list of Available Icons
iconColor The colour of the button icon. Will apply to enabled and disabled states. Accepts RGB values, and RGBA values (comma delimited) Also accepts MakeColor() value/id, and hex color codes.
iconID Apply a custom icon to the button. Will apply to enabled and disabled states. Requires a LoadImage() value/id.
iconPlacement The position to place the icon when text is also on the button. Will apply to enabled and disabled states. Accepts the values left, right, top and bottom.
iconSize The width and height of the icon, comma delimited. Will apply to enabled and disabled states. Also accepts -1 in either one to create a square icon. Accepts decimals.
imageID Apply an image to the whole button background. Will apply to enabled and disabled states. Requires a LoadImage() value/id.
offset The x and y position where the offset should be placed, comma delimited. Also accepts a single value 'center'. 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.
text The text shown on the button. Will apply to enabled and disabled states.
textAlignment The alignment of the text. Will apply to enabled and disabled states. Accepts left, center, and right. Also accepts the numeric values 0, 1, and 2.
textBold If the text is bold. Will apply to enabled and disabled states. Accepts the values true, false, 0, and 1.
textColor The colour of the button text. Will apply to enabled and disabled states. Accepts RGB values, and RGBA values (comma delimited) Also accepts MakeColor() value/id, and hex color codes.
textSize The size of the button text. Will apply to enabled and disabled states. 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 a default button with no styling

btnNext = OryUICreateButton("")

To update an existing button

OryUIUpdateButton(btnNext, "size:30,8;text:Next;textColor:255,255,255,255;textSize:5;color:41,128,185;offset:center;position:50,50")

You can also create a button with the required settings with the OryUICreateButton function

btnNext = OryUICreateButton("size:30,8;text:Next;textColor:255,255,255,255;textSize:5;color:41,128,185;offset:center;position:50,50")

To check if button released

if (OryUIGetButtonReleased(btnNext))
    Message("Button Released")
endif

Example

btnNext = OryUICreateButton("size:30,8;text:Next;textColor:255,255,255,255;textSize:5;color:41,128,185;offset:center;position:50,50")

do
    if (OryUIGetButtonReleased(btnNext))
        Message("Button Released")
    endif
    Sync()
loop

Clone this wiki locally