Working main menu 🎉
This commit is contained in:
40
src/components/MenubuttonComponent.hx
Normal file
40
src/components/MenubuttonComponent.hx
Normal file
@ -0,0 +1,40 @@
|
||||
package components;
|
||||
|
||||
@:uiComp("menubutton")
|
||||
class MenubuttonComponent extends h2d.Flow implements h2d.domkit.Object {
|
||||
static var SRC = <menubutton>
|
||||
<text text={label} public id="labelTxt" />
|
||||
</menubutton>
|
||||
|
||||
public var label(get, set):String;
|
||||
|
||||
function get_label()
|
||||
return labelTxt.text;
|
||||
|
||||
function set_label(s) {
|
||||
labelTxt.text = s;
|
||||
return s;
|
||||
}
|
||||
|
||||
public function new(label:String, ?parent) {
|
||||
super(parent);
|
||||
initComponent();
|
||||
enableInteractive = true;
|
||||
interactive.onClick = function(_) onClick();
|
||||
interactive.onOver = function(_) {
|
||||
dom.hover = true;
|
||||
};
|
||||
interactive.onPush = function(_) {
|
||||
dom.active = true;
|
||||
};
|
||||
interactive.onRelease = function(_) {
|
||||
dom.active = false;
|
||||
};
|
||||
interactive.onOut = function(_) {
|
||||
dom.hover = false;
|
||||
};
|
||||
}
|
||||
|
||||
public dynamic function onClick() {}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user