Sha256: 4c9189a2a552e50ff31a9ac2acbdcc50efa80d7e45fcb3fa1e4b0e9305f35352

Contents?: true

Size: 470 Bytes

Versions: 2

Compression:

Stored size: 470 Bytes

Contents

# square.rb

module Ruby2D
  class Square < Rectangle

    attr_reader :size

    def initialize(opts = {})
      @type_id = 2
      @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

    def size=(s)
      self.width = self.height = @size = s
    end

    private :width=, :height=
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ruby2d-0.4.1 lib/ruby2d/square.rb
ruby2d-0.4.0 lib/ruby2d/square.rb