cc.isFloatColor[BUG]

cocos2dx-lua 提供了这个函数,这个函数在实现上有BUG。

local function isFloatColor(c)
    return (c.r <= 1 and c.g <= 1 and c.b <= 1) and (math.ceil(c.r) ~= c.r or math.ceil(c.g) ~= c.g or math.ceil(c.b) ~= c.b)
end

如果c=cc.c4f(1,0,0,1)
那么 (c.r <= 1 and c.g <= 1 and c.b <= 1)为真,
(math.ceil(c.r) ~= c.r or math.ceil(c.g) ~= c.g or math.ceil(c.b) ~= c.b) 为假,被判断为非 浮点颜色

这是非常简单的红色,这个值原本是cc.c4b表示,通过cc.convertColor转化为cc.c4f,再转回来时,就无法变回来了。