<commit_before>package flixel.ui;

import flixel.FlxSprite;
import flixel.graphics.atlas.FlxAtlas;
import flixel.graphics.atlas.FlxNode;
import flixel.graphics.FlxGraphic;
import flixel.graphics.frames.FlxImageFrame;
import flixel.graphics.frames.FlxTileFrames;
import flixel.input.IFlxInput;
import flixel.math.FlxPoint;
import flixel.text.FlxText;
import flixel.ui.FlxButton.FlxTypedButton;
import flixel.util.FlxDestroyUtil;
import openfl.display.BitmapData;

/**
 * A simple button class that calls a function when clicked by the mouse.
 */
class FlxSpriteButton extends FlxTypedButton<FlxSprite> implements IFlxInput
{
	/**
	 * Creates a new FlxButton object with a gray background
	 * and a callback function on the UI thread.
	 * 
	 * @param   X          The x position of the button.
	 * @param   Y          The y position of the button.
	 * @param   Text       The text that you want to appear on the button.
	 * @param   OnClick    The function to call whenever the button is clicked.
	 */
	public function new(X:Float = 0, Y:Float = 0, ?Label:FlxSprite, ?OnClick:Void->Void)
	{
		super(X, Y, OnClick);
		
		for (point in labelOffsets)
		{
			point.set(point.x - 1, point.y + 3);
		}
		
		label = Label;
	}
	
	override private function updateLabelPosition():Void
	{
		if (label != null) // Label positioning
		{
			label.x = (pixelPerfectPosition ? Math.floor(x) : x) + labelOffsets[status].x;
			label.y = (pixelPerfectPosition ? Math.floor(y) : y) + labelOffsets[status].y;
		}
	}
	
	/**
	 * Generates text graphic for button's label.
	 * 
	 * @param	Text	text for button's label
	 * @param	font	font name for button's label
	 * @param	size	font size for button's label
	 * @param	color	text color for button's label
	 * @param	align	text align for button's label
	 * @return	this button with generated text graphic.
	 */<commit_msg>don't need to override updateLabelPosition()<commit_after>package flixel.ui;

import flixel.FlxSprite;
import flixel.graphics.atlas.FlxAtlas;
import flixel.graphics.atlas.FlxNode;
import flixel.graphics.FlxGraphic;
import flixel.graphics.frames.FlxImageFrame;
import flixel.graphics.frames.FlxTileFrames;
import flixel.input.IFlxInput;
import flixel.math.FlxPoint;
import flixel.text.FlxText;
import flixel.ui.FlxButton.FlxTypedButton;
import flixel.util.FlxDestroyUtil;
import openfl.display.BitmapData;

/**
 * A simple button class that calls a function when clicked by the mouse.
 */
class FlxSpriteButton extends FlxTypedButton<FlxSprite> implements IFlxInput
{
	/**
	 * Creates a new FlxButton object with a gray background
	 * and a callback function on the UI thread.
	 * 
	 * @param   X          The x position of the button.
	 * @param   Y          The y position of the button.
	 * @param   Text       The text that you want to appear on the button.
	 * @param   OnClick    The function to call whenever the button is clicked.
	 */
	public function new(X:Float = 0, Y:Float = 0, ?Label:FlxSprite, ?OnClick:Void->Void)
	{
		super(X, Y, OnClick);
		
		for (point in labelOffsets)
		{
			point.set(point.x - 1, point.y + 3);
		}
		
		label = Label;
	}
	
	/**
	 * Generates text graphic for button's label.
	 * 
	 * @param	Text	text for button's label
	 * @param	font	font name for button's label
	 * @param	size	font size for button's label
	 * @param	color	text color for button's label
	 * @param	align	text align for button's label
	 * @return	this button with generated text graphic.
	 */
{'fraction_non_alphanumeric': 0.09404934687953556, 'fraction_numerical': 0.0023222060957910013, 'mean_word_length': 3.5282522996057817, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7292357', 'n_tokens_mistral': 1179, 'n_tokens_neox': 1090, 'n_words': 361}