Class: LUIT::ClickArea

Inherits:
LUITElement show all
Defined in:
lib/luit.rb

Instance Attribute Summary

Attributes inherited from LUITElement

#h, #hover, #id, #w, #x, #y

Instance Method Summary collapse

Methods inherited from LUITElement

#button_down, #draw_rel, #updateHover, #update_rel

Constructor Details

#initialize(holder, id, x, y, w = 0, h = 0) ⇒ ClickArea

Returns a new instance of ClickArea.



93
94
95
96
97
# File 'lib/luit.rb', line 93

def initialize(holder, id, x, y, w = 0, h = 0)
	h = [1, h].max
	w = [1, w].max
	super(holder, id, x, y, w, h)
end

Instance Method Details

#draw(x = 0, y = 0) ⇒ Object



99
100
101
# File 'lib/luit.rb', line 99

def draw(x = 0, y = 0)
	Gosu::draw_rect(@x + x, @y + y, @w, @h, @hover ? LUIT.uiColorLight : LUIT.uiColor)
end

#update(x = 0, y = 0) ⇒ Object



103
104
105
106
107
108
# File 'lib/luit.rb', line 103

def update(x = 0, y = 0)
	x += @x
	y += @y
	updateHover(x, y)
	super(x, y)
end