Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

colors still borked, I have a fix, will work on pull. #5

Open
09jlardinois opened this issue Aug 25, 2018 · 0 comments
Open

colors still borked, I have a fix, will work on pull. #5

09jlardinois opened this issue Aug 25, 2018 · 0 comments

Comments

@09jlardinois
Copy link

-- 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant