I describe the problem, it can be avoided somewhat by remembering to stretch a black sprite across all Nodes and Layers instead of assuming they’ll be black, why this particular one is both black and white and doesn’t really know itself, I don’t know. What I would say is some devices are introducing white opacity where no sprite is used, maybe because I’m using mutltiple Layers
?.
After reading a bit of the new Dev Guide I realise I’ve confused console based projects with Eclipse, as I run cocos-console to create the project I import into Eclipse, so duplicating the cocos2dx library code, which is may be why I am still using cocos2d::Layer
while everyone else is telling me to use Node
.
I’ve read [Cocos2d-x 2.2.2] Change background color and appreciate that this is probably an Android specific one, but my problem is the reverse. On almost all devices (all emulators at least) I have a black background but at least one (pesky, new, locked down, Samsung phone I can’t even see in adb devices
to debug) I am getting a white background instead. This hides my white text the game was designed for
static Color3B &invCol(const Color3B &origCol) {
static Color3B colPH = {255 - origCol.r, 255 - origCol.g, 255 - origCol.b};
return colPH;
}
static void toast2Cols(const Color3B &foreCol, const Color3B &aftBackCol) {
char tmpStr[256];
sprintf(tmpStr, "f={%d,%d,%d}, b={%d,%d,%d}",
foreCol.r,
foreCol.g,
foreCol.b,
aftBackCol.r,
aftBackCol.g,
aftBackCol.b
);
Globals::showJavaToast(tmpStr);
}
//init then contains:
//this->setOpacity(255);
//false is default and true causes failure.
//this->setCascadeColorEnabled(false);
this->setColor(Color3B::BLACK);
//Some setting of member variables
pTimerLabel = Label::createWithBMFont(fntNm, "3:00");
pTimerLabel->setColor(invCol(this->getDisplayedColor()));//Color3B::GRAY
toast2Cols(pTimerLabel->getDisplayedColor(), getColor()); //Displayed
addChild(pTimerLabel, 1);//Must be zOrder > 0, or it's not seen.
But this new Samsung phone is really weird. Not only can I not see the Label
at all when using default zOrder
(0, or -1 I think?) but when I increase that to 1 the font is still white with a darker outline, which is how I made the BMFont. The routines I show to display background (this
's) colour are reporting it as black when it is clearly white, just on this phone, that I know of.
The bottom bar is supposed to show the timer and both bars be black, I’m dumbfounded why the text box below the top bar has kept a black background when nothing is drawn there (as yet).