本文整理汇总了C++中TableViewCell::setColor方法的典型用法代码示例。如果您正苦于以下问题:C++ TableViewCell::setColor方法的具体用法?C++ TableViewCell::setColor怎么用?C++ TableViewCell::setColor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TableViewCell
的用法示例。
在下文中一共展示了TableViewCell::setColor方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CCLOG
cocos2d::extension::TableViewCell* HelpInfoUI::tableCellAtIndex(cocos2d::extension::TableView *table, ssize_t idx)
{
CCLOG("%zd",idx);
cocos2d::Size size = Director::getInstance()->getVisibleSize();
Color3B color = SceneFactory::getInstance()->getSceneColor();
TableViewCell *cell = table->cellAtIndex(idx);
if (!cell) {
cell = TableViewCell::create();
cell->setCascadeColorEnabled(true);
cell->setColor(color);
switch (idx) {
case 0:
{
Label* desc = Label::createWithTTF(CommonUtility::getLocalString("GameDesc"),CommonUtility::getLocalString("CommonFont"), 25, cocos2d::Size(550, 300), TextHAlignment::LEFT, TextVAlignment::TOP);
desc->setPosition(Vec2(size.width*0.62f, size.height*0.5f));
cell->addChild(desc);
Sprite *conwaySprite = Sprite::create("Conway.png");
conwaySprite->setPosition(Vec2(size.width*0.2f, size.height*0.5f));
cell->addChild(conwaySprite);
}
break;
case 1:
{
Label* gameRule = Label::createWithTTF(CommonUtility::getLocalString("GameRule"),CommonUtility::getLocalString("CommonFont"), 22, cocos2d::Size(850, 300), TextHAlignment::LEFT, TextVAlignment::TOP);
gameRule->setPosition(Vec2(size.width*0.5f, size.height*0.62f));
cell->addChild(gameRule);
Label* detail = Label::createWithTTF(CommonUtility::getLocalString("GameRuleDetail"),CommonUtility::getLocalString("CommonFont"), 22, cocos2d::Size(660, 300), TextHAlignment::LEFT, TextVAlignment::TOP);
detail->setPosition(Vec2(size.width*0.6f, size.height*0.435f));
cell->addChild(detail);
Label* ruleEnd = Label::createWithTTF(CommonUtility::getLocalString("GameRuleEnd"),CommonUtility::getLocalString("CommonFont"), 22, cocos2d::Size(850, 300), TextHAlignment::LEFT, TextVAlignment::TOP);
ruleEnd->setPosition(Vec2(size.width*0.5f, size.height*0.15f));
cell->addChild(ruleEnd);
Animation *animation = Animation::create();
for (int i = 1; i <= 2; i++)
{
std::string str = String::createWithFormat("sample%d.png",i)->getCString();
animation->addSpriteFrameWithFile(str);
}
animation->setDelayPerUnit(0.5f);
animation->setRestoreOriginalFrame(true);
Animate *action = Animate::create(animation);
Sprite *sampleSprite = Sprite::create();
sampleSprite->setPosition(Vec2(size.width*0.15f, size.height*0.53f));
sampleSprite->setScale(0.3f);
sampleSprite->runAction(RepeatForever::create(action));
cell->addChild(sampleSprite);
}
break;
case 2:
{
Label* patterns = Label::createWithTTF(CommonUtility::getLocalString("Patterns"),CommonUtility::getLocalString("CommonFont"), 22, cocos2d::Size(850, 300), TextHAlignment::LEFT, TextVAlignment::TOP);
patterns->setPosition(Vec2(size.width*0.5f, size.height*0.6f));
cell->addChild(patterns);
Label* stillLifes = Label::createWithTTF(CommonUtility::getLocalString("Stable"),CommonUtility::getLocalString("CommonFont"), 22, cocos2d::Size(850, 300), TextHAlignment::LEFT, TextVAlignment::TOP);
stillLifes->setPosition(Vec2(size.width*0.5f, size.height*0.52f));
cell->addChild(stillLifes);
Label* oscillators = Label::createWithTTF(CommonUtility::getLocalString("Oscillating"),CommonUtility::getLocalString("CommonFont"), 22, cocos2d::Size(850, 300), TextHAlignment::LEFT, TextVAlignment::TOP);
oscillators->setPosition(Vec2(size.width*0.5f, size.height*0.21f));
cell->addChild(oscillators);
Sprite *stilllife1 = Sprite::create("stilllife1.png");
stilllife1->setPosition(Vec2(size.width*0.2f, size.height*0.58f));
stilllife1->setScale(0.3f);
cell->addChild(stilllife1);
Sprite *stilllife2 = Sprite::create("stilllife2.png");
stilllife2->setPosition(Vec2(size.width*0.4f, size.height*0.58f));
stilllife2->setScale(0.3f);
cell->addChild(stilllife2);
Sprite *stilllife3 = Sprite::create("stilllife3.png");
stilllife3->setPosition(Vec2(size.width*0.6f, size.height*0.58f));
stilllife3->setScale(0.3f);
cell->addChild(stilllife3);
Sprite *stilllife4 = Sprite::create("stilllife4.png");
stilllife4->setPosition(Vec2(size.width*0.8f, size.height*0.58f));
stilllife4->setScale(0.3f);
cell->addChild(stilllife4);
Sprite *oscillators1 = Sprite::create("oscillators1.png");
oscillators1->setPosition(Vec2(size.width*0.2f, size.height*0.27f));
oscillators1->setScale(0.3f);
cell->addChild(oscillators1);
Sprite *oscillators2 = Sprite::create("oscillators2.png");
oscillators2->setPosition(Vec2(size.width*0.4f, size.height*0.27f));
oscillators2->setScale(0.3f);
cell->addChild(oscillators2);
Sprite *oscillators3 = Sprite::create("oscillators3.png");
oscillators3->setPosition(Vec2(size.width*0.6f, size.height*0.27f));
//.........这里部分代码省略.........