diff --git a/sonic-radiance.love/core/screen.lua b/sonic-radiance.love/core/screen.lua index fe23c7c..8033749 100644 --- a/sonic-radiance.love/core/screen.lua +++ b/sonic-radiance.love/core/screen.lua @@ -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 diff --git a/sonic-radiance.love/game/modules/gui/init.lua b/sonic-radiance.love/game/modules/gui/init.lua index 41483ce..d4f71f4 100644 --- a/sonic-radiance.love/game/modules/gui/init.lua +++ b/sonic-radiance.love/game/modules/gui/init.lua @@ -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 diff --git a/sonic-radiance.love/scenes/battlesystem/actors/hero.lua b/sonic-radiance.love/scenes/battlesystem/actors/hero.lua index f6bfdff..1a7dc95 100644 --- a/sonic-radiance.love/scenes/battlesystem/actors/hero.lua +++ b/sonic-radiance.love/scenes/battlesystem/actors/hero.lua @@ -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)