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


C++ CCTableView::setAnchorPoint方法代码示例

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


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

示例1: init

bool MallMarkets::init()
{
    
    if (!CCLayer::init()) {
        return false;
    }
    writablePathLocal = CCFileUtils::sharedFileUtils()->getWritablePath();
    layerMarket = NULL;
    

    ColorLayer *modleLayer = ColorLayer::create();
    modleLayer->setOpacity(100);
    this->addChild(modleLayer);
    
    
    CCSize winSize = CCDirector::sharedDirector()->getWinSize();
    
    CCSprite *bg = CCSprite::create("ZF_Shoot_background_coinList.png");
    CCSize size = bg->getContentSize();
    bg->setContentSize(CCSize(winSize.width*0.58, winSize.height*0.98));
    bg->setPosition(ccp(winSize.width/2,winSize.height*0.5));
    this->addChild(bg);
    
    
    //1.加载服务器所有奖品
    
    //2.init tableView
    this->tableViewX = winSize.width*0.17;
    
    //获取奖品表格的高度
    CCSprite *pSprite = CCSprite::create("ZF_Shoot_Button_gridItem.png");
    
    CCSize tableCellSize = pSprite->getContentSize();
    this->tableViewCellHeight = tableCellSize.height;
    CCLog("tableViewCellHeight: %d",this->tableViewCellHeight);
    
    
    CCTableView *tableView = CCTableView::create(this, CCSizeMake(winSize.width*0.715,winSize.height*0.71));
    tableView->setDirection(kCCScrollViewDirectionVertical);
    tableView->setAnchorPoint(ccp(0, 0));
    tableView->setPosition( ccp(winSize.width*0.22,winSize.height*0.15));
    tableView->setDelegate(this);
    tableView->setVerticalFillOrder(kCCTableViewFillTopDown);
    tableView->setTag(1136);
    this->addChild(tableView);
    tableView->reloadData();
    
    
    
    //3.添加2个按钮
    //ZF_Shoot_button_serverPrizeList_mall2
    CCMenuItemImage *item1 = CCMenuItemImage::create("ZF_Shoot_button_coinList_fubi1.png", "ZF_Shoot_button_coinList_fubi1.png");
    CCMenuItemImage *item2 = CCMenuItemImage::create("ZF_Shoot_button_coinList_fubi2.png", "ZF_Shoot_button_coinList_fubi2.png");
    
    toggleServer = CCMenuItemToggle::createWithTarget(this, menu_selector(MallMarkets::menuItemCall), item1,item2,NULL);
    toggleServer->setPosition( CCPointMake(winSize.width*0.325, winSize.height*0.86));
    toggleServer->setAnchorPoint(ccp(1, 0));
    toggleServer->setEnabled(false);
    toggleServer->setTag(1122);
    
    
    //ZF_Shoot_button_coinList_prop2ZF_Shoot_button_coinList_prop2
    CCMenuItemImage *item3 = CCMenuItemImage::create("ZF_Shoot_button_coinList_prop2.png", "ZF_Shoot_button_coinList_prop2.png");
    CCMenuItemImage *item4 = CCMenuItemImage::create("ZF_Shoot_button_coinList_prop1.png", "ZF_Shoot_button_coinList_prop1.png");
    
    togglePlayer = CCMenuItemToggle::createWithTarget(this, menu_selector(MallMarkets::menuItemCall), item3,item4,NULL);
    togglePlayer->setTag(1133);
    togglePlayer->setPosition( CCPointMake(winSize.width*0.425, winSize.height*0.86));
    //togglePlayer->setAnchorPoint(CCPointZero);
    togglePlayer->setAnchorPoint(ccp(1, 0));
    
    
    CCMenu *menu = CCMenu::create(toggleServer,togglePlayer,NULL);
    menu->setPosition(CCPointZero);
    this->addChild(menu, 1);
    
    
    //4.返回按钮
    CCMenuItemImage *pCloseItem = CCMenuItemImage::create(
                                                          "ZF_Shoot_button_coinList_back1.png",
                                                          "ZF_Shoot_button_coinList_back2.png",
                                                          this,
                                                          menu_selector(MallMarkets::menuCloseCallBack) );
    pCloseItem->setPosition( CCPointMake(winSize.width*0.75 , winSize.height*0.92) );
    CCMenu* pMenu = CCMenu::create(pCloseItem, NULL);
    pMenu->setPosition( CCPointZero );
    this->addChild(pMenu);
    
    return  true;
    
    
}
开发者ID:valentman,项目名称:Shoot,代码行数:92,代码来源:MallMarkets.cpp

示例2: CCLog

bool S3PracticeScene::init()
{
	bool bRet = false;
	do 
	{
		CC_BREAK_IF(! CCLayer::init());
        
        
		//每个项目都要创建的东西

		_menu = CCMenu::create(NULL);
		_menu->setPosition(CCPointZero);
		CC_BREAK_IF(! _menu);

		this->addChild(_menu, 2);

        
	
        //NavBar及背景图
        
        {
            {
                CCSprite * aSprite = CCSprite::create("pBackground.png");
                aSprite->setPosition(ccp(visibleSize.width / 2, visibleSize.height / 2));
                //CC_BREAK_IF(! aSprite);
                this->addChild(aSprite,1);
                aSprite ->getTexture()->setAntiAliasTexParameters();//抗锯齿
            }
            
            {
                CCSprite * aSprite = CCSprite::create("pNavBar.png");
                aSprite->setPosition(s3Position2_macro(aSprite));
                //CC_BREAK_IF(! aSprite);
                this->addChild(aSprite,1);
            }
            
            {
                CCLabelTTF * titleLabel = CCLabelTTF::create("Practice", "Arial", s3FontSize1_macro);
                titleLabel->setPosition(s3Position1_macro(aItem));
                //CC_BREAK_IF(! aSprite);
                this->addChild(titleLabel,1);
            }
        }
		
        
        
        //TabBar及按钮
        
        {
            //TabBar
            {
                CCSprite * aSprite = CCSprite::create("pTabBar.png");
                aSprite->setPosition(CCPointZero);
                aSprite->setAnchorPoint(CCPointZero);
                //CC_BREAK_IF(! aSprite);
                this->addChild(aSprite,1);
            }
            
            //GRE模考按钮
            {
                CCSprite * sprite1 = CCSprite::create("pPencilIconActive.png");
                CCSprite * sprite2 = CCSprite::create("pPencilIconActive.png");
                CCMenuItemSprite *aItem = CCMenuItemSprite::create(
                                                                   sprite1,
                                                                   sprite2,
                                                                   this,
                                                                   menu_selector(S3PracticeScene::menuOnPencil));
                CC_BREAK_IF(! aItem);
                aItem->setPosition(s3Position5_macro(aItem));
                _menu ->addChild(aItem,1);
            }
            
            //备考资料按钮
            {
                CCSprite * sprite1 = CCSprite::create("pDocumentIcon.png");
                CCSprite * sprite2 = CCSprite::create("pDocumentIconActive.png");
                CCMenuItemSprite *aItem = CCMenuItemSprite::create(
                                                                   sprite1,
                                                                   sprite2,
                                                                   this,
                                                                   menu_selector(S3PracticeScene::menuOnDocument));
                CC_BREAK_IF(! aItem);
                aItem->setPosition(s3Position6_macro(aItem));
                _menu ->addChild(aItem,1);
            }
            
            //设置按钮
            {
                CCSprite * sprite1 = CCSprite::create("pSettingsIcon.png");
                CCSprite * sprite2 = CCSprite::create("pSettingsIconActive.png");
                CCMenuItemSprite *aItem = CCMenuItemSprite::create(
                                                                   sprite1,
                                                                   sprite2,
                                                                   this,
                                                                   menu_selector(S3PracticeScene::menuOnSettings));
                CC_BREAK_IF(! aItem);
                aItem->setPosition(s3Position7_macro(aItem));
                _menu ->addChild(aItem,1);
            }
            
//.........这里部分代码省略.........
开发者ID:liuyuyefz,项目名称:GreTest,代码行数:101,代码来源:S3PracticeScene.cpp

示例3: setDimensions

// on "init" you need to initialize your instance
bool S11PrepareRes::init()
{
    //////////////////////////////
    // 1. super init first
    if ( !CCLayer::init() )
    {
        return false;
    }
    //每个项目都要创建的东西
    
    _menu = CCMenu::create(NULL);
    _menu->setPosition(CCPointZero);
    this->addChild(_menu, 101);
    
    titleString = "";
    
	scriptMap=ScriptParser::paserScript("S11PrepareRes","leftTitle");//right_TableView_Map

    //背景图
    
    {
        CCSprite * aSprite = CCSprite::create("s11Background.png");
        aSprite->setPosition(ccp(visibleSize.width / 2, visibleSize.height / 2));
        //CC_BREAK_IF(! aSprite);
        this->addChild(aSprite,98);
        aSprite ->getTexture()->setAntiAliasTexParameters();//抗锯齿
    }
    //控件
    
    {
        CCSprite * aSprite = CCSprite::create("s11NavBar.png");
        aSprite->setAnchorPoint(ccp(0.0,1.0));
        aSprite->setPosition(ccp(0,visibleSize.height-40));
        this->addChild(aSprite,100);
    }
    
    
    {
        CCLabelTTF * leftTitleLabel = CCLabelTTF::create(s11Str2_macro,s11FontName_macro,s11TitleFontSize_macro);
        CCLabelTTF* pLabel = leftTitleLabel;
        pLabel->setColor(ccWHITE);
        
        pLabel->setPosition( s11Position3_macro(pLabel));
        this->addChild(pLabel, 100);
    }
    
    titleLabel = CCLabelTTF::create(s11Str2_macro,s11FontName_macro,s11TitleFontSize_macro);
    CCLabelTTF* pLabel = titleLabel;
    pLabel->setColor(ccWHITE);
    
    pLabel->setPosition( s11Position4_macro(pLabel));
    this->addChild(pLabel, 100);
    
    
    
    {
        CCSprite * aSprite = CCSprite::create("pRecButton.png");
        aSprite->setPosition(s11Position1_macro(aSprite));
        this->addChild(aSprite,100);
        
        
        CCSprite * aSprite1 = CCSprite::create("s11FullScreenIcon.png");
        aSprite1->setPosition(s11Position1_macro(aItem));
        this->addChild(aSprite1,100);
    
        CCSprite * sprite1 = CCSprite::create();
        CCSprite * sprite2 = CCSprite::create();
        
        CCMenuItemSprite *aItem = CCMenuItemSprite::create(
                                                           sprite1,
                                                           sprite2,
                                                           this,
                                                           menu_selector(S11PrepareRes::menuCloseCallback));
        aItem->setPosition(s11Position1_macro(aItem));
        aItem->setContentSize(aSprite->getContentSize());
        _menu ->addChild(aItem,100);
        
    }

    
    
    CCTableView * tableView = CCTableView::create(this, s11Size1_macro);
    tableView->setAnchorPoint(ccp(0.0,0.0));
    tableView->setDirection(kCCScrollViewDirectionVertical);
    tableView->setPosition(s11Position8_macro(tableView));
    tableView->setDelegate(this);
    tableView->setVerticalFillOrder(kCCTableViewFillTopDown);
    this->addChild(tableView,99);
    tableView->reloadData();
    

    std::string aStr = ScriptParser::readScript("s11TableCellTxt1.txt");
    S11PrepareRes::detailString = aStr;
    rightDetailTex = CCLabelTTF::create(aStr.c_str(), "Helvetica", 30.0);
    rightDetailTex->setColor(ccBLACK);
    rightDetailTex-> setDimensions(s11Size2_macro);
    rightDetailTex->setPosition(s11Position9_macro(label));
    this->addChild(rightDetailTex,100);
    //TabelBar
//.........这里部分代码省略.........
开发者ID:liuyuyefz,项目名称:GreTest,代码行数:101,代码来源:S11PrepareResScene.cpp


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