Class: Ruby2D::Square
Instance Attribute Summary collapse
-
#size ⇒ Object
Returns the value of attribute size.
Attributes inherited from Rectangle
Attributes inherited from Quad
#c1, #c2, #c3, #c4, #color, #x1, #x2, #x3, #x4, #y1, #y2, #y3, #y4
Attributes included from Renderable
Instance Method Summary collapse
-
#initialize(opts = {}) ⇒ Square
constructor
A new instance of Square.
Methods inherited from Rectangle
Methods inherited from Quad
Methods included from Renderable
#add, #contains?, #opacity, #opacity=, #remove
Constructor Details
#initialize(opts = {}) ⇒ Square
Returns a new instance of Square.
8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/ruby2d/square.rb', line 8 def initialize(opts = {}) @x = opts[:x] || 0 @y = opts[:y] || 0 @z = opts[:z] || 0 @width = @height = @size = opts[:size] || 100 self.color = opts[:color] || 'white' update_coords(@x, @y, @size, @size) add end |
Instance Attribute Details
#size ⇒ Object
Returns the value of attribute size.
6 7 8 |
# File 'lib/ruby2d/square.rb', line 6 def size @size end |