Class: Ruby2D::Image

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby2d/image.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(x, y, path) ⇒ Image

Returns a new instance of Image.



8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/ruby2d/image.rb', line 8

def initialize(x, y, path)
  
  unless File.exists? path
    raise Error, "Cannot find image file `#{path}`"
  end
  
  @type_id = 3
  @x, @y, @path = x, y, path
  
  if defined? Ruby2D::DSL
    Ruby2D::Application.add(self)
  end
end

Instance Attribute Details

#xObject

Returns the value of attribute x.



6
7
8
# File 'lib/ruby2d/image.rb', line 6

def x
  @x
end

#yObject

Returns the value of attribute y.



6
7
8
# File 'lib/ruby2d/image.rb', line 6

def y
  @y
end

Instance Method Details

#removeObject



22
23
24
25
26
# File 'lib/ruby2d/image.rb', line 22

def remove
  if defined? Ruby2D::DSL
    Ruby2D::Application.remove(self)
  end
end