Class: LUIT::Icon

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

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#hObject (readonly)

Returns the value of attribute h.



387
388
389
# File 'lib/luit.rb', line 387

def h
  @h
end

#wObject (readonly)

Returns the value of attribute w.



387
388
389
# File 'lib/luit.rb', line 387

def w
  @w
end

#xObject (readonly)

Returns the value of attribute x.



387
388
389
# File 'lib/luit.rb', line 387

def x
  @x
end

#yObject (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