Sha256: 79118010090257e15f82fe17763f0efedc1fa6de30e85d851b27e16e9478f7e9
Contents?: true
Size: 796 Bytes
Versions: 2
Compression:
Stored size: 796 Bytes
Contents
# Ruby2D::Image module Ruby2D class Image include Renderable attr_reader :path, :color attr_accessor :x, :y, :width, :height, :rotate, :data def initialize(opts = {}) @path = opts[:path] unless RUBY_ENGINE == 'opal' unless File.exists? @path raise Error, "Cannot find image file `#{@path}`" end end @x = opts[:x] || 0 @y = opts[:y] || 0 @z = opts[:z] || 0 @width = opts[:width] || nil @height = opts[:height] || nil @rotate = opts[:rotate] || 0 self.color = opts[:color] || 'white' ext_init(@path) add end def color=(c) @color = Color.new(c) end def contains?(x, y) @x < x and @x + @width > x and @y < y and @y + @height > y end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
ruby2d-0.6.1 | lib/ruby2d/image.rb |
ruby2d-0.6.0 | lib/ruby2d/image.rb |