How to make transparent Background in CCGLSurfaceView / CCLayer ( cocos2d-android ) ?
I tried to change the superclass to CCColorLayer and set the color to ccColor4B.ccc4(0,0,0,0)
, but didn't work.
Also, I tried to set the background color to android.R.color.transparent
, but it is still opaque.
CCLayer should be transparent [no background] by default you should have a CCScene behind it with a background that will show, like this
public MainScene{
super();
CCSprite bg = CCSprite.sprite("MainBG-gl.png", true);
CGSize screen = CCDirector.sharedDirector().winSize();
bg.setPosition(CGPoint.ccp(screen.width / 2, screen.height / 2));
addChild(bg);
layer = new MainLayer();
addChild(layer);}
that'd be the constructor of your CCScene where MainLayer is your CCLayer that you wanna use [bg is the background obviously]