feat(utils): add drawBorder function to utils
This commit is contained in:
parent
ad295bf9c9
commit
a83dceee80
1 changed files with 31 additions and 0 deletions
|
@ -75,6 +75,37 @@ function Graphics.printWithSpacing(text, spacing, align, x, y, r, sx, sy, ox, oy
|
||||||
end
|
end
|
||||||
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
|
-- PLACEHOLDER GRAPHICS FUNCTIONS
|
||||||
-- Ready-to-use placeolder and stuff
|
-- Ready-to-use placeolder and stuff
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue