Browse Source

feat(utils): add drawBorder function to utils

master
Kazhnuz 1 month ago
parent
commit
a83dceee80
1 changed files with 31 additions and 0 deletions
  1. 31
    0
      gamecore/utils/graphics.lua

+ 31
- 0
gamecore/utils/graphics.lua View File

@@ -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


Loading…
Cancel
Save