mirror of
https://gitea.com/SweetSea-ButImNotSweet/tromi_mobile.git
synced 2025-01-08 17:33:09 +08:00
TEST
This commit is contained in:
@@ -97,20 +97,19 @@ function button:draw()
|
|||||||
love.graphics.setColor(self.borderColor)
|
love.graphics.setColor(self.borderColor)
|
||||||
love.graphics.rectangle('line', self.x, self.y, self.w, self.h, self.r)
|
love.graphics.rectangle('line', self.x, self.y, self.w, self.h, self.r)
|
||||||
end
|
end
|
||||||
---Check if current position is hovering the button, if yes, set ``self._hovering`` to true and return true
|
---Check if current position is hovering the button, if it is, return true
|
||||||
function button:isHovering(x,y)
|
function button:isHovering(x,y)
|
||||||
if not y then self._hovering = false; return false end
|
if not y then return false end
|
||||||
if
|
if
|
||||||
x >= self.x and
|
x >= self.x and
|
||||||
y >= self.y and
|
y >= self.y and
|
||||||
x <= self.x + self.w and
|
x <= self.x + self.w and
|
||||||
y <= self.y + self.h
|
y <= self.y + self.h
|
||||||
then
|
then
|
||||||
self._hovering = true
|
return true
|
||||||
else
|
else
|
||||||
self._hovering = false
|
return false
|
||||||
end
|
end
|
||||||
return self._hovering
|
|
||||||
end
|
end
|
||||||
---Trigger press action, only when ``self._hovering`` is true
|
---Trigger press action, only when ``self._hovering`` is true
|
||||||
---@param isTouch? boolean Button just released by mouse?
|
---@param isTouch? boolean Button just released by mouse?
|
||||||
|
|||||||
Reference in New Issue
Block a user