mirror of
https://github.com/ninjamuffin99/Funkin.git
synced 2025-02-03 10:19:36 +00:00
Added getWidth
This commit is contained in:
parent
fbc78adb65
commit
cd08116aed
|
@ -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