Browse Source

move gammacorrect, renderers, and excluderenderers love.conf options to a new t.graphics table.

Sasha Szpakowski 8 months ago
parent
commit
b61b35d5fb
3 changed files with 33 additions and 12 deletions
  1. 30 9
      src/modules/love/boot.lua
  2. 1 1
      src/scripts/nogame.lua
  3. 2 2
      src/scripts/nogame.lua.h

+ 30 - 9
src/modules/love/boot.lua

@@ -181,6 +181,11 @@ function love.init()
 			centered = true,
 			centered = true,
 			usedpiscale = true,
 			usedpiscale = true,
 		},
 		},
+		graphics = {
+			gammacorrect = false,
+			renderers = nil,
+			excluderenderers = nil,
+		},
 		modules = {
 		modules = {
 			data = true,
 			data = true,
 			event = true,
 			event = true,
@@ -210,10 +215,10 @@ function love.init()
 		identity = false,
 		identity = false,
 		appendidentity = false,
 		appendidentity = false,
 		externalstorage = false, -- Only relevant for Android.
 		externalstorage = false, -- Only relevant for Android.
-		gammacorrect = false,
+		gammacorrect = nil, -- Moved to t.graphics.
 		highdpi = false,
 		highdpi = false,
-		renderers = nil,
-		excluderenderers = nil,
+		renderers = nil, -- Moved to t.graphics.
+		excluderenderers = nil, -- Moved to t.graphics.
 	}
 	}
 
 
 	-- Console hack, part 1.
 	-- Console hack, part 1.
@@ -243,18 +248,26 @@ function love.init()
 	end
 	end
 
 
 	if love._setGammaCorrect then
 	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)
 		love._setGammaCorrect(c.gammacorrect)
 	end
 	end
 
 
 	if love._setRenderers then
 	if love._setRenderers then
 		local renderers = love._getDefaultRenderers()
 		local renderers = love._getDefaultRenderers()
 		if type(c.renderers) == "table" then
 		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
 		end
-
 		if love.arg.options.renderers.set then
 		if love.arg.options.renderers.set then
 			local renderersstr = love.arg.options.renderers.arg[1]
 			local renderersstr = love.arg.options.renderers.arg[1]
 			renderers = {}
 			renderers = {}
@@ -262,7 +275,15 @@ function love.init()
 				table.insert(renderers, r)
 				table.insert(renderers, r)
 			end
 			end
 		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
 		if love.arg.options.excluderenderers.set then
 			local excludestr = love.arg.options.excluderenderers.arg[1]
 			local excludestr = love.arg.options.excluderenderers.arg[1]
 			excluderenderers = {}
 			excluderenderers = {}

+ 1 - 1
src/scripts/nogame.lua

@@ -3271,7 +3271,7 @@ function love.nogame()
 
 
 	function love.conf(t)
 	function love.conf(t)
 		t.title = "L\195\150VE " .. love._version .. " (" .. love._version_codename .. ")"
 		t.title = "L\195\150VE " .. love._version .. " (" .. love._version_codename .. ")"
-		t.gammacorrect = true
+		t.graphics.gammacorrect = true
 		t.modules.audio = false
 		t.modules.audio = false
 		t.modules.sound = false
 		t.modules.sound = false
 		t.modules.joystick = false
 		t.modules.joystick = false

+ 2 - 2
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, 
 	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, 
 	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,
 	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, 
 	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,
 	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, 
 	0x09, 0x09, 0x74, 0x2e, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x73, 0x2e, 0x73, 0x6f, 0x75, 0x6e, 0x64, 0x20,