Guest User

draw_ring (GM) (Improved)

a guest
Apr 5th, 2013
43
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*
  2. ** usage:
  3. ** draw_ring(x, y, radius, thickness, quality)
  4. **
  5. ** given:
  6. ** x,y center point of the ring
  7. ** radius distance from the center to the outermost point of the ring
  8. ** thickness thickness of the ring outline
  9. ** quality granularity of the drawing, ie number of vertices. default 32. try low numbers like 3-8 to make outlined n-gons.
  10. **
  11. **
  12. ** GMLscripts.com
  13. */
  14. {
  15. var xx=argument0,yy=argument1,rad=argument2,thick=argument3,qual=32;
  16. if argument4>0{qual = argument4;}
  17.  
  18. draw_primitive_begin(pr_trianglestrip);
  19. var i;
  20. for(i=0;i<=qual;i+=1)
  21. {
  22. draw_vertex(xx+lengthdir_x(rad,i*360/qual),yy+lengthdir_y(rad,i*360/qual));
  23. draw_vertex(xx+lengthdir_x(rad-thick,(i)*360/qual),yy+lengthdir_y(rad-thick,(i)*360/qual));
  24. }
  25. draw_primitive_end();
  26. }
RAW Paste Data