From b61b35d5fbd4d159589244b5bf90ba3da621d39e Mon Sep 17 00:00:00 2001 From: Sasha Szpakowski Date: Fri, 20 Dec 2024 20:40:53 -0400 Subject: [PATCH] move gammacorrect, renderers, and excluderenderers love.conf options to a new t.graphics table. --- src/modules/love/boot.lua | 39 ++++++++++++++++++++++++++++++--------- src/scripts/nogame.lua | 2 +- src/scripts/nogame.lua.h | 4 ++-- 3 files changed, 33 insertions(+), 12 deletions(-) diff --git a/src/modules/love/boot.lua b/src/modules/love/boot.lua index 6fb7a5eac..976e44b06 100644 --- a/src/modules/love/boot.lua +++ b/src/modules/love/boot.lua @@ -181,6 +181,11 @@ function love.init() centered = true, usedpiscale = true, }, + graphics = { + gammacorrect = false, + renderers = nil, + excluderenderers = nil, + }, modules = { data = true, event = true, @@ -210,10 +215,10 @@ function love.init() identity = false, appendidentity = false, externalstorage = false, -- Only relevant for Android. - gammacorrect = false, + gammacorrect = nil, -- Moved to t.graphics. highdpi = false, - renderers = nil, - excluderenderers = nil, + renderers = nil, -- Moved to t.graphics. + excluderenderers = nil, -- Moved to t.graphics. } -- Console hack, part 1. @@ -243,18 +248,26 @@ function love.init() end if love._setGammaCorrect then + local gammacorrect = false + if type(c.graphics) == "table" then + gammacorrect = c.graphics.gammacorrect + end + if c.gammacorrect ~= nil then + love.markDeprecated(2, "t.gammacorrect in love.conf", "field", "replaced", "t.graphics.gammacorrect") + gammacorrect = c.gammacorrect + end love._setGammaCorrect(c.gammacorrect) end if love._setRenderers then local renderers = love._getDefaultRenderers() if type(c.renderers) == "table" then - renderers = {} - for i,v in ipairs(c.renderers) do - renderers[i] = v - end + love.markDeprecated(2, "t.renderers in love.conf", "field", "replaced", "t.graphics.renderers") + renderers = c.renderers + end + if type(c.graphics) == "table" and type(c.graphics.renderers) == "table" then + renderers = c.graphics.renderers end - if love.arg.options.renderers.set then local renderersstr = love.arg.options.renderers.arg[1] renderers = {} @@ -262,7 +275,15 @@ function love.init() table.insert(renderers, r) end end - local excluderenderers = c.excluderenderers + + local excluderenderers = nil + if type(c.excluderenderers) == "table" then + love.markDeprecated(2, "t.excluderenderers in love.conf", "field", "replaced", "t.graphics.excluderenderers") + excluderenderers = c.excluderenderers + end + if type(c.graphics) == "table" and type(c.graphics.excluderenderers) == "table" then + excluderenderers = c.graphics.excluderenderers + end if love.arg.options.excluderenderers.set then local excludestr = love.arg.options.excluderenderers.arg[1] excluderenderers = {} diff --git a/src/scripts/nogame.lua b/src/scripts/nogame.lua index 3fe8c67df..92f529c44 100644 --- a/src/scripts/nogame.lua +++ b/src/scripts/nogame.lua @@ -3271,7 +3271,7 @@ function love.nogame() function love.conf(t) t.title = "L\195\150VE " .. love._version .. " (" .. love._version_codename .. ")" - t.gammacorrect = true + t.graphics.gammacorrect = true t.modules.audio = false t.modules.sound = false t.modules.joystick = false diff --git a/src/scripts/nogame.lua.h b/src/scripts/nogame.lua.h index 83feae732..255df76c8 100644 --- a/src/scripts/nogame.lua.h +++ b/src/scripts/nogame.lua.h @@ -12107,8 +12107,8 @@ const unsigned char nogame_lua[] = 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x20, 0x2e, 0x2e, 0x20, 0x22, 0x20, 0x28, 0x22, 0x20, 0x2e, 0x2e, 0x20, 0x6c, 0x6f, 0x76, 0x65, 0x2e, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x20, 0x2e, 0x2e, 0x20, 0x22, 0x29, 0x22, 0x0a, - 0x09, 0x09, 0x74, 0x2e, 0x67, 0x61, 0x6d, 0x6d, 0x61, 0x63, 0x6f, 0x72, 0x72, 0x65, 0x63, 0x74, 0x20, 0x3d, - 0x20, 0x74, 0x72, 0x75, 0x65, 0x0a, + 0x09, 0x09, 0x74, 0x2e, 0x67, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x73, 0x2e, 0x67, 0x61, 0x6d, 0x6d, 0x61, + 0x63, 0x6f, 0x72, 0x72, 0x65, 0x63, 0x74, 0x20, 0x3d, 0x20, 0x74, 0x72, 0x75, 0x65, 0x0a, 0x09, 0x09, 0x74, 0x2e, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x73, 0x2e, 0x61, 0x75, 0x64, 0x69, 0x6f, 0x20, 0x3d, 0x20, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x0a, 0x09, 0x09, 0x74, 0x2e, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x73, 0x2e, 0x73, 0x6f, 0x75, 0x6e, 0x64, 0x20,