Using an older love version gives out a black screen
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
Using an older love version gives out a black screen
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
Old colors was 255 times bigger before.
Old white: 255,255,255, new white: 1,1,1.
Old white: 255,255,255, new white: 1,1,1.
-
- Party member
- Posts: 559
- Joined: Wed Oct 05, 2016 11:53 am
Re: Using an older love version gives out a black screen
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:
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.
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
Re: Using an older love version gives out a black screen
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
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
thanks! that worked!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:
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.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
Who is online
Users browsing this forum: Bing [Bot] and 9 guests