Class: Core::GUI::Image
Instance Attribute Summary collapse
-
#color ⇒ Object
Returns the value of attribute color.
Attributes inherited from Element
#h, #w, #x, #xoff, #y, #yoff, #zoff
Instance Method Summary collapse
- #draw ⇒ Object
-
#initialize(x, y, img) ⇒ Image
constructor
A new instance of Image.
Methods inherited from Element
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
#color ⇒ Object
Returns the value of attribute color.
5 6 7 |
# File 'lib/gui/image.rb', line 5 def color @color end |
Instance Method Details
#draw ⇒ Object
12 13 14 |
# File 'lib/gui/image.rb', line 12 def draw @img.draw(@x, @y, Core::GUI_Z + 10, 1, 1, @color) end |