multiselect region can be drawn with the right mouse button

This commit is contained in:
binarycat
2022-03-12 13:16:39 -05:00
parent f091fba9f7
commit 82246dc0c6
3 changed files with 61 additions and 1 deletions

View File

@@ -77,3 +77,16 @@ function Camera:positionAt(x,y)
self.pos.y = math.floor((y/self.height)*self.height)
end
-- translate screen coordinates to game coordinates
function Camera:ptScreenToGame(pt)
return self.pos + pt
end
function Camera:mouseScreenPos()
return Point:new(love.mouse.getX(),love.mouse.getY()) / game.scale
end
-- return the mouse position as game coordinates
function Camera:mouseGamePos()
return self:ptScreenToGame(self:mouseScreenPos())
end