Class: LUIT::ClickPoint

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, #draw_rel, #updateHover, #update_rel

Constructor Details

#initialize(holder, id, x, y, r) ⇒ ClickPoint

Returns a new instance of ClickPoint.



195
196
197
198
# File 'lib/luit.rb', line 195

def initialize(holder, id, x, y, r)
	@r = [1, r].max
	super(holder, id, x - @r, y - @r, @r * 2, @r * 2)
end

Instance Method Details

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



200
201
202
203
204
205
206
# File 'lib/luit.rb', line 200

def update(x = 0, y = 0)
	if Gosu::distance($mx, $my, x, y) <= @r
		@hover = true
	else
		@hover = false
	end
end