Advertisement
szymski

Untitled

Dec 30th, 2016
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. static void DrawRotatedText(int x, int y, string text, float rotation)
  2. {
  3. float originX = 80, originY = 11;
  4.  
  5. var lines = text.Split('\n');
  6.  
  7. for (int i = 0; i < lines.Length; i++)
  8. {
  9. for (int j = 0; j < lines[i].Length; j++)
  10. {
  11. float fromOriginX = j - originX, fromOriginY = i - originY;
  12. float newX, newY;
  13.  
  14. float s = (float)Math.Sin(rotation);
  15. float c = (float)Math.Cos(rotation);
  16.  
  17. newX = (fromOriginX * s - fromOriginY * c);
  18. newY = (fromOriginX * c + fromOriginY * s);
  19.  
  20. fastConsole.WriteChar((int)Math.Round(x + newX), (int)Math.Round(y + newY), lines[i][j], ConsoleColor.White, ConsoleColor.DarkBlue);
  21. }
  22. }
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement