You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
-- Takes a table of user-defined colors and adapts them for version checking.
function colorLoader(colorTable)
-- Is Love2D running at version 11? Return true then, otherwise, false.
local love11 = love.getVersion() == 11
-- Pop the table in a var.
local colors = colorTable
-- For every color you put in the table,
--it should equal the first value you entered
--(the Love2D version 11 value) or else the
-- second value you entered (the alternate, old value)
for k, v in pairs(colors) do
colors[k] = love11 and v[1] or v[2]
end
-- Gimme my table back so I can use it!
return colors
end
function love.load()
-- global color table, gColors (shortened to make using it easier)
gc = {
-- Shortened, gColors{}
white = {1, 255},
darkgrey = {40/255, 40},
blue = {103/255, 103},
opaque = {1, 255},
halfalpha = {0.5, 128}
}
-- take the color table gColors and adapt it for
-- version checking, and reassign its values
-- to its adapted ones.
gc = colorLoader(gc)
end
The text was updated successfully, but these errors were encountered:
The text was updated successfully, but these errors were encountered: