Class: Core::GUI::Image

Inherits:
Element show all
Defined in:
lib/gui/image.rb

Instance Attribute Summary collapse

Attributes inherited from Element

#h, #w, #x, #xoff, #y, #yoff, #zoff

Instance Method Summary collapse

Methods inherited from Element

#remove?, #update

Constructor Details

#initialize(x, y, img) ⇒ Image

Returns a new instance of Image.



6
7
8
9
10
11
# File 'lib/gui/image.rb', line 6

def initialize(x, y, img)
  @img = Core.sprite("gui/#{img}")
  w, h, = @img.width, @img.height
  super(x, y, w, h)
  @color = Gosu::Color.new(255, 255, 255, 255)
end

Instance Attribute Details

#colorObject

Returns the value of attribute color.



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

def color
  @color
end

Instance Method Details

#drawObject



12
13
14
# File 'lib/gui/image.rb', line 12

def draw
  @img.draw(@x, @y, Core::GUI_Z + 10, 1, 1, @color)
end