modules/world: add a view number limit
This commit is contained in:
parent
79ecdc822b
commit
699efeb2fb
1 changed files with 9 additions and 6 deletions
|
@ -27,7 +27,8 @@ local cwd = (...):gsub('%.camera$', '') .. "."
|
||||||
local CameraSystem = Object:extend()
|
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,13 +64,15 @@ end
|
||||||
-- Access data from the views
|
-- Access data from the views
|
||||||
|
|
||||||
function CameraSystem:addView(x, y)
|
function CameraSystem:addView(x, y)
|
||||||
local view = {}
|
if (#self.view.list < SCREEN_LIMIT) then
|
||||||
|
local view = {}
|
||||||
|
|
||||||
view.cam = View(x, y, 1, 0, true)
|
view.cam = View(x, y, 1, 0, true)
|
||||||
-- TODO: add a target system in order to make a camera able
|
-- TODO: add a target system in order to make a camera able
|
||||||
-- 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)
|
||||||
|
|
Loading…
Reference in a new issue