Files
Funkin/source/funkin/mobile/ui/options/objects/HitboxOptionButton.hx
T
MAJigsaw77andKarimAkra c7906edc1e Some things
* Fixed some other checkstyle issues.
* The controls schemes options menu now shows the hitboxes without a gradient to look better.
* Attempted to rewrite the tweeing system on the FunkinHint, needs more looking.
2025-04-17 12:22:56 +03:00

50 lines
1.3 KiB
Haxe

package funkin.mobile.ui.options.objects;
import flixel.group.FlxSpriteGroup;
import funkin.ui.TextMenuList.TextMenuItem;
import funkin.ui.options.items.CheckboxPreferenceItem;
import funkin.ui.AtlasText.AtlasFont;
/**
* Represents an option button for the hitbox showcase.
*/
class HitboxOptionButton extends FlxSpriteGroup
{
/**
* The button's checkbox member.
* Indicates the current value of the option.
*/
var checkbox:CheckboxPreferenceItem;
/**
* The button's text.
*/
public var text:TextMenuItem;
/**
* Creates a new HitboxShowcase instance.
*
* @param name Option's name.
* @param xPos The x position of the object.
* @param yPos The y position of the object.
* @param defaultValue Option's default value.
* @param onClick A callback function that will be triggered when the object is clicked.
*/
public function new(name:String = "", ?xPos:Float = 0, ?yPos:Float = 0, defaultValue:Bool, onClick:Bool->Void):Void
{
super(xPos, yPos);
checkbox = new CheckboxPreferenceItem(0, 0, defaultValue);
add(checkbox);
text = new TextMenuItem(checkbox.x + checkbox.width, checkbox.y + 30, name, AtlasFont.BOLD, function() {
final value:Bool = !checkbox.currentValue;
onClick(value);
checkbox.currentValue = value;
});
add(text);
setSize(500, 500);
}
}