本文整理汇总了C++中CCMenuItemSprite::setRotation方法的典型用法代码示例。如果您正苦于以下问题:C++ CCMenuItemSprite::setRotation方法的具体用法?C++ CCMenuItemSprite::setRotation怎么用?C++ CCMenuItemSprite::setRotation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCMenuItemSprite
的用法示例。
在下文中一共展示了CCMenuItemSprite::setRotation方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: startPlay
//private
void RPGMapSceneLayer::startPlay(float delay)
{
CCTMXTiledMap *bgMap = (CCTMXTiledMap*)this->getChildByTag(kRPGMapSceneLayerTagBgMap);
//数据库部分,读取npc数据
CppSQLite3Query query = this->m_db.execQuery(CCString::createWithFormat(NPC_QUERY, this->m_mapData.mapId)->getCString());
while(!query.eof())
{
float x = (stringToNumber<float>(query.getStringField("tmx_x")) + 0.5) * GAME_TMX_ROLE_WIDTH;
float y = (stringToNumber<float>(query.getStringField("tmx_y")) + 0.5) * GAME_TMX_ROLE_HEIGHT;
bool autoMove = query.getIntField("auto_move") == 1 ? true : false;
RPGMapNPCRoleSprite *npc = RPGMapNPCRoleSprite::create(query.getIntField("id"), CCString::create(query.getStringField("map_texture")), CCString::create("head_texture"), CCString::create(query.getStringField("name_cns")), CCString::create(query.getStringField("content_cns")), 1, autoMove);
npc->setTag(kRPGMapSceneLayerTagNPC + query.getIntField("id"));
npc->setPosition(ccp(x, y));
bgMap->addChild(npc);
query.nextRow();
}
query.finalize();
//player
int defaultSpriteFrameIndex = 1; //默认为向下
if(this->m_mapData.playerDirection.compare("up") == 0)
{
defaultSpriteFrameIndex = 10;
}
else if(this->m_mapData.playerDirection.compare("left") == 0)
{
defaultSpriteFrameIndex = 4;
}
else if(this->m_mapData.playerDirection.compare("right") == 0)
{
defaultSpriteFrameIndex = 7;
}
RPGMapRoleSprite *player = RPGMapRoleSprite::create(CCString::create("actor4_0.png"), CCString::create("Player"), true, defaultSpriteFrameIndex);
player->setPosition(ccp(this->m_mapData.playerToX * GAME_TMX_ROLE_WIDTH, this->m_mapData.playerToY * GAME_TMX_ROLE_HEIGHT));
player->setTag(kRPGMapSceneLayerTagPlayer);
player->m_type = kRPGMapRoleSpriteTypePlayer;
bgMap->addChild(player);
CCSprite *spJoystick = CCSprite::createWithSpriteFrameName("Ball.png");
CCSprite *joystickBg = CCSprite::createWithSpriteFrameName("Dock.png");
OzgJoystickLayer *joystick = OzgJoystickLayer::layerActivityJoystick(50, spJoystick, joystickBg, false);
joystick->setTag(kRPGMapSceneLayerTagJoystick);
joystick->m_target = this;
joystick->m_endedSelector = callfunc_selector(RPGMapSceneLayer::joystickEndedFunc);
this->addChild(joystick);
//menu
CCMenu *mainMenu = CCMenu::create();
mainMenu->setTag(kRPGMapSceneLayerTagMainMenu);
mainMenu->setAnchorPoint(ccp(0.5, 0.5));
mainMenu->setPosition(CCPointZero);
mainMenu->setContentSize(bgMap->getContentSize());
bgMap->addChild(mainMenu);
CCMenuItemSprite *menuCommand = CCMenuItemSprite::create(CCSprite::createWithSpriteFrameName("commons_btn_back_04.png"), CCSprite::createWithSpriteFrameName("commons_btn_back_04.png"), this, menu_selector(RPGMapSceneLayer::onMenu));
menuCommand->setPosition(ccp(mainMenu->getContentSize().width - 35, mainMenu->getContentSize().height - 35));
menuCommand->setTag(kRPGMapSceneLayerTagMainMenuCommand);
menuCommand->setRotation(180);
menuCommand->setScale(0.75);
mainMenu->addChild(menuCommand);
// CCTextureCache::sharedTextureCache()->dumpCachedTextureInfo();
CCDirector::sharedDirector()->getTouchDispatcher()->addTargetedDelegate(this, 1, true);
this->scheduleUpdate();
}