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.
381 382 383 384 385 386 387 388 389 |
# File 'lib/luit.rb', line 381 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.
380 381 382 |
# File 'lib/luit.rb', line 380 def h @h end |
#w ⇒ Object (readonly)
Returns the value of attribute w.
380 381 382 |
# File 'lib/luit.rb', line 380 def w @w end |
#x ⇒ Object (readonly)
Returns the value of attribute x.
380 381 382 |
# File 'lib/luit.rb', line 380 def x @x end |
#y ⇒ Object (readonly)
Returns the value of attribute y.
380 381 382 |
# File 'lib/luit.rb', line 380 def y @y end |
Instance Method Details
#draw(x = 0, y = 0) ⇒ Object
391 392 393 |
# File 'lib/luit.rb', line 391 def draw(x = 0, y = 0) @icon.draw(@x + x, @y + y, 1, @scalex, @scaley) end |
#update(x = 0, y = 0) ⇒ Object
395 396 |
# File 'lib/luit.rb', line 395 def update(x = 0, y = 0) end |