Advertisement
Guest User

Untitled

a guest
Aug 18th, 2018
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.80 KB | None | 0 0
  1.         /// <summary>
  2.         /// Returns the position of any given character in m_Text.
  3.         /// </summary>
  4.         /// <param name="CharacterIndex">The index of the character.</param>
  5.         /// <returns>THe position of the character indexed by <paramref name="CharacterIndex"/></returns>
  6.         private Vector2 CharacterPosition(int CharacterIndex)
  7.         {
  8.             float SquareWidth = m_Font.MeasureString(GetLine(1)).X;
  9.             float SquareHeight = m_Font.MeasureString(GetLine(1)).Y * m_NumLinesInText;
  10.             Vector2 CharSize = m_Font.MeasureString(GetLine(1));
  11.  
  12.             float XPosition = (CharacterIndex * CharSize.X) / SquareWidth;
  13.             float YPosition = (CharacterIndex * CharSize.Y) / SquareHeight;
  14.  
  15.             return new Vector2(XPosition, YPosition);
  16.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement