Sha256: cd8b7392e722ad40df9b0da10eac5ef4bd33327970edc6fa8ce4dd87d5218c07

Contents?: true

Size: 685 Bytes

Versions: 1

Compression:

Stored size: 685 Bytes

Contents

module Dedalus
  module Elements
    class Sprite < Image
      attr_accessor :asset_width, :asset_height, :frame

      def asset
        @asset ||= Dedalus::ImageRepository.lookup_tiles(path, asset_width, asset_height)[frame]
      end

      def width
        2*padding + (asset_width * scale)
      end

      def height
        2*padding + (asset_height * scale)
      end

      def self.example_data
        {
          path: "media/images/tiles.png",
          frame: 3,
          asset_width: 64,
          asset_height: 64,
          invert_x: true,
          scale: 2.5
        }
      end

      def self.description
        "an animated image"
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
dedalus-0.2.15 lib/dedalus/elements/sprite.rb