improcket/js/gui/button.mjs
2018-03-05 22:29:35 +00:00

16 lines
363 B
JavaScript

import * as gui from './index.mjs';
import GuiElement from './element.mjs';
export default class GuiButton extends GuiElement {
constructor(text, onclick, x, y, w = 100, h = 30) {
super(x, y, w, h);
this.type = 'button';
this.text = text;
this.onclick = onclick;
}
click() {
if (this.options.draw && !this.options.disabled)
this.onclick();
}
}