这段时间笔者几篇文章介绍了改文本转载的文章. 关联文章的地址
几种经常使用的菜单项:
//体字菜单项 CCMenuItemFont* itemFont = CCMenuItemFont::create("开始游戏", this, menu_selector(HelloWorld::onMenu)); //图片菜单项 CCMenuItemImage* itemImage = CCMenuItemImage::create("CloseNormal.png", "CloseSelected.png", this, menu_selector(HelloWorld::onMenu)); //文本菜单项 CCLabelTTF* label = CCLabelTTF::create("主菜单", "Helvetica", 20); CCMenuItemLabel* itemLabel = CCMenuItemLabel::create(label, this, menu_selector(HelloWorld::onMenu)); //精灵菜单项 CCSprite* BtnNormal = CCSprite::create("BtnNormal.png"); CCSprite* BtnPressed = CCSprite::create("BtnPressed.png"); CCMenuItemSprite* itemSprite = CCMenuItemSprite::create(BtnNormal, BtnPressed, this, menu_selector(HelloWorld::onMenu)); //开关菜单项 CCMenuItemFont* font1 = CCMenuItemFont::create("开"); CCMenuItemFont* font2 = CCMenuItemFont::create("关"); CCMenuItemToggle* itemToggle = CCMenuItemToggle::createWithTarget(this, menu_selector(HelloWorld::onMenu), font1, font2, NULL);
用利CCMenuItemSprite自定义Button,有按下效果:
CCSprite* btnHeroNormal=CCSprite::create("btnHeroNormal.png"); CCSprite* btnHeroPressed=CCSprite::create("btnHeroPressed.png"); CCMenuItemSprite* item=CCMenuItemSprite::create(btnHeroNormal, btnHeroPressed, this, menu_selector(HomeLayer::onButton)); CCMenu* menu=CCMenu::create(item, NULL); menu->setPosition(ccp(150, 300)); this->addChild(menu, 1);
转载请注明出处:http://blog.csdn.net/Vestigge
文章结束给大家分享下程序员的一些笑话语录:
一程序员告老还乡,想安度晚年,于是决定在书法上有所造诣。省略数字……,准备好文房4宝,挥起毛笔在白纸上郑重的写下:Hello World