1
0
Fork 0
mirror of https://github.com/ninjamuffin99/Funkin.git synced 2025-02-03 10:19:36 +00:00

Added getWidth

This commit is contained in:
FlooferLand! 2024-07-01 14:44:23 +03:00 committed by EliteMasterEric
parent fbc78adb65
commit cd08116aed

View file

@ -152,6 +152,32 @@ class AtlasText extends FlxTypedSpriteGroup<AtlasChar>
}
}
public function getWidth():Int
{
var width = 0;
for (char in this.text.split(""))
{
switch (char)
{
case " ":
{
width += 40;
}
case "\n":
{}
case char:
{
var sprite = new AtlasChar(atlas, char);
sprite.revive();
sprite.char = char;
sprite.alpha = 1;
width += Std.int(sprite.width);
}
}
}
return width;
}
override function toString()
{
return "InputItem, " + FlxStringUtil.getDebugString([