Method: Ruby2D::Line.draw

Defined in:
lib/ruby2d/line.rb

.draw(x1:, y1:, x2:, y2:, width:, color:) ⇒ Object

Draw a line without creating a Line

Parameters:

  • x1 (Numeric)
  • y1 (Numeric)
  • x2 (Numeric)
  • y2 (Numeric)
  • width (Numeric)

    The width or thickness of the line

  • colors (Array)

    An array or 4 arrays of colour components.



75
76
77
78
79
80
81
82
83
# File 'lib/ruby2d/line.rb', line 75

def self.draw(x1:, y1:, x2:, y2:, width:, color:)
  Window.render_ready_check

  ext_draw([
             x1, y1, x2, y2, width,
             # splat each colour's components
             *color[0], *color[1], *color[2], *color[3]
           ])
end