epervier-old/gamecore/modules/world/camera/utils.lua

60 lines
1.4 KiB
Lua

local camutils = {}
function camutils.getViewsPositions(basewidth, baseheight, verticalSplit)
local posList = {}
posList.dual = {}
posList.multi = {}
if (verticalSplit) then
posList.dual[1] = {}
posList.dual[1].x = 0
posList.dual[1].y = (baseheight/4)
posList.dual[2] = {}
posList.dual[2].x = 0
posList.dual[2].y = -(baseheight/4)
else
posList.dual[1] = {}
posList.dual[1].x = -(basewidth/4)
posList.dual[1].y = 0
posList.dual[2] = {}
posList.dual[2].x = (basewidth/4)
posList.dual[2].y = 0
end
posList.multi[1] = {}
posList.multi[1].x = -(basewidth /4)
posList.multi[1].y = -(baseheight/4)
posList.multi[2] = {}
posList.multi[2].x = (basewidth /4)
posList.multi[2].y = -(baseheight/4)
posList.multi[3] = {}
posList.multi[3].x = -(basewidth /4)
posList.multi[3].y = (baseheight/4)
posList.multi[4] = {}
posList.multi[4].x = (basewidth /4)
posList.multi[4].y = (baseheight/4)
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