Class: Quad

Inherits:
Object
  • Object
show all
Defined in:
lib/r2d/quad.rb

Overview

quad.rb

Direct Known Subclasses

Rectangle

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(x1, y1, x2, y2, x3, y3, x4, y4, c = "white", visible = true) ⇒ Quad

Returns a new instance of Quad.



14
15
16
17
18
19
# File 'lib/r2d/quad.rb', line 14

def initialize(x1, y1, x2, y2, x3, y3, x4, y4, c="white", visible=true)
  @x1, @y1, @x2, @y2, @x3, @y3, @x4, @y4 = x1, y1, x2, y2, x3, y3, x4, y4
  @color = c
  update_color(c)
  if visible then add end
end

Instance Attribute Details

#c1Object (readonly)

x1,y1 == top left x2,y2 == top right x3,y3 == bottom left x4,y4 == bottom right



8
9
10
# File 'lib/r2d/quad.rb', line 8

def c1
  @c1
end

#c2Object (readonly)

x1,y1 == top left x2,y2 == top right x3,y3 == bottom left x4,y4 == bottom right



8
9
10
# File 'lib/r2d/quad.rb', line 8

def c2
  @c2
end

#c3Object (readonly)

x1,y1 == top left x2,y2 == top right x3,y3 == bottom left x4,y4 == bottom right



8
9
10
# File 'lib/r2d/quad.rb', line 8

def c3
  @c3
end

#c4Object (readonly)

x1,y1 == top left x2,y2 == top right x3,y3 == bottom left x4,y4 == bottom right



8
9
10
# File 'lib/r2d/quad.rb', line 8

def c4
  @c4
end

#colorObject

x1,y1 == top left x2,y2 == top right x3,y3 == bottom left x4,y4 == bottom right



8
9
10
# File 'lib/r2d/quad.rb', line 8

def color
  @color
end

#x1Object (readonly)

x1,y1 == top left x2,y2 == top right x3,y3 == bottom left x4,y4 == bottom right



8
9
10
# File 'lib/r2d/quad.rb', line 8

def x1
  @x1
end

#x2Object (readonly)

x1,y1 == top left x2,y2 == top right x3,y3 == bottom left x4,y4 == bottom right



8
9
10
# File 'lib/r2d/quad.rb', line 8

def x2
  @x2
end

#x3Object (readonly)

x1,y1 == top left x2,y2 == top right x3,y3 == bottom left x4,y4 == bottom right



8
9
10
# File 'lib/r2d/quad.rb', line 8

def x3
  @x3
end

#x4Object (readonly)

x1,y1 == top left x2,y2 == top right x3,y3 == bottom left x4,y4 == bottom right



8
9
10
# File 'lib/r2d/quad.rb', line 8

def x4
  @x4
end

#y1Object (readonly)

x1,y1 == top left x2,y2 == top right x3,y3 == bottom left x4,y4 == bottom right



8
9
10
# File 'lib/r2d/quad.rb', line 8

def y1
  @y1
end

#y2Object (readonly)

x1,y1 == top left x2,y2 == top right x3,y3 == bottom left x4,y4 == bottom right



8
9
10
# File 'lib/r2d/quad.rb', line 8

def y2
  @y2
end

#y3Object (readonly)

x1,y1 == top left x2,y2 == top right x3,y3 == bottom left x4,y4 == bottom right



8
9
10
# File 'lib/r2d/quad.rb', line 8

def y3
  @y3
end

#y4Object (readonly)

x1,y1 == top left x2,y2 == top right x3,y3 == bottom left x4,y4 == bottom right



8
9
10
# File 'lib/r2d/quad.rb', line 8

def y4
  @y4
end

Instance Method Details

#addObject



26
27
28
# File 'lib/r2d/quad.rb', line 26

def add
  R2D::Window.add(self)
end

#removeObject



30
31
32
# File 'lib/r2d/quad.rb', line 30

def remove
  R2D::Window.remove(self)
end