Advertisement
Guest User

Untitled

a guest
Jul 24th, 2014
210
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. if (single_line)
  2. {
  3. //Calculate the amount of characters visible
  4. //Avoid negative start character
  5. start = max(0, start);
  6. //Find minimum position
  7. ww = 0;
  8. for (a = string_length(line[0]); a >= 0; a--)
  9. {
  10. ww += string_width(string_replace(string_char_at(line[0], a), "#", "\#")) * image_xscale;
  11. b = a;
  12. if (ww > w) break;
  13. }
  14. start = min(b, start);
  15. //Calculate visible
  16. ww = 0;
  17. chars = 0;
  18. for (a = start + 1; a <= string_length(line[0]); a++)
  19. {
  20. ww += string_width(string_replace(string_char_at(line[0], a), "#", "\#")) * image_xscale;
  21. if (ww > w) break;
  22. chars++
  23. }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement