modules/world: add a view number limit

This commit is contained in:
Kazhnuz 2019-04-29 10:42:43 +02:00
parent 79ecdc822b
commit 699efeb2fb

View file

@ -28,6 +28,7 @@ local CameraSystem = Object:extend()
local View = require(cwd .. "libs.hump.camera") local View = require(cwd .. "libs.hump.camera")
local SPLITSCREEN_ISVERTICAL = false local SPLITSCREEN_ISVERTICAL = false
local SCREEN_LIMIT = 4
-- INIT FUNCTIONS -- INIT FUNCTIONS
-- Initialize the camera system -- Initialize the camera system
@ -63,6 +64,7 @@ end
-- Access data from the views -- Access data from the views
function CameraSystem:addView(x, y) function CameraSystem:addView(x, y)
if (#self.view.list < SCREEN_LIMIT) then
local view = {} local view = {}
view.cam = View(x, y, 1, 0, true) view.cam = View(x, y, 1, 0, true)
@ -70,6 +72,7 @@ function CameraSystem:addView(x, y)
-- to target a specific object -- to target a specific object
table.insert(self.views.list, view) table.insert(self.views.list, view)
end
end end
function CameraSystem:getView(id) function CameraSystem:getView(id)