parent
3ced2dbef4
commit
408a71434f
2 changed files with 24 additions and 15 deletions
|
@ -384,6 +384,10 @@ function BaseWorld:draw(dt)
|
|||
self.cameras:detachView(i)
|
||||
self.cameras:drawHUD(i)
|
||||
end
|
||||
|
||||
for i=1, camNumber do
|
||||
self.cameras:drawDebugViewBox(i)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -73,19 +73,19 @@ function CameraSystem:initViews()
|
|||
|
||||
self.views.posList.multi[1] = {}
|
||||
self.views.posList.multi[1].x = -(self.views.basewidth /4)
|
||||
self.views.posList.multi[1].y = (self.views.baseheight/4)
|
||||
self.views.posList.multi[1].y = -(self.views.baseheight/4)
|
||||
|
||||
self.views.posList.multi[2] = {}
|
||||
self.views.posList.multi[2].x = (self.views.basewidth /4)
|
||||
self.views.posList.multi[2].y = (self.views.baseheight/4)
|
||||
self.views.posList.multi[2].y = -(self.views.baseheight/4)
|
||||
|
||||
self.views.posList.multi[3] = {}
|
||||
self.views.posList.multi[3].x = -(self.views.basewidth /4)
|
||||
self.views.posList.multi[3].y = -(self.views.baseheight/4)
|
||||
self.views.posList.multi[3].y = (self.views.baseheight/4)
|
||||
|
||||
self.views.posList.multi[4] = {}
|
||||
self.views.posList.multi[4].x = (self.views.basewidth /4)
|
||||
self.views.posList.multi[4].y = -(self.views.baseheight/4)
|
||||
self.views.posList.multi[4].y = (self.views.baseheight/4)
|
||||
end
|
||||
|
||||
-- INFO FUNCTIONS
|
||||
|
@ -180,6 +180,14 @@ function CameraSystem:attachView(id)
|
|||
|
||||
local viewx, viewy, vieww, viewh = self:getOnScreenViewCoordinate(id)
|
||||
cam:attach()
|
||||
|
||||
if (self:getViewNumber() > 2) or (self:getViewNumber() == 2 and SPLITSCREEN_ISVERTICAL) then
|
||||
-- FIXME: it's an ugly workaround that need to be fixed. For an unkown
|
||||
-- reason, the scissoring is wrong in and only in this function and only
|
||||
-- when we have vertical split. Thus, we need to substract viewy to viewy
|
||||
viewy = viewh - viewy
|
||||
end
|
||||
|
||||
love.graphics.setScissor(viewx, viewy, vieww, viewh)
|
||||
end
|
||||
end
|
||||
|
@ -299,11 +307,7 @@ function CameraSystem:computeCamPosition(id)
|
|||
local realy = self.views.list[id].pos.y
|
||||
|
||||
self.views.list[id].cam.x = realx - decalx
|
||||
self.views.list[id].cam.y = realy + decaly
|
||||
-- FIXME: this workaround certainly will cause some problem but that's the only
|
||||
-- solution we seem to have right now
|
||||
-- We invert the y decalage for the camera in order to work around a problem
|
||||
-- that invert the y between it and the clipping.
|
||||
self.views.list[id].cam.y = realy - decaly
|
||||
end
|
||||
|
||||
function CameraSystem:followActor(id)
|
||||
|
@ -327,9 +331,10 @@ function CameraSystem:drawDebugViewBox(id)
|
|||
local xx, yy = self:getOnScreenViewCenter(id)
|
||||
love.graphics.line(xx-3, yy, xx+3, yy)
|
||||
love.graphics.line(xx, yy-3, xx, yy+3)
|
||||
local string = id .. " x:" .. viewx .. " y:" .. viewy
|
||||
|
||||
local xx, yy = self:getInternalCamCoordinate(id)
|
||||
local string = id .. " x:" .. xx .. " y:" .. yy
|
||||
love.graphics.print(string, viewx + 4, viewy + 4)
|
||||
print(viewy)
|
||||
end
|
||||
|
||||
function CameraSystem:drawHUD(id)
|
||||
|
@ -338,11 +343,11 @@ function CameraSystem:drawHUD(id)
|
|||
local string2 = id .. " (" .. viewx .. ":" .. (viewh-viewy) .. ") "
|
||||
|
||||
|
||||
love.graphics.setScissor(viewx, viewh-viewy, vieww, viewh)
|
||||
love.graphics.translate(viewx, viewh-viewy)
|
||||
love.graphics.setScissor(viewx, viewy, vieww, viewh)
|
||||
love.graphics.translate(viewx, viewy)
|
||||
view.target:drawHUD(id, vieww, viewh)
|
||||
|
||||
love.graphics.translate(-viewx, -(viewh-viewy))
|
||||
love.graphics.translate(-viewx, -(viewy))
|
||||
love.graphics.setScissor( )
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue