Skip to content

EmuButtonImage

Michael edited this page Jun 12, 2020 · 1 revision

A class representing a button which performs an action when clicked. Functionally the same as EmuButton.

Constructor

Inheritance: EmuCore / EmuCallback

EmuButtonImage(x, y, w, h, sprite, index, blend, alpha, scale_to_fit, 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
sprite sprite The sprite to draw
index real The sprite subimage to draw
blend color The color to blend the sprite with (use c_white for no blending)
alpha alpha The alpha to draw the sprite with
scale_to_fit boolean Whether or not the sprite should be scaled to fill the button
callback function The callback that will be invoked when the button is clicked

Example

varnew EmuButtonImage(32, u, 128, 128, spr_emu_birb, 0, c_white, 1, false, function() {
    var dialog = new EmuDialog(320, 240, "Hey, listen!", emu_null);
    dialog.AddContent(new EmuText(32, 32, 256, 64, "You clicked on the birb!"));
});

container.AddContent(button);

This will create an EmuButtonImage which uses the sprite spr_emu_birb, which spawns a pop-up dialog when clicked. The button will then be added to a previously-created container.