class Triangle

triangle.rb

Attributes

c1[RW]
c2[RW]
c3[RW]
color[R]
x1[RW]
x2[RW]
x3[RW]
y1[RW]
y2[RW]
y3[RW]

Public Class Methods

new(x1, y1, x2, y2, x3, y3, c="white", visible=true) click to toggle source
# File lib/r2d/triangle.rb, line 10
def initialize(x1, y1, x2, y2, x3, y3, c="white", visible=true)
  @x1, @y1 = x1, y1
  @x2, @y2 = x2, y2
  @x3, @y3 = x3, y3
  @color = c
  update_color(c)
  if visible then add end
end

Public Instance Methods

add() click to toggle source
# File lib/r2d/triangle.rb, line 24
def add
  R2D::Window.add(self)
end
color=(c) click to toggle source
# File lib/r2d/triangle.rb, line 19
def color=(c)
  update_color(c)
  @color = c
end
remove() click to toggle source
# File lib/r2d/triangle.rb, line 28
def remove
  R2D::Window.remove(self)
end

Private Instance Methods

update_color(c) click to toggle source
# File lib/r2d/triangle.rb, line 34
def update_color(c)
  @c1 = R2D::Color.new(c)
  @c2 = R2D::Color.new(c)
  @c3 = R2D::Color.new(c)
end