expcore.gui.elements.buttons module

Gui class define for buttons and sprite buttons [[

Dependencies

mod-gui
expcore.gui.core
expcore.gui.prototype

Functions

Button.new_button([name]) Creates a new button element define
Button._prototype:set_sprites(sprite[, hovered_sprite][, clicked_sprite]) Adds sprites to a button making it a sprite button
Button._prototype:set_click_filter(filter[, ...]) Adds a click / mouse button filter to the button
Button._prototype:set_key_filter(filter[, ...]) Adds a control key filter to the button

Dependencies

# mod-gui
# expcore.gui.core
# expcore.gui.prototype

Functions

# Button.new_button([name])

Creates a new button element define

Parameters:
  • name : (string) the optional debug name that can be added (optional)
Returns:
  • (table) the new button element define
# Button._prototype:set_sprites(sprite[, hovered_sprite][, clicked_sprite])

Adds sprites to a button making it a sprite button

Parameters:
  • sprite : (SpritePath) the sprite path for the default sprite for the button
  • hovered_sprite : (SpritePath) the sprite path for the sprite when the player hovers over the button (optional)
  • clicked_sprite : (SpritePath) the sprite path for the sprite when the player clicks the button (optional)
Returns:
  • (self) returns the button define to allow chaining
# Button._prototype:set_click_filter(filter[, ...])

Adds a click / mouse button filter to the button

Parameters:
  • filter : (table) ?string|table either a of mouse buttons or the first mouse button to filter, with a table true means allowed
  • ... : (table) when filter is not a you can add the mouse buttons one after each other (optional)
Returns:
  • (self) returns the button define to allow chaining
# Button._prototype:set_key_filter(filter[, ...])

Adds a control key filter to the button

Parameters:
  • filter : (table) ?string|table either a of control keys or the first control keys to filter, with a table true means allowed
  • ... : (table) when filter is not a you can add the control keys one after each other (optional)
Returns:
  • (self) returns the button define to allow chaining