Update button module

This commit is contained in:
Squishy (C6H12O6+NaCl+H2O)
2024-05-21 22:34:45 +07:00
parent cdcd71a256
commit 7cf9d0cadc
2 changed files with 26 additions and 12 deletions

View File

@@ -14,11 +14,14 @@ BUTTON.setDefaultOption{
draw = function(self)
local need_big_font = (self.font == FONT_big)
love.graphics.setColor(0, 0, 0, 0.8)
love.graphics.setColor(self.backgroundColor)
love.graphics.rectangle('fill', self.x, self.y, self.w, self.h, self.r)
if self._hovering then
love.graphics.setColor(0.4, 1, 1, 0.5)
if self._pressed then
love.graphics.setColor(self.pressColor)
love.graphics.rectangle('fill', self.x, self.y, self.w, self.h, self.r)
elseif self._hovering then
love.graphics.setColor(self.hoverColor)
love.graphics.rectangle('fill', self.x, self.y, self.w, self.h, self.r)
end
@@ -48,6 +51,8 @@ BUTTON.setDefaultOption{
love.graphics.setLineWidth(1)
love.graphics.rectangle('line', self.x, self.y, self.w, self.h, self.r)
end,
backgroundColor = {0, 0, 0, 0.8},
pressColor = {0.4, 1, 1, 0.5}
}
-- Graphics