internal static int GetTextWidth(string text, byte textsize = 13) { Text mystring = new Text(text, E_Graphics.SFMLGameFont); FloatRect textBounds = new FloatRect(); mystring.CharacterSize = System.Convert.ToUInt32(textsize); textBounds = mystring.GetLocalBounds(); return(System.Convert.ToInt32(textBounds.Width)); }
internal static int GetTextWidth(string text, byte textSize = 13) { WidthTester.DisplayedString = text; WidthTester.CharacterSize = textSize; return((int)(WidthTester.GetLocalBounds().Width)); }