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.rectangle('line', self.x, self.y, self.w, self.h, self.r)
|
||||
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)
|
||||
if not y then self._hovering = false; return false end
|
||||
if not y then return false end
|
||||
if
|
||||
x >= self.x and
|
||||
y >= self.y and
|
||||
x <= self.x + self.w and
|
||||
y <= self.y + self.h
|
||||
then
|
||||
self._hovering = true
|
||||
return true
|
||||
else
|
||||
self._hovering = false
|
||||
return false
|
||||
end
|
||||
return self._hovering
|
||||
end
|
||||
---Trigger press action, only when ``self._hovering`` is true
|
||||
---@param isTouch? boolean Button just released by mouse?
|
||||
|
||||
Reference in New Issue
Block a user