nandeck-ruby/lib/nandeck/definitions/geometry.rb

17 lines
267 B
Ruby
Raw Normal View History

2013-10-10 02:51:03 +00:00
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