Class: Image

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

Overview

image.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(x, y, path, visible = true) ⇒ Image

Returns a new instance of Image.



8
9
10
11
12
13
14
15
# File 'lib/r2d/image.rb', line 8

def initialize(x, y, path, visible=true)
  @x, @y, @path = x, y, path
  @f_x, @f_y = 1, 1
  @image = R2D::Adapters.image(path)
  @o_w, @o_h = @image.width, @image.height
  @width, @height = @o_w, @o_h
  if visible then add end
end

Instance Attribute Details

#f_xObject (readonly)

Returns the value of attribute f_x.



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

def f_x
  @f_x
end

#f_yObject (readonly)

Returns the value of attribute f_y.



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

def f_y
  @f_y
end

#heightObject

Returns the value of attribute height.



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

def height
  @height
end

#widthObject

Returns the value of attribute width.



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

def width
  @width
end

#xObject

Returns the value of attribute x.



5
6
7
# File 'lib/r2d/image.rb', line 5

def x
  @x
end

#yObject

Returns the value of attribute y.



5
6
7
# File 'lib/r2d/image.rb', line 5

def y
  @y
end

Instance Method Details

#adapterObject



35
36
37
# File 'lib/r2d/image.rb', line 35

def adapter
  @image
end

#addObject



27
28
29
# File 'lib/r2d/image.rb', line 27

def add
  R2D::Window.add(self)
end

#removeObject



31
32
33
# File 'lib/r2d/image.rb', line 31

def remove
  R2D::Window.remove(self)
end