本文整理汇总了C++中Bird::getBird方法的典型用法代码示例。如果您正苦于以下问题:C++ Bird::getBird方法的具体用法?C++ Bird::getBird怎么用?C++ Bird::getBird使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Bird
的用法示例。
在下文中一共展示了Bird::getBird方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: init
// on "init" you need to initialize your instance
bool GameStart::init()
{
//////////////////////////////
// 1. super init first
if ( !Layer::init() )
{
return false;
}
log("GameStart init");
Size visibleSize = Director::getInstance()->getVisibleSize();
Vec2 origin = Director::getInstance()->getVisibleOrigin();
// add a "close" icon to exit the progress. it's an autorelease object
auto closeItem = MenuItemImage::create(
"CloseNormal.png",
"CloseSelected.png",
CC_CALLBACK_1(GameStart::menuCloseCallback, this));
closeItem->setPosition(Vec2(origin.x + visibleSize.width - closeItem->getContentSize().width/2 ,
origin.y + closeItem->getContentSize().height/2));
// create menu, it's an autorelease object
auto menu = Menu::create(closeItem, NULL);
menu->setPosition(Vec2::ZERO);
this->addChild(menu, 1);
// create and initialize a label
auto label = Label::createWithTTF("Flappy Bird", "fonts/Marker Felt.ttf", 32);
label->setPosition(Vec2(origin.x + visibleSize.width/2,origin.y + visibleSize.height - 80));
this->addChild(label, 3);
//initialize the SpriteFrameCache
SpriteFrameCache *frameCache = SpriteFrameCache::getInstance();
frameCache->addSpriteFramesWithFile("birdSprites.plist");
auto ready = Sprite::createWithSpriteFrameName("text_ready.png");
ready->setPosition(visibleSize.width/2,visibleSize.height/2+100);
addChild(ready,1);
auto tutorial = Sprite::createWithSpriteFrameName("tutorial.png");
tutorial->setPosition(visibleSize.width/2,visibleSize.height/2-10);
addChild(tutorial,1);
auto ok = Sprite::createWithSpriteFrameName("button_ok.png");
auto ok_item = MenuItemSprite::create(ok,ok,nullptr,CC_CALLBACK_1(GameStart::Game_Begin,this));
auto mu = Menu::create(ok_item,0);
mu->setPosition(visibleSize.width/2,visibleSize.height/2-80);
addChild(mu,2);
auto bg = Sprite::createWithSpriteFrameName("bg_day.png");
bg->setPosition(visibleSize.width/2,visibleSize.height/2);
addChild(bg);
Bird *bird = new Bird(static_cast<BIRD_KINDS>(random(0,2)));
bird->getBird()->setPosition(visibleSize.width/2-45,visibleSize.height/2);
addChild(bird->getBird(),2);
bird->bird_Fly_Spot();
//draw the background
return true;
}