Skip to content

Commit

Permalink
move gammacorrect, renderers, and excluderenderers love.conf options …
Browse files Browse the repository at this point in the history
…to a new t.graphics table.
  • Loading branch information
slime73 committed Dec 21, 2024
1 parent 8ca321b commit b61b35d
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 12 deletions.
39 changes: 30 additions & 9 deletions src/modules/love/boot.lua
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,11 @@ function love.init()
centered = true,
usedpiscale = true,
},
graphics = {
gammacorrect = false,
renderers = nil,
excluderenderers = nil,
},
modules = {
data = true,
event = true,
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -243,26 +248,42 @@ 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 = {}
for r in renderersstr:gmatch("[^,]+") do
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 = {}
Expand Down
2 changes: 1 addition & 1 deletion src/scripts/nogame.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/scripts/nogame.lua.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit b61b35d

Please sign in to comment.