improcket/js/gui/button.mjs
2018-03-04 16:49:42 +00:00

16 lines
337 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.onclick();
}
}