cant remember

This commit is contained in:
entoreor 2020-04-10 11:31:26 -06:00
parent bf1be5f1f8
commit d298e536ea
4 changed files with 34 additions and 28 deletions

View File

@ -10,5 +10,5 @@ window.infatuated = {};
var game = url.searchParams.get("game");
infatuated.game = game ? "game-"+game : "game";
var shim = url.searchParams.get("shim");
infatuated.shim = shim ? shim : false;
infatuated.shim = shim ? shim : "";
})();

View File

@ -129,7 +129,12 @@ function infatuated.msgbox:hide()
end
infatuated.path = window.infatuated.game:gsub("%.", "/")
infatuated.shim = window.infatuated.shim
infatuated.shims = {}
local i = 0
for name in (window.infatuated.shim..","):gmatch("(.+),") do
i = i+1
infatuated.shims[i] = name
end
print("Running game from path %q", infatuated.path)
@ -152,7 +157,7 @@ function infatuated.crash(errmsg)
{"OK"},
function() end
)
infatuated.loopGuest = function() end
coroutine.yield()
elseif infatuated.crashInternal then
infatuated.msgbox:show(
"Fatal error",
@ -160,7 +165,7 @@ function infatuated.crash(errmsg)
{"OK"},
function() end
)
infatuated.loopGuest = function() end
coroutine.yield()
else
infatuated.crashed = true
infatuated.loopGuest = love.errorhandler(errmsg)
@ -172,9 +177,9 @@ function infatuated.parseColor(r, g, b, a)
return infatuated.parseColor(r[1], r[2], r[3], r[4])
elseif type(r) == "number" then
a = a or 1
assert(type(g) == "number", "bad argument #2 to parseColor")
assert(type(b) == "number", "bad argument #3 to parseColor")
assert(type(a) == "number", "bad argument #4 to parseColor")
assert(type(g) == "number", "bad argument #2 to parseColor (expected number)")
assert(type(b) == "number", "bad argument #3 to parseColor (expected number)")
assert(type(a) == "number", "bad argument #4 to parseColor (expected number)")
r, g, b, a = r*255, g*255, b*255, a
return {r, g, b, a}, string.format("rgba(%f, %f, %f, %f)", r, g, b, a)
else
@ -207,7 +212,7 @@ function love.errorhandler(msg)
--local br, bg, bb = 89, 157, 220
local fr, fg, fb = 223, 223, 223
local br, bg, bb = 48, 48, 48
if infatuated.shim ~= "0.9.0" then
if love._version ~= "0.9.0" then
fr, fg, fb, br, bg, bb = fr/255, fg/255, fb/255, br/255, bg/255, bb/255
end
love.graphics.setColor(fr, fg, fb)
@ -278,10 +283,10 @@ infatuated.thread = coroutine.create(function()
love.run()
if infatuated.shim then
print("Shimming %s", infatuated.shim)
local shim = infatuated.shim:gsub("%.", "-")
require("shims."..shim)
for i, path in ipairs(infatuated.shims) do
print("Shimming %s", path)
path = path:gsub("%.", "-")
require("shims."..path)
end
love._version = infatuated.version
love._version_codename = infatuated.versionCodename

View File

@ -1,16 +1 @@
infatuated.version = "0.9.0"
infatuated.versionCodename = "Baby Inspector"
function infatuated.parseColor(r, g, b, a)
if type(r) == "table" then
return infatuated.parseColor(r[1], r[2], r[3], r[4])
elseif type(r) == "number" then
a = a or 255
assert(type(g) == "number", "bad argument #2 to parseColor")
assert(type(b) == "number", "bad argument #3 to parseColor")
assert(type(a) == "number", "bad argument #4 to parseColor")
r, g, b, a = r, g, b, a/255
return {r, g, b, a}, string.format("rgba(%f, %f, %f, %f)", r, g, b, a)
else
error("bad argument #1 to parseColor")
end
end
require("shims.oldcolor")

16
shims/oldcolor.lua Normal file
View File

@ -0,0 +1,16 @@
infatuated.version = "0.9.0"
infatuated.versionCodename = "Baby Inspector"
function infatuated.parseColor(r, g, b, a)
if type(r) == "table" then
return infatuated.parseColor(r[1], r[2], r[3], r[4])
elseif type(r) == "number" then
a = a or 255
assert(type(g) == "number", "bad argument #2 to parseColor")
assert(type(b) == "number", "bad argument #3 to parseColor")
assert(type(a) == "number", "bad argument #4 to parseColor")
r, g, b, a = r, g, b, a/255
return {r, g, b, a}, string.format("rgba(%f, %f, %f, %f)", r, g, b, a)
else
error("bad argument #1 to parseColor")
end
end