Skip to content

Commit

Permalink
Added getWidth
Browse files Browse the repository at this point in the history
  • Loading branch information
FlooferLand committed Jul 1, 2024
1 parent 488fc68 commit be5e0aa
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions source/funkin/ui/AtlasText.hx
Original file line number Diff line number Diff line change
Expand Up @@ -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([
Expand Down

0 comments on commit be5e0aa

Please sign in to comment.