diff --git a/gamecore/modules/world/camera/init.lua b/gamecore/modules/world/camera/init.lua index 2bdeab1..fdff2ee 100644 --- a/gamecore/modules/world/camera/init.lua +++ b/gamecore/modules/world/camera/init.lua @@ -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() diff --git a/gamecore/modules/world/camera/utils.lua b/gamecore/modules/world/camera/utils.lua index 6d47831..94d2306 100644 --- a/gamecore/modules/world/camera/utils.lua +++ b/gamecore/modules/world/camera/utils.lua @@ -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