当前位置: 首页>>代码示例>>C++>>正文


C++ UILayer::scheduleUpdate方法代码示例

本文整理汇总了C++中UILayer::scheduleUpdate方法的典型用法代码示例。如果您正苦于以下问题:C++ UILayer::scheduleUpdate方法的具体用法?C++ UILayer::scheduleUpdate怎么用?C++ UILayer::scheduleUpdate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UILayer的用法示例。


在下文中一共展示了UILayer::scheduleUpdate方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: addChild

bool UIImageViewTest_Scale9::init()
{
    if (UIScene::init())
    {
        CCSize screenSize = CCDirector::sharedDirector()->getWinSize();
        
        UILabel *alert = UILabel::create();
        alert->setText("ImageView scale9 render");
        alert->setFontName("Marker Felt");
        alert->setFontSize(30);
        alert->setColor(ccc3(159, 168, 176));
//        alert->setPosition(ccp(screenSize.width / 2.0f, screenSize.height / 2.0f - alert->getRect().size.height * 1.75));
        m_pUiLayer->addWidget(alert);
        
        // Create the ui layer
        UILayer *ul = UILayer::create();
        ul->scheduleUpdate();
        addChild(ul);
        
        // Create the imageview
        UIImageView *imageView = UIImageView::create();
        imageView->setScale9Enabled(true);
        imageView->loadTexture("cocosgui/buttonHighlighted.png");
//        imageView->setScale9Size(CCSizeMake(200, 85));
//        imageView->setPosition(ccp(screenSize.width / 2.0f, screenSize.height / 2.0f + imageView->getRect().size.height / 4.0f));
        ul->addWidget(imageView);
        
        return true;
    }
    return false;
}
开发者ID:nutty898,项目名称:Cocos2d-x-For-CocoStudio,代码行数:31,代码来源:UIImageViewTest.cpp

示例2: onEnter

// on "init" you need to initialize your instance
void GameLoginLayer::onEnter()
{
    UILayer* uiLayer = UILayer::create();
    uiLayer->scheduleUpdate();
    
    UILayout* ui_root =dynamic_cast<UILayout*>(GUIReader::shareReader()->widgetFromJsonFile("plane_1.json"));
    uiLayer->addWidget(ui_root);
    
    UIButton *left_button = dynamic_cast<UIButton*>(uiLayer->getWidgetByName("TextButton_34"));
    left_button->addReleaseEvent(this, SEL_ReleaseEvent(&GameLoginLayer::loginBtnCallback));
    
    m_CCLayer->addChild(uiLayer);
}
开发者ID:hetter,项目名称:planeX_Project,代码行数:14,代码来源:GameLoginLayer.cpp

示例3: init

bool ChoosePackageScene::init()
{
    //////////////////////////////
    // 1. super init first
    if ( !CCLayer::init() )
    {
        return false;
    }

    setKeypadEnabled(true);

    CCDirector *director = CCDirector::sharedDirector();
    LayoutManager *layoutManager = LayoutManager::getInstance();
    CCRect visibleRect = layoutManager->getVisibleRect();

    m_Background = CCSprite::create("bg_common.jpg");
    m_Background->retain();
    m_Background->setPosition(director->getVisibleOrigin() + director->getVisibleSize() / 2);
    addChild(m_Background);

    CCSprite *sprite = CCSprite::create("stage_select.png");
    sprite->setPosition(ccp(visibleRect.origin.x + visibleRect.size.width / 2, 630));
    addChild(sprite);

    // Create the page view
    int pageViewHeight = 556;
    int pageWidth = 336;
    LGPageView *pageView = LGPageView::create();
    pageView->setTouchEnabled(true);
    pageView->setSize(CCSizeMake(visibleRect.size.width, pageViewHeight));
    pageView->setPosition(CCSizeMake(visibleRect.origin.x,  + visibleRect.origin.y + (visibleRect.size.height - pageViewHeight) / 2));
    pageView->setPageWidth(pageWidth);
    pageView->setIndicatorEnable(true);

    StageManager *stageManager = StageManager::getInstance();
    for (int i = 0; i < sizeof(PACKAGE_IMAGE) / sizeof(PACKAGE_IMAGE[0]); ++i)
    {
        Layout *layout = Layout::create();
        layout->setSize(CCSizeMake(pageWidth, pageView->getSize().height));

        UIImageView *imageView = UIImageView::create();
        imageView->loadTexture(PACKAGE_IMAGE[i]);
        imageView->setPosition(ccp(layout->getRect().size.width / 2, layout->getRect().size.height / 2));
        imageView->setTag(i);
        imageView->addReleaseEvent(this, coco_releaseselector(ChoosePackageScene::selectPackageCallback));
        imageView->setTouchEnabled(true);
        layout->addChild(imageView);

        ccFontDefinition strokeTextDef;
        strokeTextDef.m_fontSize = 100;
#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
        strokeTextDef.m_fontName = "Lithograph";
#else
        strokeTextDef.m_fontName = "fonts/Lithograph.ttf";
#endif
        strokeTextDef.m_stroke.m_strokeEnabled = true;
        strokeTextDef.m_stroke.m_strokeColor = LayoutManager::getInstance()->DefaultStroke;
        strokeTextDef.m_stroke.m_strokeSize = 30;
        strokeTextDef.m_fontFillColor = ccWHITE;
        CCLabelTTF *labelStage = CCStrokeLabel::createWithFontDefinition(CCString::createWithFormat(" %d ", (i + 1))->getCString(), strokeTextDef);
        labelStage->setPosition(ccp(layout->getRect().size.width / 2, layout->getRect().size.height / 2));
        layout->addCCNode(labelStage);

        strokeTextDef.m_fontSize = 40;
        strokeTextDef.m_stroke.m_strokeSize = 16;
        CCLabelTTF *labelCompletion = CCStrokeLabel::createWithFontDefinition(CCString::createWithFormat(" %d/%d ", stageManager->getCompletedStageCount(i), stageManager->getStageCount(i))->getCString(), strokeTextDef);
        labelCompletion->setPosition(ccp(layout->getRect().size.width / 2, layout->getRect().size.height / 2 - labelStage->getContentSize().height / 2 - labelCompletion->getContentSize().height / 2));
        layout->addCCNode(labelCompletion);

        m_LabelCompletions->addObject(labelCompletion);

        pageView->addPage(layout);
    }

    UILayer *pUiLayer = UILayer::create();
    pUiLayer->addWidget(pageView);
    addChild(pUiLayer);
    pUiLayer->scheduleUpdate();

    CCMenuItemImage *pBack = CCMenuItemImage::create("back.png", NULL, this, menu_selector(ChoosePackageScene::backCallback));
    pBack->setAnchorPoint(CCPointZero);
    pBack->setPosition(ccp(visibleRect.origin.x + 18, visibleRect.origin.y + 12));

    CCMenu *pMenu = CCMenu::create(pBack, NULL);
    pMenu->setAnchorPoint(CCPointZero);
    pMenu->setPosition(CCPointZero);
    addChild(pMenu);

    return true;
}
开发者ID:studio501,项目名称:BlockPuzzle,代码行数:90,代码来源:ChoosePackageScene.cpp


注:本文中的UILayer::scheduleUpdate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。