本文整理汇总了C++中MenuItemFont::setColor方法的典型用法代码示例。如果您正苦于以下问题:C++ MenuItemFont::setColor方法的具体用法?C++ MenuItemFont::setColor怎么用?C++ MenuItemFont::setColor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MenuItemFont
的用法示例。
在下文中一共展示了MenuItemFont::setColor方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: init
bool GameOver::init()
{
LayerColor::initWithColor(Color4B::WHITE);
Size size = Director::getInstance()->getVisibleSize();
auto label = LabelTTF::create("Game Over","arial",36);
label->setColor(Color3B::BLACK);
label->setPosition(size.width/2,size.height/2);
addChild(label);
MenuItemFont::setFontSize(60);
MenuItemFont::setFontName("arial");
MenuItemFont* item = MenuItemFont::create("play again", CC_CALLBACK_1(GameOver::onMenuCallBack, this));
item->setColor(Color3B::BLACK);
Menu* mu = Menu::create(item, nullptr);
mu->setPosition(size.width / 2, size.height / 2 - 60);
addChild(mu);
return true;
}
示例2: SelectedNewLevel
void MPix::EditorMenu::BuildEditorsMenu()
{
MenuItemFont::setFontSize(64);
auto menu = Menu::create();
MenuItemFont* item = nullptr;
// New
item = MenuItemFont::create(LocalUTF8Char("New"), [&](Ref *sender) {
SelectedNewLevel();
}); menu->addChild(item);
// Last
item = MenuItemFont::create(LocalUTF8Char("Last"), [&](Ref *sender) {
SelectedLast();
}); menu->addChild(item);
auto ss = LocalUTF8Str("Export") + "\n" + LevelStorage::getInstance()->GetExportDir();
item = MenuItemFont::create(ss.c_str(), [&](Ref *sender) {
SelectedExportMap();
}); menu->addChild(item); item->setScale(0.5f); item->setColor(Color3B::GREEN);
item = MenuItemFont::create(LocalUTF8Char("Edit"), [&](Ref *sender) {
SelectedEdit();
}); menu->addChild(item);
item = MenuItemFont::create(LocalUTF8Char("Delete"), [&](Ref *sender) {
SelectedDelete();
}); menu->addChild(item); item->setColor(Color3B::RED);
item = MenuItemFont::create(LocalUTF8Char("Back"), [&](Ref *sender) {
BackToMainMenu();
}); menu->addChild(item);
menu->alignItemsVertically();
auto s = Director::getInstance()->getWinSize();
menu->setPosition(Vector2(s.width/2, s.height/2));
addChild(menu, 2);
edit_m = menu;
}
示例3: onEnter
void TestPerformance::onEnter()
{
ArmatureTestLayer::onEnter();
MenuItemFont::setFontSize(65);
MenuItemFont *decrease = MenuItemFont::create(" - ", CC_CALLBACK_1(TestPerformance::onDecrease, this));
decrease->setColor(Color3B(0,200,20));
MenuItemFont *increase = MenuItemFont::create(" + ", CC_CALLBACK_1(TestPerformance::onIncrease, this));
increase->setColor(Color3B(0,200,20));
Menu *menu = Menu::create(decrease, increase, nullptr);
menu->alignItemsHorizontally();
menu->setPosition(VisibleRect::getVisibleRect().size.width/2, VisibleRect::getVisibleRect().size.height-100);
addChild(menu, 10000);
armatureCount = frames = times = lastTimes = 0;
generated = false;
addArmature(100);
}
示例4: init
bool MDPauseMenu::init(MDPauseMenuInterfaz* target)
{
if (CCLayerColor::initWithColor(ccc4(0, 0, 0, 200)) )
{
mTarget = target;
Size visibleSize = Director::getInstance()->getVisibleSize();
// Menu items
MenuItemFont *btResume = MenuItemFont::create("Resume",
this,
menu_selector(MDPauseMenu::resumeGame));
btResume->setColor(ccc3(255, 255, 255));
btResume->setAnchorPoint(ccp(0.5, 1));
btResume->setPosition(ccp(0, 0));
MenuItemFont *btRetry = MenuItemFont::create("Retry",
this,
menu_selector(MDPauseMenu::retryGame));
btRetry->setColor(ccc3(255, 255, 255));
btRetry->setAnchorPoint(ccp(0.5, 1));
btRetry->setPosition(ccp(0, btResume->getPosition().y - btResume->getContentSize().height - MENU_ITEMS_SPACING));
MenuItemFont *btExit = MenuItemFont::create("Exit",
this,
menu_selector(MDPauseMenu::quitGame));
btExit->setColor(ccc3(255, 255, 255));
btExit->setAnchorPoint(ccp(0.5, 1));
btExit->setPosition(ccp(0, btRetry->getPosition().y - btRetry->getContentSize().height - MENU_ITEMS_SPACING));
// Menu
Menu *menu = Menu::create(btResume, btRetry, btExit, NULL);
menu->setPosition(ccp(visibleSize.width / 2, visibleSize.height / 2));
addChild(menu);
return true;
}
return false;
}
示例5: showInGameMenuLayer
void StoreScene::showInGameMenuLayer() {
Size winSize = Director::getInstance()->getWinSize();
InGameMenuLayer* _inGameMenuLayer = InGameMenuLayer::create();
addChild(_inGameMenuLayer);
MenuItemFont *menuButton = MenuItemFont::create("Menu", this,menu_selector(StoreScene::menuButtonCallback));
menuButton->setColor(Color3B(0,0,0));
menuButton->setPosition(Point(winSize.width - menuButton->getContentSize().width, winSize.height - menuButton->getContentSize().height));
Menu *pMenu = Menu::create(menuButton,NULL);
pMenu->setPosition(Point::ZERO);
_inGameMenuLayer->addChild(pMenu, 1);
}
示例6: createGameScene
cocos2d::Node* SceneEditorTestLayer::createGameScene()
{
Node *pNode = SceneReader::getInstance()->createNodeWithSceneFile("scenetest/FishJoy2.json");
if (pNode == NULL)
{
return NULL;
}
_curNode = pNode;
MenuItemFont *itemBack = MenuItemFont::create("Back", CC_CALLBACK_1(SceneEditorTestLayer::toExtensionsMainLayer, this));
itemBack->setColor(Color3B(255, 255, 255));
itemBack->setPosition(Point(VisibleRect::rightBottom().x - 50, VisibleRect::rightBottom().y + 25));
Menu *menuBack = Menu::create(itemBack, NULL);
menuBack->setPosition(Point(0.0f, 0.0f));
menuBack->setZOrder(4);
pNode->addChild(menuBack);
//ui action
cocos2d::extension::ActionManagerEx::shareManager()->playActionByName("startMenu_1.json","Animation1");
return pNode;
}
示例7: init
bool TestFragmentEffect::init()
{
if ( !TestBase::init() )
{
return false;
}
//都是菜单设置,可以不看
MenuItemFont* MIF0 = MenuItemFont::create("ES_NONE");
MIF0->setColor(Color3B::RED);
MIF0->setTag(0);
MenuItemFont* MIF1 = MenuItemFont::create("ES_BLACK_AND_WHITE");
MIF1->setColor(Color3B::RED);
MIF1->setTag(0);
MenuItemFont* MIF2 = MenuItemFont::create("ES_OLD_PHOTOS");
MIF2->setColor(Color3B::RED);
MIF2->setTag(0);
MenuItemFont* MIF3 = MenuItemFont::create("ES_INVERT");
MIF3->setColor(Color3B::RED);
MIF3->setTag(0);
MenuItemFont* MIF4 = MenuItemFont::create("ES_BURNS");
MIF4->setColor(Color3B::RED);
MIF4->setTag(0);
MenuItemFont* MIF5 = MenuItemFont::create("ES_POISONING");
MIF5->setColor(Color3B::RED);
MIF5->setTag(0);
MenuItemFont* MIF6 = MenuItemFont::create("ES_COLD");
MIF6->setColor(Color3B::RED);
MIF6->setTag(0);
MenuItemFont* MIF7 = MenuItemFont::create("ES_USER_DEFINED");
MIF7->setColor(Color3B::RED);
MIF7->setTag(0);
m_sel = MenuItemToggle::createWithCallback(CC_CALLBACK_1(TestFragmentEffect::toggleCallback,this),MIF0,MIF1,MIF2,MIF3,MIF4,MIF5,MIF6,MIF7,NULL);
m_sel->setTag(0);
m_sel->setAnchorPoint(Vec2(0.5f,1.0f));
m_sel->setPosition(Vec2(m_visibleOrigin.x + m_visibleSize.width / 2,
m_visibleOrigin.y + m_visibleSize.height - 7));
MenuItemImage* last = MenuItemImage::create("FragmentEffect/lastNor.png","FragmentEffect/lastCli.png","",CC_CALLBACK_1(TestFragmentEffect::toggleCallback,this));
last->setTag(-1);
last->setAnchorPoint(Vec2(0.5f,1.0f));
last->setPosition(Vec2(m_visibleOrigin.x + m_visibleSize.width / 10 * 1,
m_visibleOrigin.y + m_visibleSize.height));
MenuItemImage* next = MenuItemImage::create("FragmentEffect/nextNor.png","FragmentEffect/nextCli.png","",CC_CALLBACK_1(TestFragmentEffect::toggleCallback,this));
next->setTag(1);
next->setAnchorPoint(Vec2(0.5f,1.0f));
next->setPosition(Vec2(m_visibleOrigin.x + m_visibleSize.width / 10 * 9,
m_visibleOrigin.y + m_visibleSize.height));
MenuItemFont* UDF = MenuItemFont::create("goto ES_USER_DEFINED",CC_CALLBACK_1(TestFragmentEffect::gotoUserDefine,this));
UDF->setColor(Color3B::RED);
UDF->setTag(0);
UDF->setPosition(Vec2(m_visibleOrigin.x + m_visibleSize.width / 2,
m_visibleOrigin.y + m_visibleSize.height - 50.0f));
Menu* pMenu = Menu::create(m_sel,last,next,UDF,NULL);
pMenu->setPosition(Vec2::ZERO);
this->addChild(pMenu, 1);
m_bgSprite = Sprite::create("FragmentEffect/HelloWorld.png");
m_bgSprite->setPosition(Vec2(m_visibleOrigin.x + m_visibleSize.width / 2,
m_visibleOrigin.y + m_visibleSize.height / 2));
this->addChild(m_bgSprite, 0);
//加载骨骼动画
ArmatureDataManager::getInstance()->addArmatureFileInfo("FragmentEffect/Hero0.png","FragmentEffect/Hero0.plist","FragmentEffect/Hero.ExportJson");
m_armature = Armature::create("Hero");
m_armature->getAnimation()->playWithIndex(0);
m_armature->setPosition(Vec2(m_visibleOrigin.x+m_visibleSize.width/2, 0.0f));
m_armature->setAnchorPoint(Vec2(0.5f,0.0f));
this->addChild(m_armature,1);
//淡出淡入这样的动作依然可以使用
m_armature->runAction(Sequence::create(FadeOut::create(0.5f),FadeIn::create(0.5f),0));
//就这几句是设置效果的,toggleCallback 和 gotoUserDefine方法里面也有
m_indexSprite = FragmentEffect::getInstance()->addEffectNode(m_bgSprite); //m_indexSprite接收返回的序号,setEffect 和 getEffectSelect 的时候使用
m_indexArmature = FragmentEffect::getInstance()->addEffectNode(m_armature); //m_indexArmature接收返回的序号,setEffect 和 getEffectSelect 的时候使用
float f[] = {
0.5f,0.0f,0.0f,0.0f,
0.0f,0.5f,0.0f,0.0f,
0.0f,0.0f,0.5f,0.0f,
0.0f,0.0f,0.0f,0.5f
};
FragmentEffect::getInstance()->addEffectMatrix(Mat4(f));//增加自定义特效矩阵,序号从 ES_USER_DEFINED 开始增加
return true;
}
示例8: initWithSubTest
void LabelMainScene::initWithSubTest(int nodes)
{
//srandom(0);
auto s = Director::getInstance()->getWinSize();
_lastRenderedCount = 0;
_quantityNodes = 0;
_accumulativeTime = 0.0f;
_labelContainer = Layer::create();
addChild(_labelContainer);
MenuItemFont::setFontSize(65);
auto decrease = MenuItemFont::create(" - ", CC_CALLBACK_1(LabelMainScene::onDecrease, this));
decrease->setColor(Color3B(0,200,20));
auto increase = MenuItemFont::create(" + ", CC_CALLBACK_1(LabelMainScene::onIncrease, this));
increase->setColor(Color3B(0,200,20));
auto menu = Menu::create(decrease, increase, NULL);
menu->alignItemsHorizontally();
menu->setPosition(Vec2(s.width/2, s.height-65));
addChild(menu, 1);
auto infoLabel = Label::createWithTTF("0 nodes", "fonts/Marker Felt.ttf", 30);
infoLabel->setColor(Color3B(0,200,20));
infoLabel->setPosition(Vec2(s.width/2, s.height-90));
addChild(infoLabel, 1, kTagInfoLayer);
// add menu
auto menuLayer = new LabelMenuLayer(true, TEST_COUNT, LabelMainScene::_s_labelCurCase);
addChild(menuLayer, 1, kTagMenuLayer);
menuLayer->release();
/**
* auto test menu
*/
auto menuAutoTest = Menu::create();
menuAutoTest->setPosition( Vec2::ZERO );
MenuItemFont::setFontName("fonts/arial.ttf");
MenuItemFont::setFontSize(24);
MenuItemFont* autoTestItem = NULL;
if (LabelMainScene::_s_autoTest)
{
autoTestItem = MenuItemFont::create("Auto Test On",CC_CALLBACK_1(LabelMainScene::onAutoTest, this));
}
else
{
autoTestItem = MenuItemFont::create("Auto Test Off",CC_CALLBACK_1(LabelMainScene::onAutoTest, this));
}
autoTestItem->setTag(1);
autoTestItem->setPosition(Vec2( s.width - 90, s.height / 2));
autoTestItem->setColor(Color3B::RED);
menuAutoTest->addChild(autoTestItem);
addChild( menuAutoTest, 3, kTagAutoTestMenu );
_title = Label::createWithTTF(title().c_str(), "fonts/arial.ttf", 32);
addChild(_title, 1);
_title->setPosition(Vec2(s.width/2, s.height-50));
while(_quantityNodes < nodes)
onIncrease(this);
}
示例9: init
bool MenuLayer::init()
{
if (!Layer::init())
{
return false;
}
//播放菜单场景的音乐
if (soundOn)
{
SimpleAudioEngine::getInstance()->playBackgroundMusic((MUSIC + "menuMusic.mp3").c_str(), true);
}
//获取整个设备的尺寸
//auto size = Director::getInstance()->getWinSize();
//创建Menu背景
Sprite* bg = Sprite::create(IMG_BG + "img_bg_logo.jpg");
bg->setPosition(Vec2(SIZE_WIDTH / 2, SIZE_HEIGHT / 2));
addChild(bg);
Sprite* logo = Sprite::create(IMG_BG + "logo.png");
logo->setPosition(Vec2(SIZE_WIDTH / 2, SIZE_HEIGHT * 2 / 3 + 15));
addChild(logo);
//创建Menu菜单项-play
MenuItemImage *itemPlay= MenuItemImage::create(IMG_MENU + "play_nor.png", IMG_MENU + "play_pre.png",CC_CALLBACK_1(MenuLayer::playIsPressed, this));
//创建Menu菜单项-score
MenuItemImage *itemScore= MenuItemImage::create(IMG_MENU + "score_nor.png", IMG_MENU + "score_pre.png",CC_CALLBACK_1(MenuLayer::scoreIsPressed, this));
itemScore->setPosition(Vec2(0,-itemScore->getContentSize().height-20));
//创建Menu菜单项-about
MenuItemImage *itemAbout= MenuItemImage::create(IMG_MENU + "about_nor.png", IMG_MENU + "about_pre.png",CC_CALLBACK_1(MenuLayer::aboutIsPressed, this));
itemAbout->setPosition(Vec2(0,-itemScore->getContentSize().height*2-40));
//创建Menu菜单项-settings
MenuItemImage *itemSettings = MenuItemImage::create(IMG_MENU + "setting.png", IMG_MENU + "setting.png",CC_CALLBACK_1(MenuLayer::setttingsIsPressed, this));
itemSettings->setPosition(Vec2(0,-itemScore->getContentSize().height*3-40));
//test
MenuItemFont *test = MenuItemFont::create("test", CC_CALLBACK_1(MenuLayer::testIsPressed, this));
test->setColor(Color3B(255, 0, 0));
test->setPosition(Vec2(0,-itemScore->getContentSize().height*4-40));
//利用3个菜单项创建Menu菜单
Menu * menu = Menu::create(itemPlay,itemScore,itemAbout,itemSettings,test,NULL);
menu->setPosition(Vec2(SIZE_WIDTH / 2, SIZE_HEIGHT / 3 - 10));
addChild(menu);
menu->alignItemsVerticallyWithPadding(10);
auto textureCache = Director::getInstance()->getTextureCache();
textureCache->addImageAsync(IMG_PLAYER + "plane1.png", CC_CALLBACK_1(MenuLayer::loadCallback, this, "plan_yellow"));
textureCache->addImageAsync(IMG_PLAYER + "plane5.png", CC_CALLBACK_1(MenuLayer::loadCallback, this, "plan_red"));
textureCache->addImageAsync(IMG_PLAYER + "plane22.png", CC_CALLBACK_1(MenuLayer::loadCallback, this, "plan_blue"));
textureCache->addImageAsync(IMG_PLAYER + "icon_hp.png", CC_CALLBACK_1(MenuLayer::loadCallback, this, "player_hp"));
textureCache->addImageAsync(IMG_PLAYER + "playerBullet.png", CC_CALLBACK_1(MenuLayer::loadCallback, this, IMG_PLAYER + "playerBullet.plist"));
textureCache->addImageAsync(IMG_PLAYER + "hp.png", CC_CALLBACK_1(MenuLayer::loadCallback, this, "gem_hp"));
textureCache->addImageAsync(IMG_PLAYER + "upLevel.png", CC_CALLBACK_1(MenuLayer::loadCallback, this, "gem_bullet"));
textureCache->addImageAsync(IMG_PLAYER + "skill1.png", CC_CALLBACK_1(MenuLayer::loadCallback, this, "gem_missile"));
textureCache->addImageAsync(IMG_PLAYER + "skill2.png", CC_CALLBACK_1(MenuLayer::loadCallback, this, "gem_thunder"));
textureCache->addImageAsync(IMG_PLAYER + "thunder.png", CC_CALLBACK_1(MenuLayer::loadCallback, this, IMG_PLAYER + "thunder.plist"));
textureCache->addImageAsync(IMG_ENEMY + "enemy.png", CC_CALLBACK_1(MenuLayer::loadCallback, this, IMG_ENEMY + "enemy.plist"));
textureCache->addImageAsync(IMG_ENEMY + "explosion.png", CC_CALLBACK_1(MenuLayer::loadCallback, this, IMG_ENEMY + "explosion.plist"));
return true;
}
示例10: initWithQuantityOfNodes
////////////////////////////////////////////////////////
//
// NodeChildrenMainScene
//
////////////////////////////////////////////////////////
void NodeChildrenMainScene::initWithQuantityOfNodes(unsigned int nNodes)
{
//srand(time());
Size s = Director::sharedDirector()->getWinSize();
// Title
LabelTTF *label = LabelTTF::create(title().c_str(), "Arial", 40);
addChild(label, 1);
label->setPosition(ccp(s.width/2, s.height-32));
label->setColor(ccc3(255,255,40));
// Subtitle
std::string strSubTitle = subtitle();
if(strSubTitle.length())
{
LabelTTF *l = LabelTTF::create(strSubTitle.c_str(), "Thonburi", 16);
addChild(l, 1);
l->setPosition(ccp(s.width/2, s.height-80));
}
lastRenderedCount = 0;
currentQuantityOfNodes = 0;
quantityOfNodes = nNodes;
MenuItemFont::setFontSize(65);
MenuItemFont *decrease = MenuItemFont::create(" - ", [&](Object *sender) {
quantityOfNodes -= kNodesIncrease;
if( quantityOfNodes < 0 )
quantityOfNodes = 0;
updateQuantityLabel();
updateQuantityOfNodes();
});
decrease->setColor(ccc3(0,200,20));
MenuItemFont *increase = MenuItemFont::create(" + ", [&](Object *sender) {
quantityOfNodes += kNodesIncrease;
if( quantityOfNodes > kMaxNodes )
quantityOfNodes = kMaxNodes;
updateQuantityLabel();
updateQuantityOfNodes();
});
increase->setColor(ccc3(0,200,20));
Menu *menu = Menu::create(decrease, increase, NULL);
menu->alignItemsHorizontally();
menu->setPosition(ccp(s.width/2, s.height/2+15));
addChild(menu, 1);
LabelTTF *infoLabel = LabelTTF::create("0 nodes", "Marker Felt", 30);
infoLabel->setColor(ccc3(0,200,20));
infoLabel->setPosition(ccp(s.width/2, s.height/2-15));
addChild(infoLabel, 1, kTagInfoLayer);
NodeChildrenMenuLayer* pMenu = new NodeChildrenMenuLayer(true, TEST_COUNT, s_nCurCase);
addChild(pMenu);
pMenu->release();
updateQuantityLabel();
updateQuantityOfNodes();
}
示例11: initWithSubTest
////////////////////////////////////////////////////////
//
// SpriteMainScene
//
////////////////////////////////////////////////////////
void SpriteMainScene::initWithSubTest(int asubtest, int nNodes)
{
//srandom(0);
subtestNumber = asubtest;
_subTest = new SubTest;
_subTest->initWithSubTest(asubtest, this);
Size s = Director::sharedDirector()->getWinSize();
lastRenderedCount = 0;
quantityNodes = 0;
MenuItemFont::setFontSize(65);
MenuItemFont *decrease = MenuItemFont::create(" - ", CC_CALLBACK_1(SpriteMainScene::onDecrease, this));
decrease->setColor(ccc3(0,200,20));
MenuItemFont *increase = MenuItemFont::create(" + ", CC_CALLBACK_1(SpriteMainScene::onIncrease, this));
increase->setColor(ccc3(0,200,20));
Menu *menu = Menu::create(decrease, increase, NULL);
menu->alignItemsHorizontally();
menu->setPosition(ccp(s.width/2, s.height-65));
addChild(menu, 1);
LabelTTF *infoLabel = LabelTTF::create("0 nodes", "Marker Felt", 30);
infoLabel->setColor(ccc3(0,200,20));
infoLabel->setPosition(ccp(s.width/2, s.height-90));
addChild(infoLabel, 1, kTagInfoLayer);
// add menu
SpriteMenuLayer* pMenu = new SpriteMenuLayer(true, TEST_COUNT, s_nSpriteCurCase);
addChild(pMenu, 1, kTagMenuLayer);
pMenu->release();
// Sub Tests
MenuItemFont::setFontSize(32);
Menu* pSubMenu = Menu::create();
for (int i = 1; i <= 9; ++i)
{
char str[10] = {0};
sprintf(str, "%d ", i);
MenuItemFont* itemFont = MenuItemFont::create(str, CC_CALLBACK_1(SpriteMainScene::testNCallback, this));
itemFont->setTag(i);
pSubMenu->addChild(itemFont, 10);
if( i<= 3)
itemFont->setColor(ccc3(200,20,20));
else if(i <= 6)
itemFont->setColor(ccc3(0,200,20));
else
itemFont->setColor(ccc3(0,20,200));
}
pSubMenu->alignItemsHorizontally();
pSubMenu->setPosition(ccp(s.width/2, 80));
addChild(pSubMenu, 2);
// add title label
LabelTTF *label = LabelTTF::create(title().c_str(), "Arial", 40);
addChild(label, 1);
label->setPosition(ccp(s.width/2, s.height-32));
label->setColor(ccc3(255,255,40));
while(quantityNodes < nNodes)
onIncrease(this);
}
示例12: initWithSubTest
////////////////////////////////////////////////////////
//
// ParticleMainScene
//
////////////////////////////////////////////////////////
void ParticleMainScene::initWithSubTest(int asubtest, int particles)
{
//srandom(0);
subtestNumber = asubtest;
Size s = Director::getInstance()->getWinSize();
lastRenderedCount = 0;
quantityParticles = particles;
MenuItemFont::setFontSize(65);
MenuItemFont *decrease = MenuItemFont::create(" - ", [&](Object *sender) {
quantityParticles -= kNodesIncrease;
if( quantityParticles < 0 )
quantityParticles = 0;
updateQuantityLabel();
createParticleSystem();
});
decrease->setColor(Color3B(0,200,20));
MenuItemFont *increase = MenuItemFont::create(" + ", [&](Object *sender) {
quantityParticles += kNodesIncrease;
if( quantityParticles > kMaxParticles )
quantityParticles = kMaxParticles;
updateQuantityLabel();
createParticleSystem();
});
increase->setColor(Color3B(0,200,20));
Menu *menu = Menu::create(decrease, increase, NULL);
menu->alignItemsHorizontally();
menu->setPosition(Point(s.width/2, s.height/2+15));
addChild(menu, 1);
LabelTTF *infoLabel = LabelTTF::create("0 nodes", "Marker Felt", 30);
infoLabel->setColor(Color3B(0,200,20));
infoLabel->setPosition(Point(s.width/2, s.height - 90));
addChild(infoLabel, 1, kTagInfoLayer);
// particles on stage
LabelAtlas *labelAtlas = LabelAtlas::create("0000", "fps_images.png", 12, 32, '.');
addChild(labelAtlas, 0, kTagLabelAtlas);
labelAtlas->setPosition(Point(s.width-66,50));
// Next Prev Test
ParticleMenuLayer* menuLayer = new ParticleMenuLayer(true, TEST_COUNT, s_nParCurIdx);
addChild(menuLayer, 1, kTagMenuLayer);
menuLayer->release();
// Sub Tests
MenuItemFont::setFontSize(40);
Menu* pSubMenu = Menu::create();
for (int i = 1; i <= 6; ++i)
{
char str[10] = {0};
sprintf(str, "%d ", i);
MenuItemFont* itemFont = MenuItemFont::create(str, CC_CALLBACK_1(ParticleMainScene::testNCallback, this));
itemFont->setTag(i);
pSubMenu->addChild(itemFont, 10);
if (i <= 3)
{
itemFont->setColor(Color3B(200,20,20));
}
else
{
itemFont->setColor(Color3B(0,200,20));
}
}
pSubMenu->alignItemsHorizontally();
pSubMenu->setPosition(Point(s.width/2, 80));
addChild(pSubMenu, 2);
LabelTTF *label = LabelTTF::create(title().c_str(), "Arial", 40);
addChild(label, 1);
label->setPosition(Point(s.width/2, s.height-32));
label->setColor(Color3B(255,255,40));
updateQuantityLabel();
createParticleSystem();
schedule(schedule_selector(ParticleMainScene::step));
}