fix: fix scissoring in 2x screens
This commit is contained in:
parent
45c58bcbcd
commit
01dc81ed0f
3 changed files with 16 additions and 4 deletions
|
@ -81,6 +81,18 @@ function ScreenManager:getDimensions()
|
|||
return self.width, self.height
|
||||
end
|
||||
|
||||
-- SCISSOR FUNCTIONS
|
||||
-- Simple scissor functions
|
||||
|
||||
function ScreenManager:setScissor(x, y, width, height)
|
||||
local x, y = self:getScreenCoordinate(x, y)
|
||||
love.graphics.setScissor(x, y, width*self.data.resolution, height*self.data.resolution)
|
||||
end
|
||||
|
||||
function ScreenManager:resetScissor()
|
||||
love.graphics.setScissor( )
|
||||
end
|
||||
|
||||
-- DRAW FUNCTIONS
|
||||
-- Apply draw functions to the scene
|
||||
|
||||
|
|
|
@ -43,12 +43,12 @@ end
|
|||
function gui.drawBar(x, y, width, height)
|
||||
if (width > 0) then
|
||||
local height = height or 7
|
||||
love.graphics.setScissor(x, y, width, height)
|
||||
core.screen:setScissor(x, y, width, height)
|
||||
love.graphics.draw(barborder, x, y)
|
||||
local barwidth = math.max(width-14, 0)
|
||||
love.graphics.rectangle("fill", x+7, y, barwidth, height)
|
||||
love.graphics.draw(barborder, x+width-7, y, 0, -1, -1, 7, 7)
|
||||
love.graphics.setScissor( )
|
||||
core.screen:resetScissor( )
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -232,9 +232,9 @@ function Hero:drawHUD()
|
|||
local y = 36
|
||||
|
||||
self.assets.images["e_speedster"]:draw(x, y)
|
||||
love.graphics.setScissor(x, y-16, 32, 40)
|
||||
core.screen:setScissor(x, y-16, 32, 40)
|
||||
self.assets.sprites[self.charid]:drawAnimation(x+14, y+14)
|
||||
love.graphics.setScissor( )
|
||||
core.screen:resetScissor( )
|
||||
self.assets.images["m_speedster"]:draw(x, y)
|
||||
self.assets.images["statusbar"]:draw(x+12, y-6)
|
||||
|
||||
|
|
Loading…
Reference in a new issue