diff options
| -rw-r--r-- | lib/ruby2d/square.rb | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/ruby2d/square.rb b/lib/ruby2d/square.rb index 500381a..d890bb1 100644 --- a/lib/ruby2d/square.rb +++ b/lib/ruby2d/square.rb @@ -21,6 +21,23 @@ module Ruby2D self.width = self.height = @size = s end + + def self.draw(x: 0, y: 0, z: 0, size: 100) + + @width = @height = @size = size || 100 + + @x = opts[:x] || 0 + @y = opts[:y] || 0 + @z = opts[:z] || 0 + + self.color = opts[:color] || 'white' + self.opacity = opts[:opacity] if opts[:opacity] + update_coords(@x, @y, @size, @size) + + ext_draw(x, y, c) + end + + # Make the inherited width and height attribute accessors private private :width=, :height= |
