void EXDynamicTimeLayer::alphaUpdate(float alpha) { mLight->removeFromParentAndCleanup(true); mLight = spriteWithColor(alpha); mLight->setPosition(ccp(mBackgroundArea.width * 0.5f, mBackgroundArea.height * 0.5f)); addChild(mLight); }
void HelloWorld::genBackground() { if (_background) { _background->removeFromParentAndCleanup(true); } Size winSize = Director::getInstance()->getWinSize(); Color4F bgColor = randomBrightColor(); _background = spriteWithColor(bgColor, 512, 512); _background->setPosition(Vec2(winSize.width / 2, winSize.height / 2)); Texture2D::TexParams tp = { GL_LINEAR, GL_LINEAR, GL_REPEAT, GL_REPEAT }; _background->getTexture()->setTexParameters(&tp); //_background->setContentSize( CCSize(winSize.width , winSize.height) ); _background->setScale(winSize.width / _background->getContentSize().width, winSize.height / _background->getContentSize().height); addChild(_background, 0); _background->setVisible(true); Color4F color3 = randomBrightColor(); Color4F color4 = randomBrightColor(); Sprite *stripes = stripedSpriteWithColor(color3, color4, 512, 512, 4); Texture2D::TexParams tp2 = { GL_LINEAR, GL_LINEAR, GL_REPEAT, GL_CLAMP_TO_EDGE }; stripes->getTexture()->setTexParameters(&tp2); _terrain->setStripes(stripes); }
void EXDynamicTimeLayer::initData() { mBackgroundArea = CCDirector::sharedDirector()->getWinSize(); mLight = spriteWithColor(0.74f); mLight->setPosition(ccp(mBackgroundArea.width * 0.5f, mBackgroundArea.height * 0.5f)); //ccTexParams tp = {GL_LINEAR, GL_LINEAR, GL_REPEAT, GL_REPEAT}; //mLight->getTexture()->setTexParameters(&tp); addChild(mLight); }