improvement(camera): make getViewsDimensions a wrapper around a camutil

This commit is contained in:
Kazhnuz 2019-07-14 23:12:22 +02:00
parent 7376d75aeb
commit f9a268a51a
2 changed files with 17 additions and 13 deletions

View file

@ -73,21 +73,11 @@ function CameraSystem:haveView()
return (self:getViewNumber() == 0)
end
function CameraSystem:getViewsDimensions(viewNumber)
function CameraSystem:getViewsDimensions()
local basewidth, baseheight = self.views.basewidth, self.views.baseheight
local viewnumber = viewNumber or self:getViewNumber()
local viewnumber = self:getViewNumber()
if (viewnumber <= 1) then
return basewidth, baseheight
elseif (viewnumber == 2) then
if (self.verticalSplit) then
return (basewidth), (baseheight/2)
else
return (basewidth/2), (baseheight)
end
else
return (basewidth/2), (baseheight/2)
end
return camutils.getViewsDimensions(viewnumber, basewidth, baseheight, self.verticalSplit)
end
function CameraSystem:recalculateViewsPositions()

View file

@ -43,4 +43,18 @@ function camutils.getViewsPositions(basewidth, baseheight, verticalSplit)
return posList
end
function camutils.getViewsDimensions(viewnumber, basewidth, baseheight, verticalSplit)
if (viewnumber <= 1) then
return basewidth, baseheight
elseif (viewnumber == 2) then
if (verticalSplit) then
return (basewidth), (baseheight/2)
else
return (basewidth/2), (baseheight)
end
else
return (basewidth/2), (baseheight/2)
end
end
return camutils