临时文件

bool HelloWorld::init()
{
     CCSize     size = CCDirector::sharedDirector()->getWinSize();

     // 创建一个无形节点
     CCNode*     pNode = CCNode::create();
     this->addChild(pNode, 0);

     // 添加菜单项、菜单
     CCMenuItemImage*     pCloseItem = CCMenuItemImage::create("CloseNormal.png", "CloseSelected.png", this,
                                                                           menu_selector(HelloWorld::menuCloseCallback));
     pCloseItem->setPosition(ccp(size.width - 20, 20));
    
     CCMenu*     pMenu = CCMenu::create(pCloseItem, NULL);
     pMenu->setPosition(CCPointZero);
     pNode->addChild(pMenu, 1);

     // 添加显示文本
     CCLabelTTF*     pLabel     = CCLabelTTF::create("Hello World", "Thonburi", 34);
     pLabel->setPosition(ccp(size.width / 2, size.height - 20));
     pNode->addChild(pLabel, 1);

     // 添加精灵
     CCSprite*     pSprite     = CCSprite::create("HelloWorld.png");
     pSprite->setPosition(ccp(size.width / 2, size.height / 2));
     pNode->addChild(pSprite, 0);
    
     pNode->setScale(0.5f);                                             // 整体缩放
     pNode->setPosition(size.width / 2, size.height / 2);     // 整体移动
     pNode->setRotation(90.0);                                        // 整体旋转

     return true;
}

 

posted @ 2014-01-16 18:04  Shadow_magic  阅读(348)  评论(0编辑  收藏  举报