From c3391295667505c81777c44f2e3d18fac28f5b76 Mon Sep 17 00:00:00 2001 From: Kazhnuz Date: Sat, 7 Sep 2019 21:53:14 +0200 Subject: [PATCH] feat(screen): add scissoring functions --- gamecore/screen.lua | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/gamecore/screen.lua b/gamecore/screen.lua index fe23c7c..0cb4c6d 100644 --- a/gamecore/screen.lua +++ b/gamecore/screen.lua @@ -81,6 +81,19 @@ 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