---@type pd_graphics_lib
local gfx <const> = playdate.graphics

local ThrowMeterHeight <const> = 50

---@param x number
---@param y number
function throwMeter:draw(x, y)
    gfx.setLineWidth(1)
    gfx.drawRect(x, y, 14, ThrowMeterHeight)
    if self.lastReadThrow then
        -- TODO: If ratio is "perfect", show some additional effect
        local ratio = (self.lastReadThrow - throwMeter.MinCharge) / (self.idealPower - throwMeter.MinCharge)
        local height = ThrowMeterHeight * ratio
        gfx.fillRect(x + 2, y + ThrowMeterHeight - height, 10, height)
    end
    -- TODO: Dither or bend if the user throws too hard
    -- Or maybe dither if it's too soft - bend if it's too hard
end

function throwMeter:drawNearFielder(fielder)
    if not fielder then
        return
    end
    throwMeter:draw(fielder.x - 25, fielder.y - 10)
end
