Method: Ruby2D::Square#initialize
- Defined in:
- lib/ruby2d/square.rb
#initialize(opts = {}) ⇒ Square
Returns a new instance of Square.
8 9 10 11 12 13 14 15 16 17 |
# 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' self.color.opacity = opts[:opacity] if opts[:opacity] update_coords(@x, @y, @size, @size) add end |