nandeck-ruby/lib/nandeck/definitions/geometry.rb
2013-10-09 22:51:03 -04:00

17 lines
267 B
Ruby

module Nandeck
class Geometry
def initialize(x, y, width, height)
@x, @y, @width, @height = x, y, width, height
end
def to_a
[ @x, @y, @width, @height ]
end
def center
[ @x + @width / 2, @y + @height / 2 ]
end
end
end