Replaced use of lume.rgba() with lume.color()

This commit is contained in:
rxi
2018-03-15 19:17:58 +00:00
parent 2da9d443f5
commit 110d66a413

View File

@@ -121,26 +121,36 @@ function lurker.onerror(e, nostacktrace)
local stacktrace = nostacktrace and "" or local stacktrace = nostacktrace and "" or
lume.trim((debug.traceback("", 2):gsub("\t", ""))) lume.trim((debug.traceback("", 2):gsub("\t", "")))
local msg = lume.format("{1}\n\n{2}", {e, stacktrace}) local msg = lume.format("{1}\n\n{2}", {e, stacktrace})
local colors = { 0xFF1E1E2C, 0xFFF0A3A3, 0xFF92B5B0, 0xFF66666A, 0xFFCDCDCD } local colors = {
{ lume.color("#1e1e2c", 256) },
{ lume.color("#f0a3a3", 256) },
{ lume.color("#92b5b0", 256) },
{ lume.color("#66666a", 256) },
{ lume.color("#cdcdcd", 256) },
}
love.graphics.reset() love.graphics.reset()
love.graphics.setFont(love.graphics.newFont(12)) love.graphics.setFont(love.graphics.newFont(12))
love.draw = function() love.draw = function()
local pad = 25 local pad = 25
local width = love.graphics.getWidth() local width = love.graphics.getWidth()
local function drawhr(pos, color1, color2) local function drawhr(pos, color1, color2)
local animpos = lume.smooth(pad, width - pad - 8, lume.pingpong(time())) local animpos = lume.smooth(pad, width - pad - 8, lume.pingpong(time()))
if color1 then love.graphics.setColor(lume.rgba(color1)) end if color1 then love.graphics.setColor(color1) end
love.graphics.rectangle("fill", pad, pos, width - pad*2, 1) love.graphics.rectangle("fill", pad, pos, width - pad*2, 1)
if color2 then love.graphics.setColor(lume.rgba(color2)) end if color2 then love.graphics.setColor(color2) end
love.graphics.rectangle("fill", animpos, pos, 8, 1) love.graphics.rectangle("fill", animpos, pos, 8, 1)
end end
local function drawtext(str, x, y, color, limit) local function drawtext(str, x, y, color, limit)
love.graphics.setColor(lume.rgba(color)) love.graphics.setColor(color)
love.graphics[limit and "printf" or "print"](str, x, y, limit) love.graphics[limit and "printf" or "print"](str, x, y, limit)
end end
love.graphics.setBackgroundColor(lume.rgba(colors[1]))
love.graphics.setBackgroundColor(colors[1])
love.graphics.clear() love.graphics.clear()
drawtext("An error has occurred", pad, pad, colors[2]) drawtext("An error has occurred", pad, pad, colors[2])
drawtext("lurker", width - love.graphics.getFont():getWidth("lurker") - drawtext("lurker", width - love.graphics.getFont():getWidth("lurker") -
pad, pad, colors[4]) pad, pad, colors[4])
@@ -149,6 +159,7 @@ function lurker.onerror(e, nostacktrace)
"resume", pad, pad + 46, colors[3]) "resume", pad, pad + 46, colors[3])
drawhr(pad + 72, colors[4], colors[5]) drawhr(pad + 72, colors[4], colors[5])
drawtext(msg, pad, pad + 90, colors[5], width - pad * 2) drawtext(msg, pad, pad + 90, colors[5], width - pad * 2)
love.graphics.reset() love.graphics.reset()
end end
end end