1
0
Fork 0
mirror of https://github.com/ninjamuffin99/Funkin.git synced 2024-11-01 04:14:47 +00:00
Funkin/source/ui/TextMenuList.hx

56 lines
1.2 KiB
Haxe
Raw Normal View History

package ui;
2021-02-24 00:55:24 +00:00
import ui.AtlasText;
import ui.MenuList;
2021-02-24 00:55:24 +00:00
class TextMenuList extends MenuTypedList<TextMenuItem>
{
2021-03-22 12:48:52 +00:00
public function new (navControls:NavControls = Vertical, ?wrapMode)
{
2021-03-22 12:48:52 +00:00
super(navControls, wrapMode);
}
2021-02-24 00:55:24 +00:00
public function createItem(x = 0.0, y = 0.0, name:String, font:AtlasFont = Bold, callback, fireInstantly = false)
{
2021-02-24 00:55:24 +00:00
var item = new TextMenuItem(x, y, name, font, callback);
item.fireInstantly = fireInstantly;
return addItem(name, item);
}
}
2021-02-24 00:55:24 +00:00
class TextMenuItem extends TextTypedMenuItem<AtlasText>
{
2021-02-24 00:55:24 +00:00
public function new (x = 0.0, y = 0.0, name:String, font:AtlasFont = Bold, callback)
{
2021-02-24 00:55:24 +00:00
super(x, y, new AtlasText(0, 0, name, font), name, callback);
setEmptyBackground();
}
}
2021-02-24 00:55:24 +00:00
class TextTypedMenuItem<T:AtlasText> extends MenuTypedItem<T>
{
public function new (x = 0.0, y = 0.0, label:T, name:String, callback)
{
super(x, y, label, name, callback);
}
2021-03-14 02:11:56 +00:00
override function setItem(name:String, ?callback:Void -> Void)
{
if (label != null)
{
label.text = name;
2021-03-16 14:56:08 +00:00
label.alpha = alpha;
width = label.width;
height = label.height;
}
super.setItem(name, callback);
}
override function set_label(value:T):T
{
super.set_label(value);
setItem(name, callback);
return value;
}
}