local camera = {}

camera.speed = 3

camera.position = {}
camera.position.x = 0
camera.position.y = 0

camera.target = {}
camera.target.x = 0
camera.target.y = 0

function camera:focus(x, y)
    self.target.x = x
    self.target.y = y
end

function camera:transform()
    love.graphics.translate(-self.position.x, -self.position.y)
end

function camera:transform_point(x, y)
    x = x + self.position.x
    y = y + self.position.y
    return x, y
end

function camera:update(dt)
    self.position.x = self.position.x + self.speed * (self.target.x - self.position.x) * dt
    self.position.y = self.position.y + self.speed * (self.target.y - self.position.y) * dt
end

return camera
