-
Notifications
You must be signed in to change notification settings - Fork 86
Open
Description
-- 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
Metadata
Metadata
Assignees
Labels
No labels