Skip to content

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

@09jlardinois

Description

@09jlardinois
-- 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

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions