Page 1 of 1
Using an older love version gives out a black screen
Posted: Fri Feb 26, 2021 3:10 pm
by DerpChest
I am using supertoast to test detecting love versions, but it gives out a black screen.
Re: Using an older love version gives out a black screen
Posted: Fri Feb 26, 2021 3:11 pm
by DerpChest
DerpChest wrote: ↑Fri Feb 26, 2021 3:10 pm
I am using supertoast to test detecting love versions, but it gives out a black screen.
and yes, I did add the main.lua in the zip and turned it into a .love
Re: Using an older love version gives out a black screen
Posted: Fri Feb 26, 2021 3:13 pm
by darkfrei
Old colors was 255 times bigger before.
Old white: 255,255,255, new white: 1,1,1.
Re: Using an older love version gives out a black screen
Posted: Sat Feb 27, 2021 9:20 am
by MrFariator
As darkfrei said, the range love.graphics.setColor uses was changed from 0-255 to 0-1 in
version 11.0 of löve. In order to run your code in an older version, you could add this code snippet, in main.lua or elsewhere:
Code: Select all
local originalSetColor = love.graphics.setColor
love.graphics.setColor = function ( r, g, b, a )
r = r or 1
g = g or 1
b = b or 1
a = a or 1
originalSetColor ( r * 255, g * 255, b * 255, a * 255 )
end
There is also
Polyamory, but I don't think it's quite intended for backporting a löve application made in a newer version to an older version.
Re: Using an older love version gives out a black screen
Posted: Sat Feb 27, 2021 9:30 am
by darkfrei
Actually the color can be defined as table, with or without indexing.
Code: Select all
love.graphics.setColor = function ( r, g, b, a )
if type(r) == "table" then
local t = r
r=t[1] or r[r] or 1
g=t[2] or r[g] or 1
b=t[3] or r[b] or 1
a=t[4] or r[a] or 1
else --
r = r or 1
g = g or 1
b = b or 1
a = a or 1
end
originalSetColor ( r * 255, g * 255, b * 255, a * 255 ) -- old Löve version
end
Re: Using an older love version gives out a black screen
Posted: Sat Feb 27, 2021 11:16 am
by pgimeno
There's
cindy too, but it works the other way around. You can use colours in the range 0-255 and include the library only if you're in Löve 11.
Re: Using an older love version gives out a black screen
Posted: Sat Feb 27, 2021 3:42 pm
by DerpChest
MrFariator wrote: ↑Sat Feb 27, 2021 9:20 am
As darkfrei said, the range love.graphics.setColor uses was changed from 0-255 to 0-1 in
version 11.0 of löve. In order to run your code in an older version, you could add this code snippet, in main.lua or elsewhere:
Code: Select all
local originalSetColor = love.graphics.setColor
love.graphics.setColor = function ( r, g, b, a )
r = r or 1
g = g or 1
b = b or 1
a = a or 1
originalSetColor ( r * 255, g * 255, b * 255, a * 255 )
end
There is also
Polyamory, but I don't think it's quite intended for backporting a löve application made in a newer version to an older version.
thanks! that worked!