diff --git a/gamecore/utils/graphics.lua b/gamecore/utils/graphics.lua index 925ddbe..4aaac79 100644 --- a/gamecore/utils/graphics.lua +++ b/gamecore/utils/graphics.lua @@ -75,6 +75,37 @@ function Graphics.printWithSpacing(text, spacing, align, x, y, r, sx, sy, ox, oy end end +-- FILTER FUNCTIONS +-- Basic filters to a drawable + +function Graphics.drawShadow(drawable, x, y, r, sx, sy, ox, oy, kx, ky) + local color = love.graphics.getColor() + love.graphics.setColor(0, 0, 0, 0) + love.graphics.draw(drawable, x+1, y+1, r, sx, sy, ox, oy, kx, ky) + love.graphics.setColor(color) + + love.graphics.draw(drawable, x, y, r, sx, sy, ox, oy, kx, ky) +end + +function Graphics.drawBorder(drawable, border, x, y, r, sx, sy, ox, oy, kx, ky) + local color = love.graphics.getColor() + local b = border or 1 + love.graphics.setColor(0, 0, 0, 0) + love.graphics.draw(drawable, x-b, y-b, limit, align, r, sx, sy, ox, oy, kx, ky) + love.graphics.draw(drawable, x , y-b, limit, align, r, sx, sy, ox, oy, kx, ky) + love.graphics.draw(drawable, x+b, y-b, limit, align, r, sx, sy, ox, oy, kx, ky) + + love.graphics.draw(drawable, x+b, y , limit, align, r, sx, sy, ox, oy, kx, ky) + love.graphics.draw(drawable, x-b, y , limit, align, r, sx, sy, ox, oy, kx, ky) + + love.graphics.draw(drawable, x-b, y+b, limit, align, r, sx, sy, ox, oy, kx, ky) + love.graphics.draw(drawable, x , y+b, limit, align, r, sx, sy, ox, oy, kx, ky) + love.graphics.draw(drawable, x+b, y+b, limit, align, r, sx, sy, ox, oy, kx, ky) + love.graphics.setColor(color) + + love.graphics.draw(drawable, x, y, r, sx, sy, ox, oy, kx, ky) +end + -- PLACEHOLDER GRAPHICS FUNCTIONS -- Ready-to-use placeolder and stuff