lib/ray/drawable.rb in ray-0.1.0.pre1 vs lib/ray/drawable.rb in ray-0.1.0

- old
+ new

@@ -1,16 +1,41 @@ module Ray class Drawable - # Draws the drawable on an image. - def draw_on(image) - image.draw_drawable self + def y + pos.y end - # Draws the drawable. - # - # @option opts [Ray::Image] :on (Ray.screen) The image to draw the drawable - # on. - def draw(opts = {}) - draw_on(opts[:on] || Ray.screen) + def x + pos.x end + + def y=(val) + self.pos = [x, val] + end + + def x=(val) + self.pos = [val, y] + end + + def scale_x + scale.x + end + + def scale_y + scale.y + end + + def scale_x=(val) + self.scale = [val, scale_y] + end + + def scale_y=(val) + self.scale = [scale_x, val] + end + + alias zoom scale + alias zoom= scale= + + alias position pos + alias position= pos= end end