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

@@ -6,6 +6,7 @@ Rect.__index = Rect
function Rect:fromPoints(pt1, pt2)
local o = { min = pt1, max = pt2 }
setmetatable(o, self)
return o
end
function Rect:fromCoords(x1, y1, x2, y2)
@@ -64,3 +65,11 @@ function Rect:overlapsRect(other)
return self.min.x<other.max.x and self.min.x<other.max.x and
self.min.y<other.max.y and self.min.y<other.max.y
end
function Rect:draw(style)
love.graphics.rectangle(style, self.min.x - Camera.pos.x, self.min.y - Camera.pos.y, self:width(), self:height())
end
function Rect:__tostring()
return "Rect["..tostring(self.min).." "..tostring(self.max).."]"
end