Class: LUIT::Icon
- Inherits:
-
Object
- Object
- LUIT::Icon
- Defined in:
- lib/luit.rb
Instance Attribute Summary collapse
-
#h ⇒ Object
readonly
Returns the value of attribute h.
-
#w ⇒ Object
readonly
Returns the value of attribute w.
-
#x ⇒ Object
readonly
Returns the value of attribute x.
-
#y ⇒ Object
readonly
Returns the value of attribute y.
Instance Method Summary collapse
- #draw(x = 0, y = 0) ⇒ Object
-
#initialize(path, x, y, w, h) ⇒ Icon
constructor
A new instance of Icon.
- #update(x = 0, y = 0) ⇒ Object
Constructor Details
#initialize(path, x, y, w, h) ⇒ Icon
Returns a new instance of Icon.
388 389 390 391 392 393 394 395 396 |
# File 'lib/luit.rb', line 388 def initialize(path, x, y, w, h) @icon = Gosu::Image.new(path) @scalex = (w / @icon.width) @scaley = (h / @icon.height) @x = x @y = y @w = w @h = h end |
Instance Attribute Details
#h ⇒ Object (readonly)
Returns the value of attribute h.
387 388 389 |
# File 'lib/luit.rb', line 387 def h @h end |
#w ⇒ Object (readonly)
Returns the value of attribute w.
387 388 389 |
# File 'lib/luit.rb', line 387 def w @w end |
#x ⇒ Object (readonly)
Returns the value of attribute x.
387 388 389 |
# File 'lib/luit.rb', line 387 def x @x end |
#y ⇒ Object (readonly)
Returns the value of attribute y.
387 388 389 |
# File 'lib/luit.rb', line 387 def y @y end |
Instance Method Details
#draw(x = 0, y = 0) ⇒ Object
398 399 400 |
# File 'lib/luit.rb', line 398 def draw(x = 0, y = 0) @icon.draw(@x + x, @y + y, 1, @scalex, @scaley) end |
#update(x = 0, y = 0) ⇒ Object
402 403 |
# File 'lib/luit.rb', line 402 def update(x = 0, y = 0) end |