23 lines
556 B
Lua
23 lines
556 B
Lua
|
local utils = {}
|
||
|
utils.colorstack = {}
|
||
|
|
||
|
-- Colors
|
||
|
|
||
|
function utils.color_push()
|
||
|
local colorstack = utils.colorstack
|
||
|
local depth = #utils.colorstack +1
|
||
|
colorstack[depth] = {}
|
||
|
colorstack[depth].r, colorstack[depth].g, colorstack[depth].b,
|
||
|
colorstack[depth].a = love.graphics.getColor()
|
||
|
end
|
||
|
|
||
|
|
||
|
function utils.color_pop()
|
||
|
local colorstack = utils.colorstack
|
||
|
love.graphics.setColor(colorstack[#colorstack].r, colorstack[#colorstack].g,
|
||
|
colorstack[#colorstack].b, colorstack[#colorstack].a)
|
||
|
table.remove(colorstack, #colorstack)
|
||
|
end
|
||
|
|
||
|
return utils
|