func_graphics_max2d_drawline.rst 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. .. _func_graphics_max2d_drawline:
  2. ========
  3. DrawLine
  4. ========
  5. DrawLine -
  6. Description
  7. ===========
  8. .. code-block:: blitzmax
  9. DrawLine( x#,y#,x2#,y2#,draw_last_pixel=True )
  10. Draw a line
  11. #DrawLine draws a line from @x, @y to @x2, @y2 with the current drawing color.
  12. BlitzMax commands that affect the drawing of lines include #SetLineWidth, #SetColor, #SetHandle,
  13. #SetScale, #SetRotation, #SetOrigin, #SetViewPort, #SetBlend and #SetAlpha.
  14. The optional @draw_last_pixel parameter can be used to control whether the last pixel of the line is drawn or not.
  15. Not drawing the last pixel can be useful if you are using certain blending modes.
  16. Parameters
  17. ==========
  18. Return Values
  19. =============
  20. Nothing.
  21. Examples
  22. ========
  23. .. code-block:: blitzmax
  24. ' drawline.bmx
  25. ' draws a cross hair at the mouse position using DrawLine
  26. Graphics 640,480
  27. HideMouse
  28. While Not KeyHit(KEY_ESCAPE)
  29. Cls
  30. x=MouseX()
  31. y=MouseY()
  32. DrawLine 320,240,x,y
  33. DrawLine x-2,y,x-10,y
  34. DrawLine x+2,y,x+10,y
  35. DrawLine x,y-2,x,y-10
  36. DrawLine x,y+2,x,y+10
  37. Flip
  38. Wend
  39. See Also
  40. ========