Documentation > GUI > Button

Parent du composant : Panel
Version: 2.0.4

Button.new(X, Y, Width, Height, Content, FontName, FontSize, TextColor, BackColor, Z)

This function creates a new Button object.

X

Position on the X axis of the button.

Y

Position on the Y axis of the button.

Width

Width of the space occupied by the button.

Height

Height of the space occupied by the button.

Content

Text of the button.

FontName

Name of the font text.

FontSize

Size of the text font.

TextColor

Color of the text.

BackColor

Back color of the button.

Z

Z-Order of the button.

Return

Return an instance of Button object.

Button:draw()

This function draw the button with its images if defined or with its colors.

Button:drawButton()

This function draw the button with its images if defined or with its colors.

Button:getImages()

This function returns the images used for the button on each state : default, hover and pressed.

Return

Returns the images used for default, hover and pressed state.

Button:setImages(Default, Hover, Pressed)

This function sets the images used for default, hover and pressed state of the button and adjusts the width and height of the button.

Default

Image for the default state.

Hover

Image for the hover state.

Pressed

Image for the pressed state.

Button:setPosition(X, Y)

This function sets the position of the button and its label.

X

Coordonate on the X-axis.

Y

Coordonate on the Y-axis.

Button:getTextDimensions()

This function returns the dimensions of the button label.

Return

Width and height of the button label.

Button:setLabel(Text)

This functions sets the button label.

Text

Text of the button label.

Button:setLabelColor(Color)

This function sets the color of the button label.

Color

Color of the button label.

Button:setFont(FontName, FontSize)

This function sets the font of the button label.

FontName

Name of the font of the button label.

FontSize

Size of the font of the button label.

Button:setFontSize(FontSize)

This function sets the font size of the button label.

FontSize

Size of the font of the button label.

Button:update(dt)

This function triggers the action for the pressed event.

dt

Delta time.

Button:toString(NoTitle)

This function display all variables containing in the current Button instance (tables and functions are excluded).

NoTitle

Indicates if the title must be displayed (false) or not (true).