Skip to content

EmuButton

Dragonite edited this page Dec 29, 2020 · 1 revision

A class representing a button which performs an action when clicked.

Constructor

Inheritance: EmuCore / EmuCallback

EmuButton(x, y, w, h, text, callback)
Parameter Type Description
x real The x coordinate where the button will be created
y real The y coordinate where the button will be created
w real The width of the button
h real The height of the button
text string The text label shown on the button
callback function The callback that will be invoked when the button is clicked

Example

var button = new EmuButton(32, u, 256, 32, "Show Dialog", function() {
    var dialog = new EmuDialog(640, 640, "Hey, listen!", emu_null);
    dialog.AddContent(new EmuText(32, 32, 256, 64, "These are words that you can read and stuff"));
}

container.AddContent(button);

This will create an EmuButton which spawns a pop-up dialog when clicked. The button will then be added to a previously-created container.

See Also

  • EmuButtonImage, which has the same functionality but shows an image instead of text
Clone this wiki locally