本文整理汇总了C++中CCLayerColor::setAnchorPoint方法的典型用法代码示例。如果您正苦于以下问题:C++ CCLayerColor::setAnchorPoint方法的具体用法?C++ CCLayerColor::setAnchorPoint怎么用?C++ CCLayerColor::setAnchorPoint使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCLayerColor
的用法示例。
在下文中一共展示了CCLayerColor::setAnchorPoint方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: showFont
void FontTest::showFont(const char *pFont)
{
CCSize s = CCDirector::sharedDirector()->getWinSize();
CCSize blockSize = CCSizeMake(s.width/3, 200);
float fontSize = 26;
removeChildByTag(kTagLabel1, true);
removeChildByTag(kTagLabel2, true);
removeChildByTag(kTagLabel3, true);
removeChildByTag(kTagLabel4, true);
CCLabelTTF *top = CCLabelTTF::create(pFont, pFont, 24);
CCLabelTTF *left = CCLabelTTF::create("alignment left", pFont, fontSize,
blockSize, kCCTextAlignmentLeft, verticalAlignment[vAlignIdx]);
CCLabelTTF *center = CCLabelTTF::create("alignment center", pFont, fontSize,
blockSize, kCCTextAlignmentCenter, verticalAlignment[vAlignIdx]);
CCLabelTTF *right = CCLabelTTF::create("alignment right", pFont, fontSize,
blockSize, kCCTextAlignmentRight, verticalAlignment[vAlignIdx]);
CCLayerColor *leftColor = CCLayerColor::create(ccc4(100, 100, 100, 255), blockSize.width, blockSize.height);
CCLayerColor *centerColor = CCLayerColor::create(ccc4(200, 100, 100, 255), blockSize.width, blockSize.height);
CCLayerColor *rightColor = CCLayerColor::create(ccc4(100, 100, 200, 255), blockSize.width, blockSize.height);
leftColor->ignoreAnchorPointForPosition(false);
centerColor->ignoreAnchorPointForPosition(false);
rightColor->ignoreAnchorPointForPosition(false);
top->setAnchorPoint(ccp(0.5, 1));
left->setAnchorPoint(ccp(0,0.5));
leftColor->setAnchorPoint(ccp(0,0.5));
center->setAnchorPoint(ccp(0,0.5));
centerColor->setAnchorPoint(ccp(0,0.5));
right->setAnchorPoint(ccp(0,0.5));
rightColor->setAnchorPoint(ccp(0,0.5));
top->setPosition(ccp(s.width/2,s.height-20));
left->setPosition(ccp(0,s.height/2));
leftColor->setPosition(left->getPosition());
center->setPosition(ccp(blockSize.width, s.height/2));
centerColor->setPosition(center->getPosition());
right->setPosition(ccp(blockSize.width*2, s.height/2));
rightColor->setPosition(right->getPosition());
this->addChild(leftColor, -1);
this->addChild(left, 0, kTagLabel1);
this->addChild(rightColor, -1);
this->addChild(right, 0, kTagLabel2);
this->addChild(centerColor, -1);
this->addChild(center, 0, kTagLabel3);
this->addChild(top, 0, kTagLabel4);
}
示例2: initTipLayer
bool TipLayer::initTipLayer()
{
CCSize winSize = CCDirector::sharedDirector()->getWinSize();
CCLayerColor *maskLayer = CCLayerColor::node();
maskLayer->initWithColorWidthHeight(ccc4f(0x00,0x00,0x00,0x80),335,350);
//maskLayer->setOpacity(200);
maskLayer->setAnchorPoint(ccp(0.5, 0.5));
maskLayer->setPosition(ccp(winSize.width/2-maskLayer->getContentSize().width/2, winSize.height/2-maskLayer->getContentSize().height/2));
this->addChild(maskLayer);
/*CCSprite *bgSprite = CCSprite::spriteWithFile("actor_pause_bg.png");
this->addChild(bgSprite);
bgSprite->setPosition(ccp(winSize.width / 2, winSize.height / 2));*/
std::string stdNameOne = "";
std::string stdNameTwo = "";
std::string contentImageName = "";
stdNameOne = s_touchfile + s_language + "actor_btn_cancel.png";
stdNameTwo = s_touchfile + s_language + "actor_btn_confirm.png";
contentImageName = s_language + "actor_img_tipContent.png";
//content
CCSprite *pContentSprite = CCSprite::spriteWithFile(contentImageName.c_str());
this->addChild(pContentSprite);
pContentSprite->setPosition(ccp(winSize.width / 2, winSize.height / 2 +100));
CCMenuItemImage *cancelItem = CCMenuItemImage::itemFromNormalImage(stdNameOne.c_str(), stdNameOne.c_str(), this, menu_selector(TipLayer::cancel));
CCMenuItemImage *confirmItem = CCMenuItemImage::itemFromNormalImage(stdNameTwo.c_str(), stdNameTwo.c_str(), this, menu_selector(TipLayer::confirm));
CCMenu *menu = CCMenu::menuWithItems(confirmItem,cancelItem,NULL);
menu->alignItemsVertically();
menu->setPosition(ccp(winSize.width / 2, winSize.height / 2 - 50));
this->addChild(menu);
CCLayer::setIsKeypadEnabled(true);
return true;
}
示例3: Load
void HSLoadingLayer::Load()
{
CCLayerColor* pMaskLayer = CCLayerColor::create(ccc4(0, 0, 0, 200),
HSBase::GetTemplateScreenW() + 10.f, HSBase::GetTemplateScreenH());
pMaskLayer->setAnchorPoint(HS_ANCHOR_CENTER);
this->addChild(pMaskLayer);
pMaskLayer->setPosition(ccp(-2.f,0));
HSToolBase::SetNodeFilldScreen(pMaskLayer);
// void *bigmem=malloc(1048576*5);
/**
CCSprite* pLoadingSprite = HSCCSprite::create("Image/LODADING.png");
pLoadingSprite->setPosition(HSBase::GetTemplateScreenCentre());
this->addChild(pLoadingSprite);*/
/**
CCSprite* pMaskSprite = HSCCSprite::create("Image/LODADINGzhezhao.png");
pMaskSprite->setOpacity(255 - 153);
m_pProgressTimeer = CCProgressTimer::create(pMaskSprite);
m_pProgressTimeer->setType(kCCProgressTimerTypeBar);
m_pProgressTimeer->setMidpoint(ccp(0,0));
m_pProgressTimeer->setBarChangeRate(ccp(1, 0));
m_pProgressTimeer->setPosition(pLoadingSprite->getPosition());
this->addChild(m_pProgressTimeer);
m_pProgressTimeer->setReverseProgress(true);
*/
if (1)
{
m_pTipsTTFUp = CCLabelTTF::create("",HS_FONT_HuaKang, 38.f, CCSizeMake(500,960),
kCCTextAlignmentCenter, kCCVerticalTextAlignmentCenter);
m_pTipsTTFUp->setPosition(ccp(320.f,800.f));
this->addChild(m_pTipsTTFUp);
CCString* pTipsStr = CCString::createWithFormat("tips_%d",
HSMath::Random(0, 19));
m_pTipsTTF = CCLabelTTF::create(L(pTipsStr->getCString()),
HS_FONT_HuaKang, 32.f, CCSizeMake(500,960),
kCCTextAlignmentCenter, kCCVerticalTextAlignmentCenter);
//m_pTipsTTF->setPosition(HSBase::GetTemplateScreenCentre());
m_pTipsTTF->setPosition(
/*ccp(HSBase::GetTemplateScreenW() / 2.f,pLoadingSprite->getContentSize().height)*/ccp(320.f,180.f));
this->addChild(m_pTipsTTF);
//m_pTipsTTF->getString();
}
// m_backSprite = HSCCSprite::create("Image/lodingback.png");
// m_backSprite->setPosition(ccp(320.f,340.f));
// this->addChild(m_backSprite);
m_pSpxLoading = SPX_Manager::CreateSprite("SPX/cat.sprite");
m_pSpxLoading->setPosition(ccp(320.f,306.f));
m_pSpxLoading->SetAction(0);
this->addChild(m_pSpxLoading);
this->setVisible(false);
}
示例4: setUpTopImage
ParkingViewScene::ParkingViewScene(EstacionamentoState _state, int _wayPointID)
{
isChangeToRoute = false;
plistTagMenuCurrent.clear();
plistMenuCurrent.clear();
setUpTopImage(Global::TOP_SRC_IMAGE_Estacionamentos);
ChangeTitle(ESTACIOMENTOS);
this->addButtonTop();
//initFixedMenu();
this->wayPointID = _wayPointID;
this->state=_state;
if( state == EST_SAIDA)
{
actualCategory = ESTACIOMENTOS;
CCLayerColor *node = CCLayerColor::create(ccc4(0,0,0,0));
node->setAnchorPoint(ccp(0,0));
node->setPosition(ccp(0,0));
this->addChild(node,0, 250);
//Carrega informacoes do Estacionamento ( semelhante waypointID
LoadParkingId();
}
else
{
//Isso e so exibido quando o usuario esta na entrada
if( wayPointID == 51)
//Exibe uma mensagem de alerta configurada para estacionamentos
AlertViewScene::showMessageParking( this,menu_selector(ParkingViewScene::btnResponse),250);
else
//Exibe o mapa do Google Maps
this->addChild(new LayerWebView(wayPointID));
}
}
示例5: onEnter
// LayerIgnoreAnchorPointScale
void LayerIgnoreAnchorPointScale::onEnter()
{
LayerTest::onEnter();
CCSize s = CCDirector::sharedDirector()->getWinSize();
CCLayerColor *l = CCLayerColor::create(ccc4(255, 0, 0, 255), 200, 200);
l->setAnchorPoint(ccp(0.5f, 1.0f));
l->setPosition(ccp( s.width/2, s.height/2));
CCScaleBy *scale = CCScaleBy::create(2, 2);
CCScaleBy* back = (CCScaleBy*)scale->reverse();
CCSequence *seq = CCSequence::create(scale, back, NULL);
l->runAction(CCRepeatForever::create(seq));
this->addChild(l, 0, kLayerIgnoreAnchorPoint);
CCSprite *child = CCSprite::create("Images/grossini.png");
l->addChild(child);
CCSize lsize = l->getContentSize();
child->setPosition(ccp(lsize.width/2, lsize.height/2));
CCMenuItemFont *item = CCMenuItemFont::create("Toogle ignore anchor point", this, menu_selector(LayerIgnoreAnchorPointScale::onToggle));
CCMenu *menu = CCMenu::create(item, NULL);
this->addChild(menu);
menu->setPosition(ccp(s.width/2, s.height/2));
}
示例6:
bool
WSGameBackGroundLayer::initWithScene(WSGameScene *scene)
{
if (CCLayer::init())
{
CCLayerColor* whiteBg = CCLayerColor::create(ccc4(255, 255, 255, 255), 500, 350);
whiteBg->setAnchorPoint(ccp(0, 0));
whiteBg->setPosition(ccp(320, 170));
this->addChild(whiteBg);
WSMap* map = scene->getGameCore()->getGameMap();
for (int i=0; i<map->getHeight(); i++) {
for (int j=0; j<map->getWidth(); j++) {
if (map->getMapNodeByXY(j, i) == kEdge)
{
CCSprite* sprite = CCSprite::create("edge.png");
sprite->setAnchorPoint(ccp(0, 0));
sprite->setPosition(ccp(320+ j*sprite->boundingBox().size.width, 170 + (map->getHeight()-i-1)*sprite->boundingBox().size.height));
this->addChild(sprite);
}
}
}
return true;
}
return false;
}
示例7: createListView
void NewsScene::createListView()
{
// CCSize size = CCSize(750, 400);
CCSize size = CCDirector::sharedDirector()->getWinSize();
CCLayerColor * fundo = CCLayerColor::create(ccc4(255, 255, 255, 255), size.width, size.height);
fundo->setAnchorPoint(ccp(0,0));
fundo->setPosition(ccp(0, 0));
this->addChild(fundo,10);
// CCLayerColor * header = CCLayerColor::create(ccc4(200, 200, 200, 255), size.width, 80);
// header->setAnchorPoint(ccp(0,0));
// header->setPosition(ccp(0, size.height -80));
// fundo->addChild(header);
CCSprite *sprHeader;
sprHeader = CCSprite::create("Header_Blue.png");
sprHeader->setAnchorPoint(ccp(0,0));
sprHeader->setScale(1);
sprHeader->setPosition(ccp(0, size.height -90));
this->addChild(sprHeader,100);
CCSprite *sprTitle;
sprTitle = CCSprite::create("tit_informacoes.png");
sprTitle->setAnchorPoint(ccp(0,0));
sprTitle->setScale(1);
sprTitle->setPosition(ccp(110, size.height -50));
this->addChild(sprTitle,101);
CCMenu* menu = CCMenu::create();
CCSprite *spriteDefault = CCSprite::create("Seta1.png");
CCSprite *spriteSelected = CCSprite::create("Seta2.png");
CCMenuItemSprite *item = CCMenuItemSprite::create(spriteDefault, spriteSelected, this, menu_selector(NewsScene::btnBack));
item->setAnchorPoint(ccp(0, 0));
item->setPosition(ccp(0, size.height -90));
menu->addChild(item, 0, 100);
menu->setPosition(ccp(10,30));
menu->setAnchorPoint(ccp(0,0));
this->addChild(menu,102);
list = CCListView::create(CCListViewModeVertical);
list = cocos2d::extension::CCListView::create(CCListViewModeVertical);
list->setDelegate(this);
list->setContentSize(CCSize(size.width, size.height-70));
list->setAnchorPoint(ccp(0,0));
list->setPosition(ccp(0, 0));
list->setColor(ccc3(50, 50, 50));
list->setSeparatorStyle(CCListViewCellSeparatorStyleNone);
fundo->addChild(list);
this->loading = new AnimatedSprite("loader_einstein1.png");
this->loading->addAnimation(AnimatedSprite::animationWithFile("loader_einstein", 24, 0.030f), "anim");//frame_count
this->addChild(this->loading,999);
this->loading->runAnimation("anim",true, true);
this->loading->setAnchorPoint(ccp(0.5f, 0.5f));
this->loading->setPosition(ccp(CCDirector::sharedDirector()->getWinSize().width/2, CCDirector::sharedDirector()->getWinSize().height/2 - 30));
this->loading->setVisible(true);
}
示例8: switchMap
//切换游戏地图之前
void GameScene::switchMap()
{
//创建一个遮罩层,用于地图切换时的显示淡入淡出效果
CCLayerColor* fadeLayer = CCLayerColor::layerWithColor(ccc4(0, 0, 0, 0));
fadeLayer->setAnchorPoint(CCPointZero);
fadeLayer->setPosition(CCPointZero);
addChild(fadeLayer, kFadeLayer, kFadeLayer);
//执行淡入动画,结束后调用resetGameLayer方法
CCAction* action = CCSequence::actions(
CCFadeIn::actionWithDuration(0.5f),
CCCallFunc::actionWithTarget(this, callfunc_selector(GameScene::resetGameLayer)),
NULL);
fadeLayer->runAction(action);
}
示例9: show
void ShowTip::show(const char *str, cocos2d::CCPoint& point, float fontSize, float delayTime, bool displayBg)
{
CCLabelTTF* ttfTip = CCLabelTTF::create(str, "宋体", fontSize);
ttfTip->cocos2d::CCNode::setAnchorPoint(CCPoint(0, 0));
CCSize size = ttfTip->getContentSize();
CCLayerColor* bgColor = NULL;
if (displayBg)
{
bgColor = CCLayerColor::create();
bgColor->setColor(ccColor3B(ccc3(0, 0, 0)));
bgColor->setAnchorPoint(CCPoint(0.5,0.5));
bgColor->setPosition(CCPoint(point.x - size.width * 0.5, point.y - 40));
bgColor->setContentSize(size);
bgColor->addChild(ttfTip);
this->addChild(bgColor);
ttfTip->setFontFillColor(ccColor3B(ccc3(255, 255, 255)));
}
else
{
size = CCSize(0,0);
ttfTip->setFontFillColor(ccColor3B(ccc3(0, 0, 0)));
ttfTip->setPosition(CCPoint(point.x, point.y - 60));
this->addChild(ttfTip);
}
CCAction* moveTo = CCMoveTo::create(delayTime, CCPoint(point.x - size.width * 0.5, point.y + 40));
if ( displayBg && bgColor )
{
CCFadeIn* fadeIn = CCFadeIn::create(delayTime * 0.25);
CCScaleTo* scaleTo = CCScaleTo::create(delayTime * 0.5, 1);
CCFadeOut* fadeOut = CCFadeOut::create(delayTime * 0.25);
bgColor->runAction(CCSequence::create(fadeIn,scaleTo, fadeOut, NULL));
bgColor->runAction(moveTo);
}
else
{
CCFadeIn* fadeIn = CCFadeIn::create(delayTime * 0.5);
CCFadeOut* fadeOut = CCFadeOut::create(delayTime * 0.5);
ttfTip->runAction(CCSequence::create(fadeIn, fadeOut, NULL));
ttfTip->runAction(moveTo);
}
scheduleOnce(schedule_selector(ShowTip::removeFromParent), delayTime);
}
示例10: handler_method_fill
int Bitmap::handler_method_fill( int ptr1, void* ptr2 )
{
FillRectStruct* ptr2str = (FillRectStruct*)ptr2;
Bitmap* bitmap =(Bitmap*)ptr1;
if (NULL!=bitmap->p->m_emuBitmap)
{
Vec4 color = ptr2str->color;
CCLayerColor* layerColor = CCLayerColor::create(ccc4(color.x*255,color.y*255,color.z*255,color.w*255));
layerColor->setContentSize(CCSizeMake(ptr2str->rect.w,ptr2str->rect.h));
layerColor->setAnchorPoint(ccp(0,1));
layerColor->ignoreAnchorPointForPosition(false);
layerColor->setPosition(ccp(ptr2str->rect.x,rgss_y_to_cocos_y(ptr2str->rect.y,bitmap->p->m_height)));
bitmap->p->m_emuBitmap->addChild(layerColor);
}
delete ptr2str;
return 0;
}
示例11: setTouchEnabled
// on "init" you need to initialize your instance
bool Bug914Layer::init()
{
// always call "super" init
// Apple recommends to re-assign "self" with the "super" return value
if (BugsTestBaseLayer::init())
{
setTouchEnabled(true);
// ask director the the window size
CCSize size = CCDirector::sharedDirector()->getWinSize();
CCLayerColor *layer;
for( int i=0;i < 5;i++)
{
layer = CCLayerColor::create(ccc4(i*20, i*20, i*20,255));
layer->setContentSize(CCSizeMake(i*100, i*100));
layer->setPosition(ccp(size.width/2, size.height/2));
layer->setAnchorPoint(ccp(0.5f, 0.5f));
layer->setIsRelativeAnchorPoint(true);
addChild(layer, -1-i);
}
// create and initialize a Label
CCLabelTTF *label = CCLabelTTF::create("Hello World", "Marker Felt", 64);
CCMenuItem *item1 = CCMenuItemFont::create("restart", this, menu_selector(Bug914Layer::restart));
CCMenu *menu = CCMenu::create(item1, NULL);
menu->alignItemsVertically();
menu->setPosition(ccp(size.width/2, 100));
addChild(menu);
// position the label on the center of the screen
label->setPosition(ccp( size.width /2 , size.height/2 ));
// add the label as a child to this Layer
addChild(label);
return true;
}
return false;
}
示例12: initView
//virtual
void GameItemView::initView()
{
int cardW = 200;
int cardH = 200;
setContentSize( CCSizeMake( cardW, cardH ));
setAnchorPoint(ccp(0.5f,0.5f));
CCLayerColor* bg = CCLayerColor::create(ccc4(25,25,25,155), cardW,cardH);
bg->setAnchorPoint(ccp(0,0));
addChild(bg, 1);
m_lblName = CCLabelTTF::create();
m_lblName->initWithString( "", "Arial", 24.0f );
m_lblName->setAnchorPoint(ccp(0.0f, 1.0f ) );
m_lblName->setPositionY(cardH);
addChild(m_lblName, 50);
m_lblType = CCLabelTTF::create();
m_lblType->initWithString( "", "Arial", 24.0f );
m_lblType->setAnchorPoint(ccp(0.0f, 1.0f ) );
m_lblType->setPositionY(cardH - 50);
addChild(m_lblType, 50);
}
示例13: gameOver
void GameScene::gameOver()
{
CCRingSprite* pRing;
for(std::list<int>::iterator itr = CCRingSprite::s_tags.begin(); itr != CCRingSprite::s_tags.end() ; itr++){
pRing = (CCRingSprite*)this->getChildByTag(*itr);
pRing->unscheduleUpdate();
}
getChildByTag(kTagBackground)->unscheduleUpdate();
m_pBattery->stopUserInput();
CCTintTo* toWhite = CCTintTo::create(2.0f,255,255,255);
m_pScoreLabel->runAction(toWhite);
CCLayerColor* gameOverLayer = CCLayerColor::create(ccc4(0,0,0,128),m_winSize.width,m_winSize.height);
gameOverLayer->setAnchorPoint(CCPointZero);
gameOverLayer->setPosition(ccp(0,m_winSize.height));
gameOverLayer->setOpacity(0);
CCActionInterval* fade = CCFadeIn::create(1.0f);
CCMoveTo* move = CCMoveTo::create(0.4f,CCPointZero);
gameOverLayer->runAction(CCEaseSineIn::create(CCSpawn::createWithTwoActions(fade,move)));
this->addChild(gameOverLayer,kZOrderGameOverLayer,kTagGameOverLayer);
CCDelayTime* delay = CCDelayTime::create(0.3f);
CCCallFunc* ad = CCCallFunc::create(this, callfunc_selector( GameScene::callAd) );
this->runAction(CCSequence::createWithTwoActions(delay,ad));
saveScore();
showRetryButtons();
SimpleAudioEngine::sharedEngine()->playBackgroundMusic("sounds/GameOver.mp3",false);
m_gameState = kStateGameOver;
}
示例14: CCSizeMake
//------------------------------------------------------------------
//
// LabelTTFTest
//
//------------------------------------------------------------------
LabelTTFTest::LabelTTFTest()
{
CCSize blockSize = CCSizeMake(200, 160);
CCSize s = CCDirector::sharedDirector()->getWinSize();
CCLayerColor *colorLayer = CCLayerColor::create(ccc4(100, 100, 100, 255), blockSize.width, blockSize.height);
colorLayer->setAnchorPoint(ccp(0,0));
colorLayer->setPosition(ccp((s.width - blockSize.width) / 2, (s.height - blockSize.height) / 2));
this->addChild(colorLayer);
CCMenuItemFont::setFontSize(30);
CCMenu *menu = CCMenu::create(
CCMenuItemFont::create("Left", this, menu_selector(LabelTTFTest::setAlignmentLeft)),
CCMenuItemFont::create("Center", this, menu_selector(LabelTTFTest::setAlignmentCenter)),
CCMenuItemFont::create("Right", this, menu_selector(LabelTTFTest::setAlignmentRight)),
NULL);
menu->alignItemsVerticallyWithPadding(4);
menu->setPosition(ccp(50, s.height / 2 - 20));
this->addChild(menu);
menu = CCMenu::create(
CCMenuItemFont::create("Top", this, menu_selector(LabelTTFTest::setAlignmentTop)),
CCMenuItemFont::create("Middle", this, menu_selector(LabelTTFTest::setAlignmentMiddle)),
CCMenuItemFont::create("Bottom", this, menu_selector(LabelTTFTest::setAlignmentBottom)),
NULL);
menu->alignItemsVerticallyWithPadding(4);
menu->setPosition(ccp(s.width - 50, s.height / 2 - 20));
this->addChild(menu);
m_plabel = NULL;
m_eHorizAlign = kCCTextAlignmentLeft;
m_eVertAlign = kCCVerticalTextAlignmentTop;
this->updateAlignment();
}
示例15: constructView
void SGCGMovieLayer::constructView()
{
SGNotificationCenter::sharedNotificationCenter()->addObserver(MSG_CGBATTLE_START, this, callfuncO_selector(SGCGMovieLayer::cgBattleListener));
s = CCDirector::sharedDirector()->getWinSize();
ResourceManager::sharedInstance()->bindTexture("bg/cgBg.plist", RES_TYPE_LAYER_UI, sg_cgMovieLayer);
CCSprite *cgBg = CCSprite::createWithSpriteFrameName("cgBg.png");
cgBg->setAnchorPoint(ccp(0.5, 1));
cgBg->ignoreAnchorPointForPosition(false);
cgBg->cocos2d::CCNode::setScaleX(s.width/cgBg->getContentSize().width);
cgBg->setPosition(ccp(s.width/2, s.height));
addChild(cgBg);
// SGButton *skipBt = SGButton::createFromLocal("box_btnbg.png", "跳 过", this, menu_selector(SGCGMovieLayer::cgSkipToBattle), CCPointZero, FONT_PANGWA,ccWHITE,32,false,true);
// skipBt->setPosition(ccp(s.width/2, skipBt->getContentSize().height*2));
// addBtn(skipBt);
CCLayerColor * blackBg = CCLayerColor::create(ccc4(0, 0, 0, 255), s.width, s.height);
blackBg->setTouchEnabled(false);
blackBg->ignoreAnchorPointForPosition(false);
blackBg->setAnchorPoint(ccp(0, 0));
blackBg->setPosition(ccp(0, 0));
this->addChild(blackBg, -100);
scrollRect = CCRectMake(0, s.height*0.2, s.width, s.height/4);
cgScrollView = SNSScrollView::create(scrollRect);
cgScrollView->setFrame(scrollRect);
cgScrollView->setPosition(scrollRect.origin);
cgScrollView->setHorizontal(false);
cgScrollView->setVertical(true);
cgScrollView->setTouchEnabled(false);
this->addChild(cgScrollView);
// CCSprite *scrollBg = CCSprite::createWithSpriteFrameName("barrack_kuang.png");
// scrollBg->cocos2d::CCNode::setScale(s.width/scrollBg->getContentSize().width, s.height/4/scrollBg->getContentSize().height);
// scrollBg->setPosition(ccpAdd(scrollRect.origin, ccp(s.width/2, s.height/8)));
// addChild(scrollBg);
char *spritData = new char[(int)s.width * (int)s.height *4];
memset(spritData,0,(int)s.width * (int)s.height *4);
int spriteDataSize = (int)s.width * (int)s.height*4;
for (int j=0; j<spriteDataSize; j+=4) {
spritData[j] = 0;
spritData[j+1] = 0;
spritData[j+2] = 0;
spritData[j+3] = 255;
}
CCTexture2D *pTexture = new CCTexture2D();
pTexture->initWithData(spritData, kCCTexture2DPixelFormat_Default, (int)s.width, (int)s.height, s);
finaleSprite = CCSprite::createWithTexture(pTexture);
finaleSprite->setPosition(CCPointZero);
finaleSprite->setAnchorPoint(CCPointZero);
this->addChild(finaleSprite,10,10);
finaleSprite->setVisible(false);
finaleSprite->setOpacity(0);
delete [] spritData;
pTexture->autorelease();
this->setTouchEnabled(true);
const char *str[7] = { str_CGMovieLayer_str1,
str_CGMovieLayer_str2,
str_CGMovieLayer_str3,
str_CGMovieLayer_str4,
str_CGMovieLayer_str5,
str_CGMovieLayer_str6,
str_CGMovieLayer_str7};
SGCCLabelTTF *cgMsg = NULL;
posY = -20;
for (int i=0; i<7; i++) {
cgMsg = SGCCLabelTTF::create(str[i], FONT_BOXINFO, 34);
cgMsg->cocos2d::CCNode::setPosition(s.width/2, posY);
cgScrollView->m_body->addChild(cgMsg);
posY -= 50;
}
moveCgMsgDis = CGMSGMOVEDIS;
unschedule(schedule_selector(SGCGMovieLayer::moveCgMsgUp));
if (SGPlayerInfo::sharePlayerInfo()->getCDKeyNeed()==1) {
SGNotificationCenter::sharedNotificationCenter()->addObserver(MSG_CDK, this, callfuncO_selector(SGCGMovieLayer::cdkListener));
ResourceManager::sharedInstance()->bindTexture("sgloginingbox/sgloginingbox.plist", RES_TYPE_LAYER_UI, sg_cgMovieLayer);
// ResourceManager::sharedInstance()->bindTexture("sgserverlistlayer/sgserverlistlayer.plist",RES_TYPE_LAYER_UI ,sg_registerLayer);
box = CCSprite::createWithSpriteFrameName("register_diban.png");
box->setPosition(SGLayout::getPoint(kMiddleCenter));
this->addChild(box);
m_cdk = CCEditBox::create(CCSizeMake(500, 60), CCScale9Sprite::createWithSpriteFrameName("public_kuang_input.png"));
m_cdk->setPlaceHolder(str_CGMovieLayer_str8);
m_cdk->setPlaceholderFontColor(ccc3(0x82,0x3e,0x02));
m_cdk->setMaxLength(10);
m_cdk->setReturnType(kKeyboardReturnTypeDone);
//.........这里部分代码省略.........