MBHaxe/src/gui/GuiButtonText.hx
2021-06-25 15:57:18 +05:30

24 lines
585 B
Haxe

package gui;
import h3d.Vector;
import h2d.Tile;
class GuiButtonText extends GuiButton {
var txtCtrl:GuiText;
public function new(images:Array<Tile>, font:hxd.res.BitmapFont) {
super(images);
txtCtrl = new GuiText(font);
txtCtrl.position = new Vector();
txtCtrl.extent = this.extent;
txtCtrl.justify = Center;
txtCtrl.text.textColor = 0;
this.addChild(txtCtrl);
}
public function setExtent(extent:Vector) {
this.extent = extent;
txtCtrl.extent = extent;
txtCtrl.position.y = 5 * extent.y / 16; // Weird ratio shit that makes it as centered as possible
}
}