16 lines
363 B
JavaScript
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();
|
|
}
|
|
}
|