mirror of
https://github.com/ninjamuffin99/Funkin.git
synced 2025-07-01 08:06:44 +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()
|
override function toString()
|
||||||
{
|
{
|
||||||
return "InputItem, " + FlxStringUtil.getDebugString([
|
return "InputItem, " + FlxStringUtil.getDebugString([
|
||||||
|
|
Loading…
Reference in a new issue