本文整理汇总了C++中CSprite::setControlName方法的典型用法代码示例。如果您正苦于以下问题:C++ CSprite::setControlName方法的具体用法?C++ CSprite::setControlName怎么用?C++ CSprite::setControlName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CSprite
的用法示例。
在下文中一共展示了CSprite::setControlName方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: init
bool CUpdateLogView::init(CGameUpdateScene *updataScene,bool isUpdate)
{
m_updataScene = updataScene;
m_isUpdate = isUpdate;
if( !CContainer::init() )
return onInitialized(false);
CCSize winSize = CCDirector::sharedDirector()->getVisibleSize();
CCSpriteFrameCache::sharedSpriteFrameCache()->addSpriteFramesWithFile("General.plist");
CSprite *pBackground = CSprite::createWithSpriteFrameName("general_first_underframe.png", CCRectMake(75.0f, 75.0f, 25.0f, 25.0f));
pBackground->setPreferredSize(CCSizeMake(600,500));
pBackground->setPosition(ccp(winSize.width/2.0f+30.0f, winSize.height/2.0f + 50.0f));
addChild(pBackground);
CSprite *pTitleImg = CSprite::create("loginResources/signs_word_yxgxgg.png");
pTitleImg->setControlName("this CUpdateLogView pTitleImg 81");
pTitleImg->setPosition(ccp( winSize.width/2.0f+30.0f, winSize.height/2.0f + 255 ));
addChild(pTitleImg);
//webView
CCSize screenSize = CDevice::sharedDevice()->getScreenSize();
m_pWebView = CWebView::create();
CCSize mySize;
#if( CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
mySize = CCSizeMake(screenSize.height, screenSize.width);
#elif( CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
mySize = CCSizeMake(screenSize.width, screenSize.height);
#endif
CCSize bgSize = pBackground->getPreferredSize();
CCSize viewSize = CCSizeMake(mySize.width / winSize.width * (bgSize.width-40) , mySize.height / 640 * bgSize.height*0.68f);
m_pWebView->setPreferredSize(viewSize);
m_pWebView->setPosition(ccp( mySize.width/2-viewSize.width/2+30.0f/winSize.width*mySize.width,100.0f/winSize.height*mySize.height ));
addChild(m_pWebView);
//添加 进入按钮
m_pGoInBtn = CButton::createWithSpriteFrameName("进入游戏", "general_button_normal.png");
CCSize buttonSize = m_pGoInBtn->getPreferredSize();
m_pGoInBtn->setPosition(ccp(winSize.width/2.0f+30.0f,winSize.height*0.25f));
m_pGoInBtn->addEventListener("TouchBegan", this, eventhandler_selector(CUpdateLogView::onBeganTouchGoInButton));
addChild(m_pGoInBtn);
char szUrl[1024];
__getUrl(szUrl);
m_pWebView->loadGet(szUrl);
if(m_isUpdate)
{
m_pGoInBtn->setTouchesEnabled( false );
m_pWebView->loadGet(szUrl, NULL, NULL, 0U, this , eventhandler_selector(CUpdateLogView::onUpdateLogLoaded));
CCLOG(" CUpdateLogView %s",szUrl);
}
return onInitialized(true);
}