local Object = require "classic"
local Button = Object:extend()

function Button:new(x, y, r, b, c1, c2, c3)
    self.x = x
    self.y = y
    self.r = r
    self.b = b
    self.press = false
    self.c1 = c1
    self.c2 = c2
    self.c3 = c3
end

function Button:update(dt)
    if self.b == "triggerleft" or self.b == "triggerright" then
        if fightstick:getGamepadAxis(self.b) == 1 then
            self.press = true
        else
            self.press = false
        end
    else
    if fightstick:isGamepadDown(self.b) then
            self.press = true
        else
            self.press = false
        end
    end
end

function Button:draw()
    if self.press then
        love.graphics.setColor(self.c1)
    else
        love.graphics.setColor(self.c2)
    end
    love.graphics.circle("fill", self.x + self.r, self.y + self.r, self.r+1)
    love.graphics.setColor(self.c3)
    love.graphics.circle("line", self.x + self.r, self.y+self.r, self.r+1)
end

return Button
