Sha256: 416ff932835f30895f545e6195601c7fd03701a73250fd647156440296590f35

Contents?: true

Size: 1.18 KB

Versions: 2

Compression:

Stored size: 1.18 KB

Contents

module Ray
  class Drawable
    include Ray::PP

    # @group Transformations

    def y
      pos.y
    end

    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

    # @endgroup

    def pretty_print(q, other_attributes = [])
      # Note: This doesn't use %w[...] arrays because YARD can't parse them
      attributes = [
                    "origin", "pos", "z", "scale", "angle",
                    "matrix", "matrix_proc",
                    "shader", "shader_attributes",
                    "vertex_count", "index_count", "changed?", "textured?",
                    "blend_mode"
                   ]

      pretty_print_attributes q, attributes + other_attributes
    end

    # @return [Hash, nil] Attributes passed to the shader when the object is
    #   drawn.
    attr_accessor :shader_attributes

    alias zoom  scale
    alias zoom= scale=

    alias position  pos
    alias position= pos=
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ray-0.2.1 lib/ray/drawable.rb
ray-0.2.0 lib/ray/drawable.rb