local w = {}

function w.new(inner, x, y, w, h)
    local r = {
        transform = love.math.newTransform(x, y),
        width = w,
        height = h
    }

    function r:transformPoint(x, y)
        local x, y = transform:transformPoint(x, y)
        if 0 <= x and x <= width and 0 <= y and y <= height then
            return x, y
        else
            return nil
        end
    end

    function r:mousepressed(m, x, y)
        return inner:mousepressed(m, x, y)
    end

    function r:draw()
        love.graphics.push()
        love.graphics.applyTransform(self.transform)
        inner:draw()
        love.graphics.pop()
    end

    return r
end

return w