diff --git a/gamecore/modules/world/camera.lua b/gamecore/modules/world/camera.lua index 4427372..4f113c0 100644 --- a/gamecore/modules/world/camera.lua +++ b/gamecore/modules/world/camera.lua @@ -46,7 +46,8 @@ function CameraSystem:initViews() self.views = {} self.views.list = {} - self.views.width, self.views.height = core.screen:getDimensions() + self.views.basewidth, self.views.baseheight = core.screen:getDimensions() + self.views.width, self.views.height = self:getViewsDimensions() end -- INFO FUNCTIONS @@ -60,6 +61,23 @@ function CameraSystem:haveView() return (self:getViewNumber() == 0) end +function CameraSystem:getViewsDimensions() + local basewidth, baseheight = self.views.basewidth, self.views.baseheight + local viewnumber = self:getViewNumber() + + if (viewnumber <= 1) then + return basewidth, baseheight + elseif (viewnumber == 2) then + if (self.verticalSplit) then + return (basewidth/2), (baseheight) + else + return (basewidth), (baseheight/2) + end + else + return (basewidth/2), (baseheight/2) + end +end + -- WRAPPER and UTILS -- Access data from the views @@ -72,6 +90,7 @@ function CameraSystem:addView(x, y) -- to target a specific object table.insert(self.views.list, view) + self.views.width, self.views.height = self:getViewsDimensions() end end