isMouseInCircle
واضحة من الاسم
x, y = احداثيات الدائرة
r = نصف قطر الدائرة
local sx, sy = guiGetScreenSize( )
function isMouseInPosition(x, y, w, h)
if isCursorShowing( ) then
local cx, cy = getCursorPosition( )
local cx, cy = cx*sx, cy*sy
return cx >= x and cx <= x+w and cy >= y and cy <= y+h
end
return false
end
function isMouseInCircle(x, y, r)
local i = 0
for k=(-r), r do
local q = math.sqrt((r/2)*(r/2)-k*k)
if isMouseInPosition(x-q+(r/2), y+k+(r/2), 2*q, 1) then
i = i+1
end
end
return i ~= (-r)+r
end