mirror of
https://github.com/FunkinCrew/Funkin.git
synced 2025-01-20 14:40:06 -05:00
Added getWidth
This commit is contained in:
parent
488fc6888f
commit
be5e0aafeb
1 changed files with 26 additions and 0 deletions
|
@ -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([
|
||||
|
|
Loading…
Reference in a new issue